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
src/sys/http/util-mail.adb
RREE/ada-util
60
12363
----------------------------------------------------------------------- -- util-mail -- Mail Utility Library -- Copyright (C) 2017, 2018 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Fixed; package body Util.Mail is use Ada.Strings.Unbounded; use Ada.Strings.Fixed; use Ada.Strings; -- ------------------------------ -- Parse the email address and separate the name from the address. -- ------------------------------ function Parse_Address (E_Mail : in String) return Email_Address is Result : Email_Address; First_Pos : constant Natural := Index (E_Mail, "<"); Last_Pos : constant Natural := Index (E_Mail, ">"); At_Pos : constant Natural := Index (E_Mail, "@"); begin if First_Pos > 0 and Last_Pos > 0 then Result.Name := To_Unbounded_String (Trim (E_Mail (E_Mail'First .. First_Pos - 1), Both)); Result.Address := To_Unbounded_String (Trim (E_Mail (First_Pos + 1 .. Last_Pos - 1), Both)); if Length (Result.Name) = 0 and At_Pos < Last_Pos then Result.Name := To_Unbounded_String (Trim (E_Mail (First_Pos + 1 .. At_Pos - 1), Both)); end if; else Result.Address := To_Unbounded_String (Trim (E_Mail, Both)); Result.Name := To_Unbounded_String (Trim (E_Mail (E_Mail'First .. At_Pos - 1), Both)); end if; return Result; end Parse_Address; -- ------------------------------ -- Extract a first name from the email address. -- ------------------------------ function Get_First_Name (From : in Email_Address) return String is Name : constant String := To_String (From.Name); Pos : Natural := Index (Name, " "); begin if Pos > 0 then return Name (Name'First .. Pos - 1); end if; Pos := Index (Name, "."); if Pos > 0 then return Name (Name'First .. Pos - 1); else return ""; end if; end Get_First_Name; -- ------------------------------ -- Extract a last name from the email address. -- ------------------------------ function Get_Last_Name (From : in Email_Address) return String is Name : constant String := To_String (From.Name); Pos : Natural := Index (Name, " "); begin if Pos > 0 then return Trim (Name (Pos + 1 .. Name'Last), Both); end if; Pos := Index (Name, "."); if Pos > 0 then return Name (Pos + 1 .. Name'Last); else return Name; end if; end Get_Last_Name; end Util.Mail;
Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada
LaudateCorpus1/RosettaCodeData
1
19989
<filename>Task/Checkpoint-synchronization/Ada/checkpoint-synchronization.ada with Ada.Calendar; use Ada.Calendar; with Ada.Numerics.Float_Random; with Ada.Text_IO; use Ada.Text_IO; procedure Test_Checkpoint is package FR renames Ada.Numerics.Float_Random; No_Of_Cubicles: constant Positive := 3; -- That many workers can work in parallel No_Of_Workers: constant Positive := 6; -- That many workers are potentially available -- some will join the team when others quit the job type Activity_Array is array(Character) of Boolean; -- we want to know who is currently working protected Checkpoint is entry Deliver; entry Join (Label : out Character; Tolerance: out Float); entry Leave(Label : in Character); private Signaling : Boolean := False; Ready_Count : Natural := 0; Worker_Count : Natural := 0; Unused_Label : Character := 'A'; Likelyhood_To_Quit: Float := 1.0; Active : Activity_Array := (others => false); entry Lodge; end Checkpoint; protected body Checkpoint is entry Join (Label : out Character; Tolerance: out Float) when not Signaling and Worker_Count < No_Of_Cubicles is begin Label := Unused_Label; Active(Label):= True; Unused_Label := Character'Succ (Unused_Label); Worker_Count := Worker_Count + 1; Likelyhood_To_Quit := Likelyhood_To_Quit / 2.0; Tolerance := Likelyhood_To_Quit; end Join; entry Leave(Label: in Character) when not Signaling is begin Worker_Count := Worker_Count - 1; Active(Label) := False; end Leave; entry Deliver when not Signaling is begin Ready_Count := Ready_Count + 1; requeue Lodge; end Deliver; entry Lodge when Ready_Count = Worker_Count or Signaling is begin if Ready_Count = Worker_Count then Put("---Sync Point ["); for C in Character loop if Active(C) then Put(C); end if; end loop; Put_Line("]---"); end if; Ready_Count := Ready_Count - 1; Signaling := Ready_Count /= 0; end Lodge; end Checkpoint; task type Worker; task body Worker is Dice : FR.Generator; Label : Character; Tolerance : Float; Shift_End : Time := Clock + 2.0; -- Trade unions are hard! begin FR.Reset (Dice); Checkpoint.Join (Label, Tolerance); Put_Line(Label & " joins the team"); loop Put_Line (Label & " is working"); delay Duration (FR.Random (Dice) * 0.500); Put_Line (Label & " is ready"); Checkpoint.Deliver; if FR.Random(Dice) < Tolerance then Put_Line(Label & " leaves the team"); exit; elsif Clock >= Shift_End then Put_Line(Label & " ends shift"); exit; end if; end loop; Checkpoint.Leave(Label); end Worker; Set : array (1..No_Of_Workers) of Worker; begin null; -- Nothing to do here end Test_Checkpoint;
libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_imod_callee.asm
ahjelm/z88dk
640
242471
<reponame>ahjelm/z88dk<filename>libsrc/_DEVELOPMENT/math/float/am9511/c/sdcc/cam32_sdcc_imod_callee.asm ; int __imod_callee (int left, int right) SECTION code_clib SECTION code_fp_am9511 PUBLIC _am9511_imod_callee PUBLIC cam32_sdcc_imods_callee, cam32_sdcc_imodu_callee EXTERN cam32_sdcc_ireadr_callee, asm_am9511_imod_callee DEFC _am9511_imod_callee = cam32_sdcc_imods_callee .cam32_sdcc_imods_callee ; modulus sdcc int by sdcc int ; ; enter : stack = sdcc_int right, sdcc_int left, ret ; ; exit : DEHL = sdcc_int(left/right) ; ; uses : af, bc, de, hl, af', bc', de', hl' call cam32_sdcc_ireadr_callee jp asm_am9511_imod_callee ; enter stack = sdcc_int left, ret ; DEHL = sdcc_int right ; return DEHL = sdcc_int .cam32_sdcc_imodu_callee ; modulus sdcc int by sdcc int ; ; enter : stack = sdcc_int right, sdcc_int left, ret ; ; exit : DEHL = sdcc_int(left/right) ; ; uses : af, bc, de, hl, af', bc', de', hl' call cam32_sdcc_ireadr_callee res 7,h ; unsigned divisor jp asm_am9511_imod_callee ; enter stack = sdcc_int left, ret ; DEHL = sdcc_int right ; return DEHL = sdcc_int
programs/oeis/299/A299261.asm
neoneye/loda
22
29141
<filename>programs/oeis/299/A299261.asm ; A299261: Partial sums of A299255. ; 1,8,31,81,168,303,497,760,1103,1537,2072,2719,3489,4392,5439,6641,8008,9551,11281,13208,15343,17697,20280,23103,26177,29512,33119,37009,41192,45679,50481,55608,61071,66881,73048,79583,86497,93800,101503,109617,118152,127119,136529,146392,156719,167521,178808,190591,202881,215688,229023,242897,257320,272303,287857,303992,320719,338049,355992,374559,393761,413608,434111,455281,477128,499663,522897,546840,571503,596897,623032,649919,677569,705992,735199,765201,796008,827631,860081,893368,927503,962497,998360,1035103,1072737,1111272,1150719,1191089,1232392,1274639,1317841,1362008,1407151,1453281,1500408,1548543,1597697,1647880,1699103,1751377 lpb $0 mov $2,$0 sub $0,1 seq $2,299255 ; Coordination sequence for 3D uniform tiling formed by stacking parallel layers of the 3.3.4.3.4 2D tiling (cf. A219529). add $1,$2 lpe add $1,1 mov $0,$1
alloy4fun_models/trashltl/models/4/n28bTeuJbmkTGE58T.als
Kaixi26/org.alloytools.alloy
0
830
<reponame>Kaixi26/org.alloytools.alloy open main pred idn28bTeuJbmkTGE58T_prop5 { some f:File | eventually f in Trash } pred __repair { idn28bTeuJbmkTGE58T_prop5 } check __repair { idn28bTeuJbmkTGE58T_prop5 <=> prop5o }
playground/Test.asm
Dark-Tater/XSharp
0
242069
; namespace DebugStub ; .v1 = 1 Mov DWORD [DebugStub_Var_v1], 0x1 ; .v1 = AL Mov BYTE [DebugStub_Var_v1], AL ; .v1 = EAX Mov DWORD [DebugStub_Var_v1], EAX ; .v1 = #const Mov [DebugStub_Var_v1], DebugStub_Const_const
08/FunctionCalls/NestedCall/NestedCall.asm
JurajX/Nand2Tetris
0
166715
@256 D=A @SP M=D @Sys.init$ret.0 D=A @SP AM=M+1 A=A-1 M=D @LCL D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @THAT D=M @SP AM=M+1 A=A-1 M=D @5 D=A @0 D=D+A @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.init 0; JMP (Sys.init$ret.0) (Sys.init) @4000 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @5000 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT M=D @Sys.main$ret.1 D=A @SP AM=M+1 A=A-1 M=D @LCL D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @THAT D=M @SP AM=M+1 A=A-1 M=D @5 D=A @0 D=D+A @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.main 0; JMP (Sys.main$ret.1) @SP AM=M-1 D=M @6 M=D (Sys.Sys.init$LOOP) @Sys.Sys.init$LOOP 0; JMP (Sys.main) @SP A=M M=0 A=A+1 M=0 A=A+1 M=0 A=A+1 M=0 A=A+1 M=0 A=A+1 @5 D=A @SP M=D+M @4001 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @5001 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT M=D @200 D=A @SP AM=M+1 A=A-1 M=D @1 D=A @LCL D=D+M @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @40 D=A @SP AM=M+1 A=A-1 M=D @2 D=A @LCL D=D+M @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @6 D=A @SP AM=M+1 A=A-1 M=D @3 D=A @LCL D=D+M @R13 M=D @SP AM=M-1 D=M @R13 A=M M=D @123 D=A @SP AM=M+1 A=A-1 M=D @Sys.add12$ret.2 D=A @SP AM=M+1 A=A-1 M=D @LCL D=M @SP AM=M+1 A=A-1 M=D @ARG D=M @SP AM=M+1 A=A-1 M=D @THIS D=M @SP AM=M+1 A=A-1 M=D @THAT D=M @SP AM=M+1 A=A-1 M=D @5 D=A @1 D=D+A @SP D=M-D @ARG M=D @SP D=M @LCL M=D @Sys.add12 0; JMP (Sys.add12$ret.2) @SP AM=M-1 D=M @5 M=D @LCL A=M D=M @SP AM=M+1 A=A-1 M=D @1 D=A @LCL A=D+M D=M @SP AM=M+1 A=A-1 M=D @2 D=A @LCL A=D+M D=M @SP AM=M+1 A=A-1 M=D @3 D=A @LCL A=D+M D=M @SP AM=M+1 A=A-1 M=D @4 D=A @LCL A=D+M D=M @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M A=A-1 M=D+M @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=A @5 A=D-A D=M @R13 M=D @SP AM=M-1 D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @LCL AM=M-1 D=M @THAT M=D @LCL AM=M-1 D=M @THIS M=D @LCL AM=M-1 D=M @ARG M=D @LCL AM=M-1 D=M @LCL M=D @R13 A=M 0; JMP (Sys.add12) @4002 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THIS M=D @5002 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M @THAT M=D @ARG A=M D=M @SP AM=M+1 A=A-1 M=D @12 D=A @SP AM=M+1 A=A-1 M=D @SP AM=M-1 D=M A=A-1 M=D+M @LCL A=M D=A @5 A=D-A D=M @R13 M=D @SP AM=M-1 D=M @ARG A=M M=D @ARG D=M+1 @SP M=D @LCL AM=M-1 D=M @THAT M=D @LCL AM=M-1 D=M @THIS M=D @LCL AM=M-1 D=M @ARG M=D @LCL AM=M-1 D=M @LCL M=D @R13 A=M 0; JMP
programs/oeis/261/A261241.asm
karttu/loda
0
13865
<reponame>karttu/loda<gh_stars>0 ; A261241: One half of numbers representable in at least two different ways as sums of four nonvanishing cubes. See A259060 for these numbers and their representations. ; 3213,3950,4807,5796,6929,8218,9675,11312,13141,15174,17423,19900,22617,25586,28819,32328,36125,40222,44631,49364,54433,59850,65627,71776,78309,85238,92575,100332,108521,117154,126243,135800,145837,156366 mov $5,$0 add $0,10 mov $3,3 mov $4,5 lpb $0,1 sub $0,1 mov $1,$2 add $2,6 add $3,2 add $3,$4 sub $3,4 add $4,$1 lpe sub $1,$1 add $1,1 sub $3,3 mul $3,2 add $1,$3 sub $1,6 lpb $5,1 add $1,191 sub $5,1 lpe add $1,1718
cl/Skyline.g4
MarcDV1999/Skyline-Telegram-Bot
0
3486
grammar Skyline; // Definim la Gramatica, (REGLES) // Per quan haguem de processar el final del fitxer root : assignacio EOF | consulta EOF | edificis EOF | edifici EOF | edificiAleatori EOF | expr EOF; // Definim la semantica que tindra una consulta consulta : WORD; // Definim la semantica que tindra una assignacio assignacio : WORD ASSIGN expr; // Definim la semantica que tindra un edifici edifici : '(' expr ',' expr ',' expr ')' | consulta; // Definim la semantica que tindra un edifici edificis : INICIL edifici (SEP edifici)* FIL; // Definim la semantica que tindra un edifici ALeatori edificiAleatori : '{' expr ',' expr ',' expr ',' expr ',' expr '}'; // Definim les expresions de suma, resta ... de nombres naturals expr : '(' expr ')' // Mes prioritat | MENYS expr | expr MULT expr | expr DIV expr | expr (MES | MENYS) expr | edifici | edificis | edificiAleatori | NUM; // Definim Gramàtica NUM : [0-9]+ ; // Amb el + indiquem que un NUM pot ser un o mes nombres del 0-9 MES : '+' ; MENYS : '-'; MULT : '*'; DIV : '/'; WS : [ \n]+ -> skip ; // indica a l'escàner que el token WS no ha d'arribar al parser. WORD : ('a'..'z' | 'A'..'Z')+; ASSIGN : ':='; INICIL : '['; FIL : ']'; SEP : ',';
oeis/015/A015190.asm
neoneye/loda-programs
11
244260
<filename>oeis/015/A015190.asm<gh_stars>10-100 ; A015190: Sum of (Gaussian) q-binomial coefficients for q=-21. ; Submitted by <NAME> ; 1,2,-18,844,168404,164477928,-687450157352,14105258809884656,1238186812120404030096,533503696576292562518040352,-983466011800819442632186373851168,8898776193390263176983910297292084624064,344486034279370826947785936357382453706497263424,65457863429984645622942574619498236672339982836746631808,-53213576682138499166192980542553083254773378192206636420925894272,212340067814370768978934540926290244500766884564433161531837515662784304896 mov $1,$0 mov $0,0 add $1,1 mov $2,1 mov $3,1 lpb $1 sub $1,1 mov $4,$2 mul $2,-20 sub $2,$4 mul $4,$3 add $0,$4 sub $3,$4 add $3,$0 lpe mov $0,$3
src/kernel/handler.asm
MmingY/onix
1
12501
<reponame>MmingY/onix [bits 32] ; 中断处理函数入口 extern handler_table section .text %macro INTERRUPT_HANDLER 2 interrupt_handler_%1: xchg bx, bx %ifn %2 push 0x20222202 %endif push %1; 压入中断向量,跳转到中断入口 jmp interrupt_entry %endmacro interrupt_entry: ; 保存上文寄存器信息 push ds push es push fs push gs pusha ; 找到前面 push %1 压入的 中断向量 mov eax, [esp + 12 * 4] ; 向中断处理函数传递参数 push eax ; 调用中断处理函数,handler_table 中存储了中断处理函数的指针 call [handler_table + eax * 4] ; 对应 push eax,调用结束恢复栈 add esp, 4 ; 恢复下文寄存器信息 popa pop gs pop fs pop es pop ds ; 对应 push %1 ; 对应 error code 或 push magic add esp, 8 iret INTERRUPT_HANDLER 0x00, 0; divide by zero INTERRUPT_HANDLER 0x01, 0; debug INTERRUPT_HANDLER 0x02, 0; non maskable interrupt INTERRUPT_HANDLER 0x03, 0; breakpoint INTERRUPT_HANDLER 0x04, 0; overflow INTERRUPT_HANDLER 0x05, 0; bound range exceeded INTERRUPT_HANDLER 0x06, 0; invalid opcode INTERRUPT_HANDLER 0x07, 0; device not avilable INTERRUPT_HANDLER 0x08, 1; double fault INTERRUPT_HANDLER 0x09, 0; coprocessor segment overrun INTERRUPT_HANDLER 0x0a, 1; invalid TSS INTERRUPT_HANDLER 0x0b, 1; segment not present INTERRUPT_HANDLER 0x0c, 1; stack segment fault INTERRUPT_HANDLER 0x0d, 1; general protection fault INTERRUPT_HANDLER 0x0e, 1; page fault INTERRUPT_HANDLER 0x0f, 0; reserved INTERRUPT_HANDLER 0x10, 0; x87 floating point exception INTERRUPT_HANDLER 0x11, 1; alignment check INTERRUPT_HANDLER 0x12, 0; machine check INTERRUPT_HANDLER 0x13, 0; SIMD Floating - Point Exception INTERRUPT_HANDLER 0x14, 0; Virtualization Exception INTERRUPT_HANDLER 0x15, 1; Control Protection Exception INTERRUPT_HANDLER 0x16, 0; reserved INTERRUPT_HANDLER 0x17, 0; reserved INTERRUPT_HANDLER 0x18, 0; reserved INTERRUPT_HANDLER 0x19, 0; reserved INTERRUPT_HANDLER 0x1a, 0; reserved INTERRUPT_HANDLER 0x1b, 0; reserved INTERRUPT_HANDLER 0x1c, 0; reserved INTERRUPT_HANDLER 0x1d, 0; reserved INTERRUPT_HANDLER 0x1e, 0; reserved INTERRUPT_HANDLER 0x1f, 0; reserved INTERRUPT_HANDLER 0x20, 0; clock 时钟中断 INTERRUPT_HANDLER 0x21, 0 INTERRUPT_HANDLER 0x22, 0 INTERRUPT_HANDLER 0x23, 0 INTERRUPT_HANDLER 0x24, 0 INTERRUPT_HANDLER 0x25, 0 INTERRUPT_HANDLER 0x26, 0 INTERRUPT_HANDLER 0x27, 0 INTERRUPT_HANDLER 0x28, 0; rtc 实时时钟 INTERRUPT_HANDLER 0x29, 0 INTERRUPT_HANDLER 0x2a, 0 INTERRUPT_HANDLER 0x2b, 0 INTERRUPT_HANDLER 0x2c, 0 INTERRUPT_HANDLER 0x2d, 0 INTERRUPT_HANDLER 0x2e, 0 INTERRUPT_HANDLER 0x2f, 0 ; 下面的数组记录了每个中断入口函数的指针 section .data global handler_entry_table handler_entry_table: dd interrupt_handler_0x00 dd interrupt_handler_0x01 dd interrupt_handler_0x02 dd interrupt_handler_0x03 dd interrupt_handler_0x04 dd interrupt_handler_0x05 dd interrupt_handler_0x06 dd interrupt_handler_0x07 dd interrupt_handler_0x08 dd interrupt_handler_0x09 dd interrupt_handler_0x0a dd interrupt_handler_0x0b dd interrupt_handler_0x0c dd interrupt_handler_0x0d dd interrupt_handler_0x0e dd interrupt_handler_0x0f dd interrupt_handler_0x10 dd interrupt_handler_0x11 dd interrupt_handler_0x12 dd interrupt_handler_0x13 dd interrupt_handler_0x14 dd interrupt_handler_0x15 dd interrupt_handler_0x16 dd interrupt_handler_0x17 dd interrupt_handler_0x18 dd interrupt_handler_0x19 dd interrupt_handler_0x1a dd interrupt_handler_0x1b dd interrupt_handler_0x1c dd interrupt_handler_0x1d dd interrupt_handler_0x1e dd interrupt_handler_0x1f dd interrupt_handler_0x20 dd interrupt_handler_0x21 dd interrupt_handler_0x22 dd interrupt_handler_0x23 dd interrupt_handler_0x24 dd interrupt_handler_0x25 dd interrupt_handler_0x26 dd interrupt_handler_0x27 dd interrupt_handler_0x28 dd interrupt_handler_0x29 dd interrupt_handler_0x2a dd interrupt_handler_0x2b dd interrupt_handler_0x2c dd interrupt_handler_0x2d dd interrupt_handler_0x2e dd interrupt_handler_0x2f
src/gen/cups-libio_h.ads
persan/a-cups
0
19645
pragma Ada_2005; pragma Style_Checks (Off); with Interfaces.C; use Interfaces.C; with System; with Interfaces.C.Strings; with CUPS.bits_types_h; private package CUPS.libio_h is EOF : constant := (-1); -- libio.h:62 -- Copyright (C) 1991-2016 Free Software Foundation, Inc. -- This file is part of the GNU C Library. -- Written by <NAME> <<EMAIL>>. -- The GNU C Library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Lesser General Public -- License as published by the Free Software Foundation; either -- version 2.1 of the License, or (at your option) any later version. -- The GNU C 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 -- Lesser General Public License for more details. -- You should have received a copy of the GNU Lesser General Public -- License along with the GNU C Library; if not, see -- <http://www.gnu.org/licenses/>. -- As a special exception, if you link the code in this file with -- files compiled with a GNU compiler to produce an executable, -- that does not cause the resulting executable to be covered by -- the GNU Lesser General Public License. This exception does not -- however invalidate any other reasons why the executable file -- might be covered by the GNU Lesser General Public License. -- This exception applies to code released by its copyright holders -- in files containing the exception. -- ALL of these should be defined in _G_config.h -- This define avoids name pollution if we're using GNU stdarg.h -- Magic numbers and bits for the _flags field. -- The magic numbers use the high-order bits of _flags; -- the remaining bits are available for variable flags. -- Note: The magic numbers must all be negative if stdio -- emulation is desired. -- These are "formatting flags" matching the iostream fmtflags enum values. -- skipped empty struct u_IO_jump_t -- Handle lock. -- _IO_lock_t defined in internal headers during the glibc build. subtype u_IO_lock_t is System.Address; -- libio.h:150 -- A streammarker remembers a position in a buffer. type u_IO_FILE; type u_IO_marker is record u_next : access u_IO_marker; -- libio.h:157 u_sbuf : access u_IO_FILE; -- libio.h:158 u_pos : aliased int; -- libio.h:162 end record; pragma Convention (C_Pass_By_Copy, u_IO_marker); -- libio.h:156 -- If _pos >= 0 -- it points to _buf->Gbase()+_pos. FIXME comment -- if _pos < 0, it points to _buf->eBptr()+_pos. FIXME comment -- This is the structure from the libstdc++ codecvt class. type uu_codecvt_result is (uu_codecvt_ok, uu_codecvt_partial, uu_codecvt_error, uu_codecvt_noconv); pragma Convention (C, uu_codecvt_result); -- libio.h:176 -- The order of the elements in the following struct must match the order -- of the virtual functions in the libstdc++ codecvt class. -- Extra data for wide character streams. -- Current read pointer -- End of get area. -- Start of putback+get area. -- Start of put area. -- Current put pointer. -- End of put area. -- Start of reserve area. -- End of reserve area. -- The following fields are used to support backing up and undo. -- Pointer to start of non-current get area. -- Pointer to first valid character of -- backup area -- Pointer to end of non-current get area. -- High-order word is _IO_MAGIC; rest is flags. type u_IO_FILE_u_shortbuf_array is array (1..1) of char; type u_IO_FILE_u_unused2_array is array (1..(15*int'size - 4 * System.Address'Size - size_t'size)/char'size) of char; type u_IO_FILE is record u_flags : aliased int; -- libio.h:242 u_IO_read_ptr : Interfaces.C.Strings.chars_ptr; -- libio.h:247 u_IO_read_end : Interfaces.C.Strings.chars_ptr; -- libio.h:248 u_IO_read_base : Interfaces.C.Strings.chars_ptr; -- libio.h:249 u_IO_write_base : Interfaces.C.Strings.chars_ptr; -- libio.h:250 u_IO_write_ptr : Interfaces.C.Strings.chars_ptr; -- libio.h:251 u_IO_write_end : Interfaces.C.Strings.chars_ptr; -- libio.h:252 u_IO_buf_base : Interfaces.C.Strings.chars_ptr; -- libio.h:253 u_IO_buf_end : Interfaces.C.Strings.chars_ptr; -- libio.h:254 u_IO_save_base : Interfaces.C.Strings.chars_ptr; -- libio.h:256 u_IO_backup_base : Interfaces.C.Strings.chars_ptr; -- libio.h:257 u_IO_save_end : Interfaces.C.Strings.chars_ptr; -- libio.h:258 u_markers : access u_IO_marker; -- libio.h:260 u_chain : access u_IO_FILE; -- libio.h:262 u_fileno : aliased int; -- libio.h:264 u_flags2 : aliased int; -- libio.h:268 u_old_offset : aliased CUPS.bits_types_h.uu_off_t; -- libio.h:270 u_cur_column : aliased unsigned_short; -- libio.h:274 u_vtable_offset : aliased signed_char; -- libio.h:275 u_shortbuf : aliased u_IO_FILE_u_shortbuf_array; -- libio.h:276 u_lock : System.Address; -- libio.h:280 u_offset : aliased CUPS.bits_types_h.uu_off64_t; -- libio.h:289 uu_pad1 : System.Address; -- libio.h:297 uu_pad2 : System.Address; -- libio.h:298 uu_pad3 : System.Address; -- libio.h:299 uu_pad4 : System.Address; -- libio.h:300 uu_pad5 : aliased size_t; -- libio.h:302 u_mode : aliased int; -- libio.h:303 u_unused2 : aliased u_IO_FILE_u_unused2_array; -- libio.h:305 end record; pragma Convention (C_Pass_By_Copy, u_IO_FILE); -- libio.h:241 -- The following pointers correspond to the C++ streambuf protocol. -- Note: Tk uses the _IO_read_ptr and _IO_read_end fields directly. -- Current read pointer -- End of get area. -- Start of putback+get area. -- Start of put area. -- Current put pointer. -- End of put area. -- Start of reserve area. -- End of reserve area. -- The following fields are used to support backing up and undo. -- Pointer to start of non-current get area. -- Pointer to first valid character of backup area -- Pointer to end of non-current get area. -- This used to be _offset but it's too small. -- 1+column number of pbase(); 0 is unknown. -- char* _save_gptr; char* _save_egptr; -- Wide character stream stuff. -- Make sure we don't get into trouble again. -- skipped empty struct u_IO_FILE_plus -- Functions to do I/O and file management for a stream. -- Read NBYTES bytes from COOKIE into a buffer pointed to by BUF. -- Return number of bytes read. -- skipped function type uu_io_read_fn -- Write N bytes pointed to by BUF to COOKIE. Write all N bytes -- unless there is an error. Return number of bytes written. If -- there is an error, return 0 and do not write anything. If the file -- has been opened for append (__mode.__append set), then set the file -- pointer to the end of the file and then do the write; if not, just -- write at the current file pointer. -- skipped function type uu_io_write_fn -- Move COOKIE's file position to *POS bytes from the -- beginning of the file (if W is SEEK_SET), -- the current position (if W is SEEK_CUR), -- or the end of the file (if W is SEEK_END). -- Set *POS to the new file position. -- Returns zero if successful, nonzero if not. -- skipped function type uu_io_seek_fn -- Close COOKIE. -- skipped function type uu_io_close_fn -- User-visible names for the above. -- skipped function type cookie_read_function_t -- skipped function type cookie_write_function_t -- skipped function type cookie_seek_function_t -- skipped function type cookie_close_function_t -- The structure with the cookie function pointers. -- Read bytes. type u_IO_cookie_io_functions_t is record read : access function (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr; arg3 : size_t) return CUPS.bits_types_h.uu_ssize_t; -- libio.h:366 write : access function (arg1 : System.Address; arg2 : Interfaces.C.Strings.chars_ptr; arg3 : size_t) return CUPS.bits_types_h.uu_ssize_t; -- libio.h:367 seek : access function (arg1 : System.Address; arg2 : access CUPS.bits_types_h.uu_off64_t; arg3 : int) return int; -- libio.h:368 close : access function (arg1 : System.Address) return int; -- libio.h:369 end record; pragma Convention (C_Pass_By_Copy, u_IO_cookie_io_functions_t); -- libio.h:370 -- skipped anonymous struct anon_5 -- Write bytes. -- Seek/tell file position. -- Close file. subtype cookie_io_functions_t is u_IO_cookie_io_functions_t; -- skipped empty struct u_IO_cookie_file -- Initialize one of those. -- skipped func _IO_cookie_init -- skipped func __underflow -- skipped func __uflow -- skipped func __overflow -- skipped func _IO_getc -- skipped func _IO_putc -- skipped func _IO_feof -- skipped func _IO_ferror -- skipped func _IO_peekc_locked -- This one is for Emacs. -- skipped func _IO_flockfile -- skipped func _IO_funlockfile -- skipped func _IO_ftrylockfile -- skipped func _IO_vfscanf -- skipped func _IO_vfprintf -- skipped func _IO_padn -- skipped func _IO_sgetn -- skipped func _IO_seekoff -- skipped func _IO_seekpos -- skipped func _IO_free_backup_area -- While compiling glibc we have to handle compatibility with very old -- versions. -- A special optimized version of the function above. It optimizes the -- case of initializing an unoriented byte stream. end CUPS.libio_h;
Transynther/x86/_processed/AVXALIGN/_st_/i7-8650U_0xd2_notsx.log_14_292.asm
ljhsiun2/medusa
9
177690
<reponame>ljhsiun2/medusa .global s_prepare_buffers s_prepare_buffers: push %r10 push %r15 push %r9 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_WT_ht+0xcc48, %rsi lea addresses_UC_ht+0xc3e8, %rdi clflush (%rsi) nop add $59971, %r10 mov $47, %rcx rep movsl nop nop sub $64227, %r15 lea addresses_A_ht+0xe188, %r9 nop nop nop sub $15074, %rax mov $0x6162636465666768, %rcx movq %rcx, %xmm2 vmovups %ymm2, (%r9) and $33998, %rcx lea addresses_A_ht+0x133e8, %rsi lea addresses_WC_ht+0xb710, %rdi nop nop nop nop xor $49526, %r10 mov $33, %rcx rep movsb nop nop nop nop xor $20175, %r9 lea addresses_D_ht+0x135e8, %rsi lea addresses_normal_ht+0x1dee8, %rdi nop nop nop add $49660, %rbx mov $1, %rcx rep movsl nop nop nop add $5079, %rax lea addresses_normal_ht+0x11568, %r15 nop nop cmp $51492, %r9 movl $0x61626364, (%r15) nop nop cmp %rbx, %rbx lea addresses_normal_ht+0x94e8, %rsi lea addresses_A_ht+0x1a908, %rdi nop cmp %r15, %r15 mov $35, %rcx rep movsw nop nop nop nop and %rsi, %rsi lea addresses_WC_ht+0x13988, %r15 dec %r10 vmovups (%r15), %ymm3 vextracti128 $0, %ymm3, %xmm3 vpextrq $1, %xmm3, %rsi sub %rbx, %rbx lea addresses_normal_ht+0x9685, %rsi lea addresses_WC_ht+0x67e8, %rdi xor %rbx, %rbx mov $96, %rcx rep movsl nop nop nop nop and %r10, %r10 lea addresses_UC_ht+0xed48, %rax nop nop inc %rcx movw $0x6162, (%rax) inc %r10 lea addresses_WC_ht+0xe736, %rax add %r10, %r10 movl $0x61626364, (%rax) nop nop nop nop nop dec %r9 lea addresses_A_ht+0x4b90, %r15 nop nop nop nop nop inc %rbx mov $0x6162636465666768, %rdi movq %rdi, %xmm6 vmovups %ymm6, (%r15) dec %rbx lea addresses_D_ht+0x1ebe8, %rbx xor %rcx, %rcx mov $0x6162636465666768, %r9 movq %r9, (%rbx) nop nop nop nop nop cmp $36869, %rsi lea addresses_A_ht+0x53e8, %rsi lea addresses_A_ht+0xb728, %rdi nop add $8930, %r9 mov $16, %rcx rep movsl add $38012, %r9 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r9 pop %r15 pop %r10 ret .global s_faulty_load s_faulty_load: push %r12 push %r8 push %r9 push %rax push %rbp push %rdi push %rsi // Load lea addresses_UC+0x193e8, %rax nop nop nop nop sub %r9, %r9 movb (%rax), %r12b nop nop nop nop inc %r8 // Store lea addresses_RW+0x13668, %rax clflush (%rax) nop nop nop nop add %rbp, %rbp movb $0x51, (%rax) nop xor %rsi, %rsi // Store lea addresses_A+0x1a3b8, %rbp clflush (%rbp) nop nop nop nop nop and $17398, %r9 movw $0x5152, (%rbp) nop nop nop nop nop xor %rbp, %rbp // Store lea addresses_US+0xb9e8, %rax nop nop nop nop nop add %r12, %r12 movb $0x51, (%rax) xor %rdi, %rdi // Faulty Load lea addresses_WT+0x183e8, %rbp nop nop nop nop xor %r12, %r12 mov (%rbp), %esi lea oracles, %r9 and $0xff, %rsi shlq $12, %rsi mov (%r9,%rsi,1), %rsi pop %rsi pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_US', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'size': 4, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}} {'39': 14} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
programs/oeis/060/A060571.asm
karttu/loda
1
101097
; A060571: Tower of Hanoi: the optimal way to move an even number of disks from peg 0 to peg 2 or an odd number from peg 0 to peg 1 is on move n to move disk A001511 from peg A060571 (here) to peg A060572. ; 0,0,1,0,2,2,0,0,1,1,2,1,0,0,1,0,2,2,0,2,1,1,2,2,0,0,1,0,2,2,0,0,1,1,2,1,0,0,1,1,2,2,0,2,1,1,2,1,0,0,1,0,2,2,0,0,1,1,2,1,0,0,1,0,2,2,0,2,1,1,2,2,0,0,1,0,2,2,0,2,1,1,2,1,0,0,1,1,2,2,0,2,1,1,2,2,0,0,1,0,2,2,0,0,1 add $0,1 mov $2,$0 gcd $0,262144 mul $2,5 add $0,$2 mod $0,3 mov $1,$0
src/csharp/CSharp4PreProcessor.g4
slash-under/codenn
216
1936
<reponame>slash-under/codenn /* Author: <NAME> E-Mail: <EMAIL> Preprocessor semantics: - Chapter 9.5.1: "An implication of this is that #define and #undef directives in one source file have no effect on other source files in the same program." */ lexer grammar CSharp4PreProcessor; import CSharp4Lexer; //B.1.10 Pre_processing Directives Pp_directive : (Pp_declaration | Pp_conditional | Pp_line | Pp_diagnostic | Pp_region | Pp_pragma ) ; fragment Pp_expression : WHITESPACE? Pp_or_expression WHITESPACE? ; fragment Pp_or_expression : Pp_and_expression WHITESPACE? ('||' WHITESPACE? Pp_and_expression )* ; fragment Pp_and_expression : Pp_equality_expression WHITESPACE? ('&&' WHITESPACE? Pp_equality_expression WHITESPACE? )* ; fragment Pp_equality_expression : Pp_unary_expression WHITESPACE? ( '==' WHITESPACE? Pp_unary_expression WHITESPACE? | '!=' WHITESPACE? Pp_unary_expression WHITESPACE? )* ; fragment Pp_unary_expression : Pp_primary_expression | '!' WHITESPACE? Pp_unary_expression ; fragment Pp_primary_expression : TRUE | FALSE | Conditional_symbol | '(' Pp_expression ')' ; fragment Pp_declaration : WHITESPACE? SHARP WHITESPACE? 'define' WHITESPACE Conditional_symbol Pp_new_line | WHITESPACE? SHARP WHITESPACE? 'undef' WHITESPACE Conditional_symbol Pp_new_line ; fragment Pp_new_line : WHITESPACE? SINGLE_LINE_COMMENT? NEW_LINE ; // changed by chw fragment Pp_conditional : Pp_if_section | Pp_elif_section | Pp_else_section | Pp_endif ; fragment Pp_if_section : WHITESPACE? SHARP WHITESPACE? 'if' WHITESPACE Pp_expression Pp_new_line ; fragment Pp_elif_section : WHITESPACE? SHARP WHITESPACE? 'elif' WHITESPACE Pp_expression Pp_new_line // if the if/elif-sections before has not been processed and expr is true ; fragment Pp_else_section : WHITESPACE? SHARP WHITESPACE? 'else' Pp_new_line // if the if/elif-sections before has not been processed ; fragment Pp_endif : WHITESPACE? SHARP WHITESPACE? 'endif' Pp_new_line ; //'<Any Identifier_or_keyword Except True Or False>' // WARNING: ignores exclusion fragment Conditional_symbol : Identifier_or_keyword ; fragment Pp_diagnostic : WHITESPACE? SHARP WHITESPACE? 'error' Pp_message | WHITESPACE? SHARP WHITESPACE? 'warning' Pp_message ; fragment Pp_message : NEW_LINE | WHITESPACE Input_character* NEW_LINE ; // changed by chw fragment Pp_region : Pp_start_region | Pp_end_region ; fragment Pp_start_region : WHITESPACE? SHARP WHITESPACE? 'region' Pp_message ; fragment Pp_end_region : WHITESPACE? SHARP WHITESPACE? 'endregion' Pp_message? ; fragment Pp_line : WHITESPACE? SHARP WHITESPACE? 'line' WHITESPACE Line_indicator Pp_new_line ; fragment Line_indicator : Decimal_digits (WHITESPACE File_name)? | 'default' | 'hidden' ; fragment File_name : DOUBLE_QUOTE File_name_characters DOUBLE_QUOTE ; fragment File_name_characters : File_name_character+ ; //'<Any input_character Except ">' fragment File_name_character : ~(["\u000D\u000A\u000D\u0085\u2028\u2029]) ; // We use a more flexible pragma expression that also supports C# versions below 4.0 fragment Pp_pragma : WHITESPACE? SHARP WHITESPACE? 'pragma' Pp_pragma_text ; fragment Pp_pragma_text : NEW_LINE? | WHITESPACE Input_characters? NEW_LINE? ; // ----------------------------------------------------------------------------------------------------- // the following preprocessor rules are only invoked by the extended Lexer class // Hint: tokens need not to be skipped because they are matched within fragment rules // who in turn do not produce tokens by themselves fragment SkiPped_section_part : WHITESPACE? SkiPped_characters? NEW_LINE | Pp_directive ; fragment SkiPped_characters : Not_number_sign Input_character* ; //'<Any Input_character Except #>' // added Whitespace_character to solve warning in SkiPped_characters fragment Not_number_sign : ~([#\u000D\u000A\u0085\u2028\u2029\u0009\u000B\u000C\u0020\u00A0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2008\u2009\u200A\u202F\u3000\u205F]) ;
src/boot/crash.asm
robey/funos
5
102034
<filename>src/boot/crash.asm ; ; display a pretty hex dump of registers & stack for debugging. ; %define module crash %include "api.macro" section .text ; name, y, x, offset %macro dumpreg 4 mov edx, (%2 << 8) + %3 call vga_compute mov ecx, %1 mov eax, [reg_stack_top - %4] call dump_register %endmacro ; never returns. global crash crash: mov [saved_esp], esp mov esp, reg_stack_top ; EAX, ECX, EDX, EBX, ESP (original value), EBP, ESI, and EDI: pushad pushfd mov eax, [saved_esp] mov [reg_stack_top - 20], eax ; blank 12 lines for crash dump mov eax, 12 .clear_loop: call vga_blank_line inc eax cmp eax, 23 jle .clear_loop ; is there turkey? mov edx, 0x0c01 call vga_compute mov ecx, 'no t' call vga_put_small mov ecx, 'urke' call vga_put_small mov ecx, 'y :(' call vga_put_small ; display 8 main regs + eflags dumpreg ' A:', 14, 2, 4 dumpreg ' B:', 15, 2, 16 dumpreg ' C:', 16, 2, 8 dumpreg ' D:', 17, 2, 12 dumpreg 'DI:', 18, 2, 32 dumpreg 'SI:', 19, 2, 28 dumpreg 'BP:', 20, 2, 24 dumpreg 'SP:', 21, 2, 20 dumpreg ' F:', 22, 2, 36 mov esi, [reg_stack_top - 20] ; round down to nearest paragraph and esi, 0xfffffff0 ; draw 9 lines mov ecx, 0 .loop: mov edx, ecx shl edx, 8 add edx, 0x0e14 call vga_compute call dump_memory_row inc ecx cmp ecx, 9 jl .loop ; display crash reason, if one was set. mov edx, (12 << 8) + 75 call vga_compute mov ecx, [crash_reason] call vga_put_small ; die. cli hlt ; display a register (eax) named (ecx) at (edi) dump_register: call vga_put_small add edi, 2 call vga_dump_eax ret ; display a row of memory contents (esi) at (edi) dump_memory_row: push eax push ebx push ecx mov eax, esi call vga_dump_eax mov ecx, ': ' call vga_put_small mov ebx, 4 .loop: cmp esi, [reg_stack_top - 20] jne .no_highlight mov ecx, 8 call vga_highlight .no_highlight: mov eax, [esi] call vga_dump_eax mov ecx, ' ' call vga_put_small add esi, 4 dec ebx cmp ebx, 0 jne .loop .out: pop ecx pop ebx pop eax ret section .bss align 4 reg_stack: resb 16 * 4 reg_stack_top: section .data saved_esp: dd 0 global crash_reason crash_reason: dd 0
src/x86/cdef16_avx2.asm
RReverser/rav1e
0
14667
; Copyright (c) 2017-2021, The rav1e contributors ; Copyright (c) 2021, <NAME> ; All rights reserved. ; ; Redistribution and use in source and binary forms, with or without ; modification, are permitted provided that the following conditions are met: ; ; 1. Redistributions of source code must retain the above copyright notice, this ; list of conditions and the following disclaimer. ; ; 2. Redistributions in binary form must reproduce the above copyright notice, ; this list of conditions and the following disclaimer in the documentation ; and/or other materials provided with the distribution. ; ; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ; DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ; ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. %include "config.asm" %include "ext/x86/x86inc.asm" %if ARCH_X86_64 SECTION .text cextern cdef_dir_8bpc_avx2 INIT_YMM avx2 cglobal cdef_dir_16bpc, 4, 4, 3, 32 + 8*8, src, ss, var, bdmax popcnt bdmaxd, bdmaxd movzx bdmaxq, bdmaxw sub bdmaxq, 8 movq xm2, bdmaxq DEFINE_ARGS src, ss, var, ss3 lea ss3q, [ssq*3] mova xm0, [srcq + ssq*0] mova xm1, [srcq + ssq*1] vinserti128 m0, [srcq + ssq*2], 1 vinserti128 m1, [srcq + ss3q], 1 psraw m0, xm2 psraw m1, xm2 vpackuswb m0, m1 mova [rsp + 32 + 0*8], m0 lea srcq, [srcq + ssq*4] mova xm0, [srcq + ssq*0] mova xm1, [srcq + ssq*1] vinserti128 m0, [srcq + ssq*2], 1 vinserti128 m1, [srcq + ss3q], 1 psraw m0, xm2 psraw m1, xm2 vpackuswb m0, m1 mova [rsp + 32 + 4*8], m0 lea srcq, [rsp + 32] ; WIN64 shadow space mov ssq, 8 call mangle(private_prefix %+ _cdef_dir_8bpc %+ SUFFIX) RET %endif ; ARCH_X86_64
other.7z/SFC.7z/SFC/ソースデータ/MarioKart/ed_dos2.asm
prismotizm/gigaleak
0
246497
<reponame>prismotizm/gigaleak Name: ed_dos2.asm Type: file Size: 5742 Last-Modified: '1992-06-02T15:00:00Z' SHA-1: 17A6FC9BBDEAB02E460875C8E4774580A38D09CE Description: null
libsrc/_DEVELOPMENT/math/integer/l_mulu_32_16x16.asm
Toysoft/z88dk
0
176438
INCLUDE "config_private.inc" SECTION code_clib SECTION code_math PUBLIC l_mulu_32_16x16 ; compute: dehl = hl * de ; alters : af, bc, de, hl IF __CPU_Z180__ && ((__CLIB_OPT_IMATH = 0) || (__CLIB_OPT_IMATH = 100)) EXTERN l_z180_mulu_32_16x16 defc l_mulu_32_16x16 = l_z180_mulu_32_16x16 ELSE IF __CPU_Z80_ZXN__ && ((__CLIB_OPT_IMATH = 0) || (__CLIB_OPT_IMATH = 100)) EXTERN l_z80_zxn_mulu_32_16x16 defc l_mulu_32_16x16 = l_z80_zxn_mulu_32_16x16 ELSE IF __CLIB_OPT_IMATH <= 50 EXTERN l0_small_mul_32_32x32 l_mulu_32_16x16: ld c,l ld b,h xor a ld l,a ld h,a exx push bc push de push hl ld l,a ld h,a ld c,a ld b,a ld e,a ld d,a call l0_small_mul_32_32x32 exx pop hl pop de pop bc exx ret ENDIF IF __CLIB_OPT_IMATH > 50 EXTERN l_fast_mulu_32_16x16 defc l_mulu_32_16x16 = l_fast_mulu_32_16x16 ENDIF ENDIF ENDIF
awa/plugins/awa-storages/src/awa-storages-stores-databases.ads
fuzzysloth/ada-awa
0
30334
<reponame>fuzzysloth/ada-awa ----------------------------------------------------------------------- -- awa-storages-stores-databases -- Database store -- Copyright (C) 2012 <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 ADO.Sessions; with AWA.Storages.Models; -- === Database store === -- The `AWA.Storages.Stores.Databases` store uses the database to save a data content. -- The data is saved in a specific table in a database blob column. -- The database store uses another store service to temporarily save the data content -- in a local file when the application needs a file access to the data. package AWA.Storages.Stores.Databases is -- ------------------------------ -- Storage Service -- ------------------------------ type Database_Store is new AWA.Storages.Stores.Store with record Tmp : AWA.Storages.Stores.Store_Access; end record; -- Save the file represented by the `Path` variable into a store and associate that -- content with the storage reference represented by `Into`. procedure Save (Storage : in Database_Store; Session : in out ADO.Sessions.Master_Session; Into : in out AWA.Storages.Models.Storage_Ref'Class; Path : in String); procedure Load (Storage : in Database_Store; Session : in out ADO.Sessions.Session'Class; From : in AWA.Storages.Models.Storage_Ref'Class; Into : in out AWA.Storages.Storage_File); -- Create a storage procedure Create (Storage : in Database_Store; Session : in out ADO.Sessions.Master_Session; From : in AWA.Storages.Models.Storage_Ref'Class; Into : in out AWA.Storages.Storage_File); -- Delete the content associate with the storage represented by `From`. procedure Delete (Storage : in Database_Store; Session : in out ADO.Sessions.Master_Session; From : in out AWA.Storages.Models.Storage_Ref'Class); end AWA.Storages.Stores.Databases;
programs/oeis/065/A065091.asm
neoneye/loda
22
243743
; A065091: Odd primes. ; 3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547 seq $0,98090 ; Numbers k such that 2k-3 is prime. mul $0,2 sub $0,3
regtests/wiki-filters-html-tests.adb
jquorning/ada-wiki
18
22892
----------------------------------------------------------------------- -- wiki-filters-html-tests -- Unit tests for wiki HTML filters -- Copyright (C) 2015 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Util.Test_Caller; with Util.Assertions; with Util.Strings; with Util.Log.Loggers; package body Wiki.Filters.Html.Tests is Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("Wiki.Filters"); package Caller is new Util.Test_Caller (Test, "Wikis.Filters.Html"); procedure Assert_Equals is new Util.Assertions.Assert_Equals_T (Html_Tag); procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is begin Caller.Add_Test (Suite, "Test Wiki.Filters.Html.Find_Tag", Test_Find_Tag'Access); end Add_Tests; -- ------------------------------ -- Test Find_Tag operation. -- ------------------------------ procedure Test_Find_Tag (T : in out Test) is begin for I in Html_Tag'Range loop declare Name : constant String := Html_Tag'Image (I); Wname : constant Wide_Wide_String := Html_Tag'Wide_Wide_Image (I); Pos : constant Natural := Util.Strings.Index (Name, '_'); Tname : constant Wide_Wide_String := Wname (Wname'First .. Pos - 1); Tag : constant Html_Tag := Find_Tag (Tname); begin Log.Info ("Checking tag {0}", Name); if I /= ROOT_HTML_TAG then Assert_Equals (T, I, Tag, "Find_Tag failed"); end if; Assert_Equals (T, UNKNOWN_TAG, Find_Tag (Tname & "x"), "Find_Tag must return UNKNOWN_TAG"); for K in Tname'Range loop if K = Tname'First then Assert_Equals (T, UNKNOWN_TAG, Find_Tag ("_" & Tname (Tname'First + 1 .. Tname'Last)), "Find_Tag must return UNKNOWN_TAG"); elsif K = Tname'Last then Assert_Equals (T, UNKNOWN_TAG, Find_Tag (Tname (Tname'First .. K - 1) & "_"), "Find_Tag must return UNKNOWN_TAG"); else Assert_Equals (T, UNKNOWN_TAG, Find_Tag (Tname (Tname'First .. K - 1) & "_" & Tname (K + 1 .. Tname'Last)), "Find_Tag must return UNKNOWN_TAG"); end if; end loop; end; end loop; end Test_Find_Tag; end Wiki.Filters.Html.Tests;
alloy4fun_models/trainstlt/models/5/3fBioBvfkvRPXyema.als
Kaixi26/org.alloytools.alloy
0
3336
<reponame>Kaixi26/org.alloytools.alloy open main pred id3fBioBvfkvRPXyema_prop6 { always all s : Track.signal | s in Green => s not in Green' or s not in Green' => s in Green } pred __repair { id3fBioBvfkvRPXyema_prop6 } check __repair { id3fBioBvfkvRPXyema_prop6 <=> prop6o }
programs/oeis/063/A063657.asm
jmorken/loda
1
86743
; A063657: Numbers with property that truncated square root is unequal to rounded square root. ; 3,7,8,13,14,15,21,22,23,24,31,32,33,34,35,43,44,45,46,47,48,57,58,59,60,61,62,63,73,74,75,76,77,78,79,80,91,92,93,94,95,96,97,98,99,111,112,113,114,115,116,117,118,119,120,133,134,135,136,137,138,139,140,141,142,143,157,158,159,160,161,162,163,164,165,166,167,168,183,184,185,186,187,188,189,190,191,192,193,194,195,211,212,213,214,215,216,217,218,219,220,221,222,223,224,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288,307,308,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,524,525 mov $1,3 mov $2,$0 lpb $2 add $1,2 add $3,1 add $0,$3 sub $2,1 trn $2,$3 lpe add $1,$0
untested/x86/mulStuff.asm
GabrielRavier/Generic-Assembly-Samples
0
20212
<filename>untested/x86/mulStuff.asm %include "macros.inc" global _isMulOk global _saturatedMul segment .text align=16 _isMulOk: push ebp mov ebp, [esp + 4 + 8] test ebp, ebp je .return1 mov ecx, [esp + 4 + 4] test ecx, ecx jne .continue .return1: mov eax, 1 pop ebp ret align 16 .continue: xor edx, edx mov eax, -1 div ebp cmp ecx, eax mov eax, 0 setbe al pop ebp ret align 16 _saturatedMul: mov ecx, [esp + 8] test ecx, ecx je .mulSafe cmp dword [esp + 4], 0 je .mulSafe xor edx, edx mov eax, -1 div ecx cmp eax, [esp + 4] jb .returnMax .mulSafe: mov eax, [esp + 4] imul eax, ecx ret align 16 .returnMax: mov eax, -1 ret
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_13566_1673.asm
ljhsiun2/medusa
9
179975
<filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_13566_1673.asm .global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r13 push %rax push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x13e33, %rbp nop nop and %rax, %rax mov (%rbp), %ecx nop nop nop nop nop add $46499, %r11 lea addresses_normal_ht+0x7233, %r13 nop nop nop nop nop dec %rdx mov (%r13), %r10 nop nop nop add $17466, %rbp lea addresses_A_ht+0xa33, %rax nop nop inc %r11 movw $0x6162, (%rax) nop nop nop nop sub %r10, %r10 lea addresses_UC_ht+0xa080, %rcx nop nop nop nop nop add %rdx, %rdx movb (%rcx), %r10b nop nop nop cmp $4964, %rax lea addresses_normal_ht+0x1c0f3, %rcx clflush (%rcx) nop xor $40982, %rbp vmovups (%rcx), %ymm0 vextracti128 $1, %ymm0, %xmm0 vpextrq $1, %xmm0, %rdx dec %rax lea addresses_normal_ht+0x13ae4, %rsi lea addresses_D_ht+0x6633, %rdi nop nop nop nop inc %rax mov $72, %rcx rep movsb cmp $9057, %rsi lea addresses_normal_ht+0x18f33, %rsi lea addresses_normal_ht+0x6953, %rdi clflush (%rsi) nop nop nop nop nop inc %r13 mov $38, %rcx rep movsl nop nop nop nop and %r10, %r10 lea addresses_UC_ht+0x11f33, %rsi lea addresses_A_ht+0xa9f3, %rdi nop nop xor %r10, %r10 mov $52, %rcx rep movsq nop nop nop nop nop inc %r13 lea addresses_D_ht+0x34e3, %r11 nop nop nop nop nop and $7450, %r10 mov (%r11), %esi nop nop nop nop and $4526, %rcx lea addresses_normal_ht+0x686d, %rdx clflush (%rdx) nop nop nop cmp %r10, %r10 mov $0x6162636465666768, %rsi movq %rsi, %xmm4 vmovups %ymm4, (%rdx) nop nop nop nop cmp $41421, %r10 pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %rax pop %r13 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r14 push %r15 push %r8 push %rbx // Faulty Load lea addresses_UC+0x3a33, %r15 sub $32107, %rbx vmovaps (%r15), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r10 lea oracles, %r14 and $0xff, %r10 shlq $12, %r10 mov (%r14,%r10,1), %r10 pop %rbx pop %r8 pop %r15 pop %r14 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': False, 'type': 'addresses_UC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': True, 'AVXalign': True, 'size': 32, 'congruent': 0, 'same': True, 'type': 'addresses_UC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'NT': False, 'AVXalign': True, 'size': 4, 'congruent': 10, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 10, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'src': {'congruent': 8, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_UC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_A_ht'}, 'OP': 'REPM'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 3, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'LOAD'} {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'00': 13566} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
src/ships-crew.adb
thindil/steamsky
80
21295
<gh_stars>10-100 -- Copyright 2017-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ada.Exceptions; use Ada.Exceptions; with Messages; use Messages; with HallOfFame; use HallOfFame; with ShipModules; use ShipModules; with Ships.Cargo; use Ships.Cargo; with Maps; use Maps; with Events; use Events; with Crew.Inventory; use Crew.Inventory; with Utils; use Utils; with Missions; use Missions; with Factions; use Factions; package body Ships.Crew is function GetSkillLevel (Member: Member_Data; SkillIndex: Skills_Amount_Range) return Skill_Range is SkillLevel: Integer := 0; Damage: Damage_Factor := 0.0; BaseSkillLevel: Natural range 0 .. 151; begin Get_Skill_Loop : for Skill of Member.Skills loop if Skill.Index = SkillIndex then BaseSkillLevel := Skill.Level + Member.Attributes (Positive (SkillsData_Container.Element(Skills_List, Skill.Index) .Attribute)) .Level; Damage := 1.0 - Damage_Factor(Float(Member.Health) / 100.0); SkillLevel := SkillLevel + (BaseSkillLevel - Integer(Float(BaseSkillLevel) * Float(Damage))); if Member.Thirst > 40 then Damage := 1.0 - Damage_Factor(Float(Member.Thirst) / 100.0); SkillLevel := SkillLevel - (Integer(Float(BaseSkillLevel) * Float(Damage))); end if; if Member.Hunger > 80 then Damage := 1.0 - Damage_Factor(Float(Member.Hunger) / 100.0); SkillLevel := SkillLevel - (Integer(Float(BaseSkillLevel) * Float(Damage))); end if; if Member.Morale(1) < 25 then Damage := Damage_Factor(Float(Member.Morale(1)) / 100.0); SkillLevel := SkillLevel - (Integer(Float(BaseSkillLevel) * Float(Damage))); end if; if SkillLevel < 1 then SkillLevel := 1; end if; if SkillLevel > 100 then SkillLevel := 100; end if; if Member.Morale(1) > 90 then Damage := Damage_Factor(Float(SkillLevel) / 100.0); SkillLevel := SkillLevel + (Integer(Float(BaseSkillLevel) * Float(Damage))); if SkillLevel > 100 then SkillLevel := 100; end if; end if; return SkillLevel; end if; end loop Get_Skill_Loop; return SkillLevel; end GetSkillLevel; procedure Death (MemberIndex: Crew_Container.Extended_Index; Reason: Unbounded_String; Ship: in out Ship_Record; CreateBody: Boolean := True) is begin if Ship = Player_Ship then if MemberIndex > 1 then AddMessage (To_String(Ship.Crew(MemberIndex).Name) & " died from " & To_String(Reason) & ".", CombatMessage, RED); else AddMessage ("You died from " & To_String(Reason) & ".", CombatMessage, RED); Player_Ship.Crew(MemberIndex).Order := Rest; Player_Ship.Crew(MemberIndex).Health := 0; Update_Hall_Of_Fame(Player_Ship.Crew(MemberIndex).Name, Reason); return; end if; end if; if CreateBody then Ship.Cargo.Append (New_Item => (ProtoIndex => Corpse_Index, Amount => 1, Name => Ship.Crew(MemberIndex).Name & To_Unbounded_String("'s corpse"), Durability => 100, Price => 0)); end if; DeleteMember(MemberIndex, Ship); for I in Ship.Crew.Iterate loop UpdateMorale(Ship, Crew_Container.To_Index(I), Get_Random(-25, -10)); end loop; end Death; procedure DeleteMember (MemberIndex: Crew_Container.Extended_Index; Ship: in out Ship_Record) is TempValue: Integer; begin Ship.Crew.Delete(Index => MemberIndex); Module_Loop : for Module of Ship.Modules loop Owners_Loop : for Owner of Module.Owner loop if Owner = MemberIndex then Owner := 0; elsif Owner > MemberIndex then Owner := Owner - 1; end if; end loop Owners_Loop; end loop Module_Loop; if Ship = Player_Ship then Delete_Missions_Loop : for I in AcceptedMissions.First_Index .. AcceptedMissions.Last_Index loop if AcceptedMissions(I).MType = Passenger and then AcceptedMissions(I).Data = MemberIndex then DeleteMission(I); exit Delete_Missions_Loop; end if; end loop Delete_Missions_Loop; Update_Missions_Loop : for Mission of AcceptedMissions loop if Mission.MType = Passenger and then Mission.Data > MemberIndex then TempValue := Mission.Data; TempValue := TempValue - 1; Mission.Data := TempValue; end if; end loop Update_Missions_Loop; end if; end DeleteMember; function FindMember (Order: Crew_Orders; Crew: Crew_Container.Vector := Player_Ship.Crew) return Natural is begin Find_Member_Loop : for I in Crew.Iterate loop if Crew(I).Order = Order then return Crew_Container.To_Index(I); end if; end loop Find_Member_Loop; return 0; end FindMember; procedure GiveOrders (Ship: in out Ship_Record; MemberIndex: Crew_Container.Extended_Index; GivenOrder: Crew_Orders; ModuleIndex: Modules_Container.Extended_Index := 0; CheckPriorities: Boolean := True) is use Tiny_String; MemberName: constant String := To_String(Ship.Crew(MemberIndex).Name); ToolsIndex: Inventory_Container.Extended_Index := 0; RequiredTool: Unbounded_String; ToolQuality: Items_Durability := Default_Item_Durability; ModuleIndex2: Modules_Container.Extended_Index := 0; begin if GivenOrder = Ship.Crew(MemberIndex).Order then if GivenOrder in Craft | Gunner then Give_Orders_Modules_Loop : for I in Ship.Modules.Iterate loop if Modules_Container.To_Index(I) = ModuleIndex then Owners_Loop : for Owner of Ship.Modules(I).Owner loop if Owner = MemberIndex then return; end if; end loop Owners_Loop; end if; end loop Give_Orders_Modules_Loop; else return; end if; end if; if GivenOrder /= Rest and ((Ship.Crew(MemberIndex).Morale(1) < 11 and Get_Random(1, 100) < 50) or Ship.Crew(MemberIndex).Loyalty < 20) then if Ship = Player_Ship then raise Crew_Order_Error with MemberName & " refuses to execute order."; else return; end if; end if; if GivenOrder = Train and then Ship.Modules(ModuleIndex).Trained_Skill = 0 then raise Crew_Order_Error with MemberName & " can't start training because " & To_String(Ship.Modules(ModuleIndex).Name) & " isn't prepared."; end if; if GivenOrder in Pilot | Engineer | Upgrading | Talk then Give_Crew_Orders_Loop : for I in Ship.Crew.First_Index .. Ship.Crew.Last_Index loop if Ship.Crew(I).Order = GivenOrder then GiveOrders(Player_Ship, I, Rest, 0, False); exit Give_Crew_Orders_Loop; end if; end loop Give_Crew_Orders_Loop; elsif (GivenOrder in Gunner | Craft | Train) or (GivenOrder = Heal and ModuleIndex > 0) then declare FreePosition: Boolean := False; begin Free_Position_Loop : for Owner of Ship.Modules(ModuleIndex).Owner loop if Owner = 0 then FreePosition := True; exit Free_Position_Loop; end if; end loop Free_Position_Loop; if not FreePosition then GiveOrders (Player_Ship, Ship.Modules(ModuleIndex).Owner(1), Rest, 0, False); end if; end; end if; if ModuleIndex = 0 and (GivenOrder in Pilot | Engineer | Rest) then declare MType: constant ModuleType := (case GivenOrder is when Pilot => COCKPIT, when Engineer => ENGINE, when Rest => CABIN, when others => ENGINE); begin Modules_Loop : for I in Ship.Modules.Iterate loop if MType /= CABIN then if Modules_List(Ship.Modules(I).Proto_Index).MType = MType and Ship.Modules(I).Durability > 0 then if Ship.Modules(I).Owner(1) /= 0 then GiveOrders (Player_Ship, Ship.Modules(I).Owner(1), Rest, 0, False); end if; ModuleIndex2 := Modules_Container.To_Index(I); exit Modules_Loop; end if; else if Ship.Modules(I).M_Type = CABIN and Ship.Modules(I).Durability > 0 then Cabin_Owners_Loop : for Owner of Ship.Modules(I).Owner loop if MemberIndex = Owner then ModuleIndex2 := Modules_Container.To_Index(I); exit Modules_Loop; end if; end loop Cabin_Owners_Loop; end if; end if; end loop Modules_Loop; end; else ModuleIndex2 := ModuleIndex; end if; if ModuleIndex2 = 0 and Ship = Player_Ship then case GivenOrder is when Pilot => raise Crew_Order_Error with MemberName & " can't start piloting because the cockpit is destroyed or you don't have cockpit."; when Engineer => raise Crew_Order_Error with MemberName & " can't start engineer's duty because all of the engines are destroyed or you don't have engine."; when Gunner => raise Crew_Order_Error with MemberName & " can't start operating gun because all of the guns are destroyed or you don't have any installed."; when Rest => Modules_Loop2 : for Module of Ship.Modules loop if Module.M_Type = CABIN and Module.Durability > 0 then Owners_Loop2 : for Owner of Module.Owner loop if Owner = 0 then Owner := MemberIndex; AddMessage (MemberName & " takes " & To_String(Module.Name) & " as their own cabin.", OtherMessage); exit Modules_Loop2; end if; end loop Owners_Loop2; end if; end loop Modules_Loop2; when others => null; end case; end if; Modules_Loop3 : for Module of Ship.Modules loop if Module.M_Type /= CABIN then Owners_Loop3 : for Owner of Module.Owner loop if Owner = MemberIndex then Owner := 0; exit Modules_Loop3; end if; end loop Owners_Loop3; end if; end loop Modules_Loop3; if ToolsIndex > 0 and Ship.Crew(MemberIndex).Equipment(7) /= ToolsIndex then UpdateInventory (MemberIndex, 1, Ship.Cargo(ToolsIndex).ProtoIndex, Ship.Cargo(ToolsIndex).Durability); UpdateCargo(Ship => Ship, Amount => -1, CargoIndex => ToolsIndex); Ship.Crew(MemberIndex).Equipment(7) := FindItem (Inventory => Ship.Crew(MemberIndex).Inventory, ItemType => RequiredTool); end if; ToolsIndex := Ship.Crew(MemberIndex).Equipment(7); if ToolsIndex > 0 and then Items_List(Ship.Crew(MemberIndex).Inventory(ToolsIndex).ProtoIndex) .IType /= RequiredTool then UpdateCargo (Ship, Ship.Crew(MemberIndex).Inventory(ToolsIndex).ProtoIndex, 1, Ship.Crew(MemberIndex).Inventory(ToolsIndex).Durability); UpdateInventory (MemberIndex => MemberIndex, Amount => -1, InventoryIndex => ToolsIndex); ToolsIndex := 0; end if; if GivenOrder in Upgrading | Repair | Clean | Train then -- Check for tools if GivenOrder = Clean then RequiredTool := Cleaning_Tools; elsif GivenOrder = Train then RequiredTool := To_Unbounded_String (To_String (SkillsData_Container.Element (Skills_List, Ship.Modules(ModuleIndex).Trained_Skill) .Tool)); ToolQuality := GetTrainingToolQuality (MemberIndex, Ship.Modules(ModuleIndex).Trained_Skill); else RequiredTool := Repair_Tools; end if; if RequiredTool /= Null_Unbounded_String then if ToolsIndex = 0 then ToolsIndex := FindItem (Inventory => Ship.Cargo, ItemType => RequiredTool, Quality => ToolQuality); if ToolsIndex = 0 then ToolsIndex := FindItem (Inventory => Ship.Crew(MemberIndex).Inventory, ItemType => RequiredTool, Quality => ToolQuality); if ToolsIndex > 0 then Ship.Crew(MemberIndex).Equipment(7) := ToolsIndex; end if; else Ship.Crew(MemberIndex).Equipment(7) := 0; end if; end if; if ToolsIndex = 0 then case GivenOrder is when Repair => raise Crew_Order_Error with MemberName & " can't start repairing ship because you don't have the proper tools."; when Clean => raise Crew_Order_Error with MemberName & " can't start cleaning ship because you don't have any cleaning tools."; when Upgrading => raise Crew_Order_Error with MemberName & " can't start upgrading module because you don't have the proper tools."; when Train => raise Crew_Order_Error with MemberName & " can't start training because you don't have the proper tools."; when others => return; end case; end if; end if; end if; if GivenOrder = Rest then Ship.Crew(MemberIndex).PreviousOrder := Rest; if Ship.Crew(MemberIndex).Order in Repair | Clean | Upgrading | Train then ToolsIndex := Ship.Crew(MemberIndex).Equipment(7); if ToolsIndex > 0 then UpdateCargo (Ship, Ship.Crew(MemberIndex).Inventory(ToolsIndex).ProtoIndex, 1, Ship.Crew(MemberIndex).Inventory(ToolsIndex).Durability); UpdateInventory (MemberIndex => MemberIndex, Amount => -1, InventoryIndex => ToolsIndex); end if; end if; end if; if Ship = Player_Ship then case GivenOrder is when Pilot => AddMessage(MemberName & " starts piloting.", OrderMessage); Ship.Modules(ModuleIndex2).Owner(1) := MemberIndex; when Engineer => AddMessage (MemberName & " starts engineer's duty.", OrderMessage); when Gunner => AddMessage(MemberName & " starts operating gun.", OrderMessage); Ship.Modules(ModuleIndex2).Owner(1) := MemberIndex; when Rest => AddMessage(MemberName & " is going on a break.", OrderMessage); when Repair => AddMessage (MemberName & " starts repairing ship.", OrderMessage); when Craft => AddMessage(MemberName & " starts manufacturing.", OrderMessage); for Owner of Ship.Modules(ModuleIndex2).Owner loop if Owner = 0 then Owner := MemberIndex; exit; end if; end loop; when Upgrading => AddMessage (MemberName & " starts upgrading " & To_String(Ship.Modules(Ship.Upgrade_Module).Name) & ".", OrderMessage); when Talk => AddMessage (MemberName & " is now assigned to talking in bases.", OrderMessage); when Heal => AddMessage (MemberName & " starts healing wounded crew members.", OrderMessage); if ModuleIndex > 0 then for Owner of Ship.Modules(ModuleIndex).Owner loop if Owner = 0 then Owner := MemberIndex; exit; end if; end loop; end if; when Clean => AddMessage(MemberName & " starts cleaning ship.", OrderMessage); when Boarding => AddMessage (MemberName & " starts boarding the enemy ship.", OrderMessage); when Defend => AddMessage (MemberName & " starts defending the ship.", OrderMessage); when Train => AddMessage (MemberName & " starts personal training.", OrderMessage); for Owner of Ship.Modules(ModuleIndex2).Owner loop if Owner = 0 then Owner := MemberIndex; exit; end if; end loop; end case; end if; Ship.Crew(MemberIndex).Order := GivenOrder; Ship.Crew(MemberIndex).OrderTime := 15; if GivenOrder /= Rest then UpdateMorale(Ship, MemberIndex, -1); end if; if CheckPriorities then UpdateOrders(Ship); end if; exception when An_Exception : Crew_No_Space_Error => if Ship = Player_Ship then raise Crew_Order_Error with Exception_Message(An_Exception); else return; end if; end GiveOrders; procedure UpdateOrders (Ship: in out Ship_Record; Combat: Boolean := False) is HavePilot, HaveEngineer, HaveUpgrade, HaveTrader, NeedClean, NeedRepairs, NeedGunners, NeedCrafters, CanHeal, NeedTrader: Boolean := False; EventIndex: constant Events_Container.Extended_Index := SkyMap(Ship.Sky_X, Ship.Sky_Y).EventIndex; function UpdatePosition (Order: Crew_Orders; MaxPriority: Boolean := True) return Boolean is OrderIndex: Natural := 0; MemberIndex: Crew_Container.Extended_Index := 0; ModuleIndex: Modules_Container.Extended_Index := 0; begin OrderIndex := (if Crew_Orders'Pos(Order) < Crew_Orders'Pos(Defend) then Crew_Orders'Pos(Order) + 1 else Crew_Orders'Pos(Order)); if MaxPriority then Find_Member_Max_Priority_Loop : for I in Ship.Crew.Iterate loop if Ship.Crew(I).Orders(OrderIndex) = 2 and Ship.Crew(I).Order /= Order and Ship.Crew(I).PreviousOrder /= Order then MemberIndex := Crew_Container.To_Index(I); exit Find_Member_Max_Priority_Loop; end if; end loop Find_Member_Max_Priority_Loop; else Find_Member_Priority_Loop : for I in Ship.Crew.Iterate loop if Ship.Crew(I).Orders(OrderIndex) = 1 and Ship.Crew(I).Order = Rest and Ship.Crew(I).PreviousOrder = Rest then MemberIndex := Crew_Container.To_Index(I); exit Find_Member_Priority_Loop; end if; end loop Find_Member_Priority_Loop; end if; if MemberIndex = 0 then return False; end if; if Order in Gunner | Craft | Heal | Pilot | Engineer | Train then Find_Module_Index_Loop : for I in Ship.Modules.Iterate loop if Ship.Modules(I).Durability > 0 then case Ship.Modules(I).M_Type is when GUN => if Order = Gunner and Ship.Modules(I).Owner(1) = 0 then ModuleIndex := Modules_Container.To_Index(I); exit Find_Module_Index_Loop; end if; when WORKSHOP => if Order = Craft and Ship.Modules(I).Crafting_Index /= Null_Unbounded_String then Find_Empty_Workplace_Loop : for Owner of Ship.Modules(I).Owner loop if Owner = 0 then ModuleIndex := Modules_Container.To_Index(I); exit Find_Empty_Workplace_Loop; end if; end loop Find_Empty_Workplace_Loop; exit Find_Module_Index_Loop when ModuleIndex > 0; end if; when MEDICAL_ROOM => if Order = Heal then Find_Empty_Medical_Loop : for Owner of Ship.Modules(I).Owner loop if Owner = 0 then ModuleIndex := Modules_Container.To_Index(I); exit Find_Empty_Medical_Loop; end if; end loop Find_Empty_Medical_Loop; exit Find_Module_Index_Loop when ModuleIndex > 0; end if; when COCKPIT => if Order = Pilot then ModuleIndex := Modules_Container.To_Index(I); exit Find_Module_Index_Loop; end if; when ENGINE => if Order = Engineer then ModuleIndex := Modules_Container.To_Index(I); exit Find_Module_Index_Loop; end if; when TRAINING_ROOM => if Order = Train and Ship.Modules(I).Trained_Skill > 0 then Find_Empty_Training_Loop : for Owner of Ship.Modules(I).Owner loop if Owner = 0 then ModuleIndex := Modules_Container.To_Index(I); exit Find_Empty_Training_Loop; end if; end loop Find_Empty_Training_Loop; exit Find_Module_Index_Loop when ModuleIndex > 0; end if; when others => null; end case; end if; end loop Find_Module_Index_Loop; if ModuleIndex = 0 then return False; end if; end if; if Ship.Crew(MemberIndex).Order /= Rest then GiveOrders(Ship, MemberIndex, Rest, 0, False); end if; GiveOrders(Ship, MemberIndex, Order, ModuleIndex); return True; exception when An_Exception : Crew_Order_Error | Crew_No_Space_Error => if Ship = Player_Ship then AddMessage(Exception_Message(An_Exception), OrderMessage, RED); end if; return False; end UpdatePosition; begin Crew_Members_Loop : for Member of Ship.Crew loop case Member.Order is when Pilot => HavePilot := True; when Engineer => HaveEngineer := True; when Upgrading => HaveUpgrade := True; when Talk => HaveTrader := True; when others => null; end case; if Member.Health < 100 then if FindItem (Inventory => Ship.Cargo, ItemType => Factions_List(Member.Faction).HealingTools) > 0 then CanHeal := True; end if; end if; end loop Crew_Members_Loop; Modules_Need_Loop : for Module of Ship.Modules loop if Module.Durability > 0 then case Module.M_Type is when GUN => if Module.Owner(1) = 0 and not NeedGunners then NeedGunners := True; end if; when WORKSHOP => if Module.Crafting_Index /= Null_Unbounded_String and not NeedCrafters then Find_Empty_Crafting_Loop : for Owner of Module.Owner loop if Owner = 0 then NeedCrafters := True; exit Find_Empty_Crafting_Loop; end if; end loop Find_Empty_Crafting_Loop; end if; when CABIN => if Module.Cleanliness < Module.Quality then NeedClean := True; end if; when others => null; end case; end if; if Module.Durability < Module.Max_Durability and not NeedRepairs then Find_Need_Repairs_Loop : for Item of Ship.Cargo loop if Items_List(Item.ProtoIndex).IType = Modules_List(Module.Proto_Index).RepairMaterial then NeedRepairs := True; exit Find_Need_Repairs_Loop; end if; end loop Find_Need_Repairs_Loop; end if; end loop Modules_Need_Loop; if SkyMap(Ship.Sky_X, Ship.Sky_Y).BaseIndex > 0 then NeedTrader := True; end if; if (not NeedTrader and EventIndex > 0) and then (Events_List(EventIndex).EType = Trader or Events_List(EventIndex).EType = FriendlyShip) then NeedTrader := True; end if; if not HavePilot and then UpdatePosition(Pilot) then UpdateOrders(Ship); end if; if not HaveEngineer and then UpdatePosition(Engineer) then UpdateOrders(Ship); end if; if NeedGunners and then UpdatePosition(Gunner) then UpdateOrders(Ship); end if; if NeedCrafters and then UpdatePosition(Craft) then UpdateOrders(Ship); end if; if not HaveUpgrade and Ship.Upgrade_Module > 0 and FindItem(Inventory => Ship.Cargo, ItemType => Repair_Tools) > 0 then if FindItem (Inventory => Ship.Cargo, ItemType => Modules_List(Ship.Modules(Ship.Upgrade_Module).Proto_Index) .RepairMaterial) > 0 and then UpdatePosition(Upgrading) then UpdateOrders(Ship); end if; end if; if (not HaveTrader and NeedTrader) and then UpdatePosition(Talk) then UpdateOrders(Ship); end if; if (NeedClean and FindItem(Inventory => Ship.Cargo, ItemType => Cleaning_Tools) > 0) and then UpdatePosition(Clean) then UpdateOrders(Ship); end if; if CanHeal and then UpdatePosition(Heal) then UpdateOrders(Ship); end if; if (NeedRepairs and FindItem(Inventory => Ship.Cargo, ItemType => Repair_Tools) > 0) and then UpdatePosition(Repair) then UpdateOrders(Ship); end if; if Combat then if UpdatePosition(Defend) then UpdateOrders(Ship); end if; if UpdatePosition(Boarding) then UpdateOrders(Ship); end if; end if; if UpdatePosition(Train) then UpdateOrders(Ship); end if; if not HavePilot and then UpdatePosition(Pilot, False) then UpdateOrders(Ship); end if; if not HaveEngineer and then UpdatePosition(Engineer, False) then UpdateOrders(Ship); end if; if NeedGunners and then UpdatePosition(Gunner, False) then UpdateOrders(Ship); end if; if NeedCrafters and then UpdatePosition(Craft, False) then UpdateOrders(Ship); end if; if not HaveUpgrade and Ship.Upgrade_Module > 0 and FindItem(Inventory => Ship.Cargo, ItemType => Repair_Tools) > 0 then if FindItem (Inventory => Ship.Cargo, ItemType => Modules_List(Ship.Modules(Ship.Upgrade_Module).Proto_Index) .RepairMaterial) > 0 and then UpdatePosition(Upgrading, False) then UpdateOrders(Ship); end if; end if; if (not HaveTrader and SkyMap(Ship.Sky_X, Ship.Sky_Y).BaseIndex > 0) and then UpdatePosition(Talk, False) then UpdateOrders(Ship); end if; if (NeedClean and FindItem(Inventory => Ship.Cargo, ItemType => Cleaning_Tools) > 0) and then UpdatePosition(Clean, False) then UpdateOrders(Ship); end if; if CanHeal and then UpdatePosition(Heal, False) then UpdateOrders(Ship); end if; if (NeedRepairs and FindItem(Inventory => Ship.Cargo, ItemType => Repair_Tools) > 0) and then UpdatePosition(Repair, False) then UpdateOrders(Ship); end if; if Combat then if UpdatePosition(Defend, False) then UpdateOrders(Ship); end if; if UpdatePosition(Boarding, False) then UpdateOrders(Ship); end if; end if; if UpdatePosition(Train, False) then UpdateOrders(Ship, False); end if; end UpdateOrders; procedure UpdateMorale (Ship: in out Ship_Record; MemberIndex: Crew_Container.Extended_Index; Value: Integer) is NewMorale, NewLoyalty, NewValue: Integer; FactionIndex: constant Unbounded_String := Ship.Crew(MemberIndex).Faction; begin if Factions_List(FactionIndex).Flags.Contains (To_Unbounded_String("nomorale")) then return; end if; NewValue := Value; if Factions_List(FactionIndex).Flags.Contains (To_Unbounded_String("fanaticism")) then if Value > 0 then NewValue := Value * 5; else NewValue := Value / 10; if NewValue = 0 and then Get_Random(1, 10) <= abs (Value) then NewValue := -1; end if; if NewValue = 0 then return; end if; end if; end if; NewValue := Ship.Crew(MemberIndex).Morale(2) + NewValue; NewMorale := Ship.Crew(MemberIndex).Morale(1); Raise_Morale_Loop : while NewValue >= 5 loop NewValue := NewValue - 5; NewMorale := NewMorale + 1; end loop Raise_Morale_Loop; Lower_Morale_Loop : while NewValue < 0 loop NewValue := NewValue + 5; NewMorale := NewMorale - 1; end loop Lower_Morale_Loop; if NewMorale > 100 then NewMorale := 100; elsif NewMorale < 0 then NewMorale := 0; end if; Ship.Crew(MemberIndex).Morale := (NewMorale, NewValue); if Ship = Player_Ship and MemberIndex = 1 then return; end if; NewLoyalty := Ship.Crew(MemberIndex).Loyalty; if NewMorale > 75 and NewLoyalty < 100 then NewLoyalty := NewLoyalty + 1; end if; if NewMorale < 25 and NewLoyalty > 0 then NewLoyalty := NewLoyalty - Get_Random(5, 10); end if; if NewLoyalty > 100 then NewLoyalty := 100; elsif NewLoyalty < 0 then NewLoyalty := 0; end if; Ship.Crew(MemberIndex).Loyalty := NewLoyalty; end UpdateMorale; end Ships.Crew;
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_84_325.asm
ljhsiun2/medusa
9
18060
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r9 push %rax push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0xaa3a, %rsi lea addresses_UC_ht+0xaf52, %rdi nop nop nop nop xor $24000, %r9 mov $61, %rcx rep movsb inc %rax lea addresses_WT_ht+0x19940, %r15 nop nop nop add $32556, %rbp movw $0x6162, (%r15) nop nop cmp $28761, %r15 lea addresses_D_ht+0x9c7a, %rax nop nop nop dec %rsi movups (%rax), %xmm2 vpextrq $1, %xmm2, %rcx nop nop nop xor $312, %rsi lea addresses_D_ht+0x927a, %rbp nop nop nop add $46665, %rdi mov $0x6162636465666768, %r9 movq %r9, (%rbp) nop cmp $62871, %rdi lea addresses_normal_ht+0x4c7a, %rax nop add $52028, %rdi mov $0x6162636465666768, %r9 movq %r9, (%rax) nop nop nop nop and $12769, %rbp lea addresses_A_ht+0x17c62, %rsi lea addresses_WT_ht+0x1a87a, %rdi nop nop nop nop dec %r15 mov $108, %rcx rep movsq nop nop nop nop nop add $7396, %rax lea addresses_normal_ht+0x13e7a, %rsi lea addresses_A_ht+0x1947a, %rdi nop nop nop nop and $27703, %r12 mov $20, %rcx rep movsw nop nop nop nop and $37242, %r9 pop %rsi pop %rdi pop %rcx pop %rbp pop %rax pop %r9 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r8 push %rax push %rbp push %rcx // Store lea addresses_normal+0x1fc7a, %rax nop xor %r8, %r8 mov $0x5152535455565758, %r13 movq %r13, (%rax) nop nop nop nop add %rcx, %rcx // Store lea addresses_UC+0x1b0ea, %r8 nop nop dec %r14 mov $0x5152535455565758, %r13 movq %r13, (%r8) // Exception!!! nop nop nop nop nop mov (0), %r14 nop nop nop nop add $15512, %rax // Store lea addresses_UC+0x1ba1a, %r15 nop nop nop nop nop xor $4309, %r8 movl $0x51525354, (%r15) nop nop xor %rbp, %rbp // Store lea addresses_normal+0x1407a, %rax nop nop nop xor $23348, %r15 movl $0x51525354, (%rax) nop nop and $19310, %r15 // Store lea addresses_US+0x16c5a, %r13 nop and $36659, %rcx mov $0x5152535455565758, %rax movq %rax, (%r13) nop nop dec %rax // Store lea addresses_RW+0x1f8ae, %r8 nop nop and $58659, %rax movl $0x51525354, (%r8) nop nop nop nop and %rbp, %rbp // Store lea addresses_UC+0x1102e, %r13 nop cmp $34977, %rcx mov $0x5152535455565758, %r8 movq %r8, %xmm4 movups %xmm4, (%r13) nop nop nop cmp $25924, %rbp // Store mov $0x3ea, %r13 nop nop cmp %rcx, %rcx mov $0x5152535455565758, %rax movq %rax, (%r13) nop nop nop nop nop and %rbp, %rbp // Store lea addresses_A+0x12da2, %r14 nop nop and $63056, %r8 movb $0x51, (%r14) and $49729, %r14 // Store lea addresses_A+0xee3a, %r13 nop nop add $39212, %r15 movl $0x51525354, (%r13) sub $47642, %r8 // Faulty Load lea addresses_normal+0x1fc7a, %r14 add %r8, %r8 vmovups (%r14), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $0, %xmm7, %rbp lea oracles, %r13 and $0xff, %rbp shlq $12, %rbp mov (%r13,%rbp,1), %rbp pop %rcx pop %rbp pop %rax pop %r8 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 4}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': True, 'AVXalign': False, 'size': 4, 'congruent': 5}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_US', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 2}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_P', 'NT': True, 'AVXalign': True, 'size': 8, 'congruent': 3}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 1}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 6}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 8}} {'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 10, 'type': 'addresses_WT_ht'}} {'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}, 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_A_ht'}} {'34': 84} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
examples/src/hwclient.adb
sonneveld/adazmq
0
25995
with Ada.Command_Line; with Ada.Text_IO; with ZMQ; procedure HWClient is function Main return Ada.Command_Line.Exit_Status is begin Ada.Text_IO.Put_Line ("Connecting to hello world server..."); declare Context : ZMQ.Context_Type := ZMQ.New_Context; Requester : constant ZMQ.Socket_Type'Class := Context.New_Socket (ZMQ.ZMQ_REQ); begin Requester.Connect ("tcp://localhost:5555"); for Request_Nbr in 0 .. 10 loop Ada.Text_IO.Put_Line ("Sending Hello "&Request_Nbr'Img&"..."); Requester.Send ("Hello"); declare Dummy : String := Requester.Recv; begin Ada.Text_IO.Put_Line ("Received World " & Request_Nbr'Img); end; end loop; Requester.Close; Context.Term; end; return 0; end Main; begin Ada.Command_Line.Set_Exit_Status (Main); end HWClient;
programs/oeis/152/A152101.asm
neoneye/loda
22
98277
<reponame>neoneye/loda ; A152101: a(n)=16^n - 3*2^(2*n - 1) - 1. ; 9,231,3999,65151,1047039,16771071,268410879,4294868991,68719083519,1099510054911,17592179752959,281474951544831,4503599526707199,72057593635274751,1152921502996234239,18446744067267100671 add $0,2 mov $1,4 pow $1,$0 sub $1,3 pow $1,2 sub $1,169 div $1,16 add $1,9 mov $0,$1
oeis/017/A017009.asm
neoneye/loda-programs
11
243512
<filename>oeis/017/A017009.asm ; A017009: a(n) = (7*n + 2)^5. ; 32,59049,1048576,6436343,24300000,69343957,164916224,345025251,656356768,1160290625,1934917632,3077056399,4704270176,6956883693,10000000000,14025517307,19254145824,25937424601,34359738368,44840334375,57735339232,73439775749,92389579776,115063617043,141985700000,173726604657,210906087424,254194901951,304316815968,362050628125,428232184832,503756397099,589579257376,686719856393,796262400000,919358226007,1057227821024,1211162837301,1382528109568,1572763671875,1783386774432,2015993900449 mul $0,7 add $0,2 pow $0,5
dist-test/cat.asm
LongLeonardoLe/xv6
0
7929
<filename>dist-test/cat.asm _cat: file format elf32-i386 Disassembly of section .text: 00000000 <cat>: char buf[512]; void cat(int fd) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 83 ec 18 sub $0x18,%esp int n; while((n = read(fd, buf, sizeof(buf))) > 0) 6: eb 15 jmp 1d <cat+0x1d> write(1, buf, n); 8: 83 ec 04 sub $0x4,%esp b: ff 75 f4 pushl -0xc(%ebp) e: 68 80 0c 00 00 push $0xc80 13: 6a 01 push $0x1 15: e8 fa 03 00 00 call 414 <write> 1a: 83 c4 10 add $0x10,%esp void cat(int fd) { int n; while((n = read(fd, buf, sizeof(buf))) > 0) 1d: 83 ec 04 sub $0x4,%esp 20: 68 00 02 00 00 push $0x200 25: 68 80 0c 00 00 push $0xc80 2a: ff 75 08 pushl 0x8(%ebp) 2d: e8 da 03 00 00 call 40c <read> 32: 83 c4 10 add $0x10,%esp 35: 89 45 f4 mov %eax,-0xc(%ebp) 38: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 3c: 7f ca jg 8 <cat+0x8> write(1, buf, n); if(n < 0){ 3e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 42: 79 17 jns 5b <cat+0x5b> printf(1, "cat: read error\n"); 44: 83 ec 08 sub $0x8,%esp 47: 68 81 09 00 00 push $0x981 4c: 6a 01 push $0x1 4e: e8 78 05 00 00 call 5cb <printf> 53: 83 c4 10 add $0x10,%esp exit(); 56: e8 99 03 00 00 call 3f4 <exit> } } 5b: 90 nop 5c: c9 leave 5d: c3 ret 0000005e <main>: int main(int argc, char *argv[]) { 5e: 8d 4c 24 04 lea 0x4(%esp),%ecx 62: 83 e4 f0 and $0xfffffff0,%esp 65: ff 71 fc pushl -0x4(%ecx) 68: 55 push %ebp 69: 89 e5 mov %esp,%ebp 6b: 53 push %ebx 6c: 51 push %ecx 6d: 83 ec 10 sub $0x10,%esp 70: 89 cb mov %ecx,%ebx int fd, i; if(argc <= 1){ 72: 83 3b 01 cmpl $0x1,(%ebx) 75: 7f 12 jg 89 <main+0x2b> cat(0); 77: 83 ec 0c sub $0xc,%esp 7a: 6a 00 push $0x0 7c: e8 7f ff ff ff call 0 <cat> 81: 83 c4 10 add $0x10,%esp exit(); 84: e8 6b 03 00 00 call 3f4 <exit> } for(i = 1; i < argc; i++){ 89: c7 45 f4 01 00 00 00 movl $0x1,-0xc(%ebp) 90: eb 71 jmp 103 <main+0xa5> if((fd = open(argv[i], 0)) < 0){ 92: 8b 45 f4 mov -0xc(%ebp),%eax 95: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx 9c: 8b 43 04 mov 0x4(%ebx),%eax 9f: 01 d0 add %edx,%eax a1: 8b 00 mov (%eax),%eax a3: 83 ec 08 sub $0x8,%esp a6: 6a 00 push $0x0 a8: 50 push %eax a9: e8 86 03 00 00 call 434 <open> ae: 83 c4 10 add $0x10,%esp b1: 89 45 f0 mov %eax,-0x10(%ebp) b4: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) b8: 79 29 jns e3 <main+0x85> printf(1, "cat: cannot open %s\n", argv[i]); ba: 8b 45 f4 mov -0xc(%ebp),%eax bd: 8d 14 85 00 00 00 00 lea 0x0(,%eax,4),%edx c4: 8b 43 04 mov 0x4(%ebx),%eax c7: 01 d0 add %edx,%eax c9: 8b 00 mov (%eax),%eax cb: 83 ec 04 sub $0x4,%esp ce: 50 push %eax cf: 68 92 09 00 00 push $0x992 d4: 6a 01 push $0x1 d6: e8 f0 04 00 00 call 5cb <printf> db: 83 c4 10 add $0x10,%esp exit(); de: e8 11 03 00 00 call 3f4 <exit> } cat(fd); e3: 83 ec 0c sub $0xc,%esp e6: ff 75 f0 pushl -0x10(%ebp) e9: e8 12 ff ff ff call 0 <cat> ee: 83 c4 10 add $0x10,%esp close(fd); f1: 83 ec 0c sub $0xc,%esp f4: ff 75 f0 pushl -0x10(%ebp) f7: e8 20 03 00 00 call 41c <close> fc: 83 c4 10 add $0x10,%esp if(argc <= 1){ cat(0); exit(); } for(i = 1; i < argc; i++){ ff: 83 45 f4 01 addl $0x1,-0xc(%ebp) 103: 8b 45 f4 mov -0xc(%ebp),%eax 106: 3b 03 cmp (%ebx),%eax 108: 7c 88 jl 92 <main+0x34> exit(); } cat(fd); close(fd); } exit(); 10a: e8 e5 02 00 00 call 3f4 <exit> 0000010f <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 10f: 55 push %ebp 110: 89 e5 mov %esp,%ebp 112: 57 push %edi 113: 53 push %ebx asm volatile("cld; rep stosb" : 114: 8b 4d 08 mov 0x8(%ebp),%ecx 117: 8b 55 10 mov 0x10(%ebp),%edx 11a: 8b 45 0c mov 0xc(%ebp),%eax 11d: 89 cb mov %ecx,%ebx 11f: 89 df mov %ebx,%edi 121: 89 d1 mov %edx,%ecx 123: fc cld 124: f3 aa rep stos %al,%es:(%edi) 126: 89 ca mov %ecx,%edx 128: 89 fb mov %edi,%ebx 12a: 89 5d 08 mov %ebx,0x8(%ebp) 12d: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 130: 90 nop 131: 5b pop %ebx 132: 5f pop %edi 133: 5d pop %ebp 134: c3 ret 00000135 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 135: 55 push %ebp 136: 89 e5 mov %esp,%ebp 138: 83 ec 10 sub $0x10,%esp char *os; os = s; 13b: 8b 45 08 mov 0x8(%ebp),%eax 13e: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 141: 90 nop 142: 8b 45 08 mov 0x8(%ebp),%eax 145: 8d 50 01 lea 0x1(%eax),%edx 148: 89 55 08 mov %edx,0x8(%ebp) 14b: 8b 55 0c mov 0xc(%ebp),%edx 14e: 8d 4a 01 lea 0x1(%edx),%ecx 151: 89 4d 0c mov %ecx,0xc(%ebp) 154: 0f b6 12 movzbl (%edx),%edx 157: 88 10 mov %dl,(%eax) 159: 0f b6 00 movzbl (%eax),%eax 15c: 84 c0 test %al,%al 15e: 75 e2 jne 142 <strcpy+0xd> ; return os; 160: 8b 45 fc mov -0x4(%ebp),%eax } 163: c9 leave 164: c3 ret 00000165 <strcmp>: int strcmp(const char *p, const char *q) { 165: 55 push %ebp 166: 89 e5 mov %esp,%ebp while(*p && *p == *q) 168: eb 08 jmp 172 <strcmp+0xd> p++, q++; 16a: 83 45 08 01 addl $0x1,0x8(%ebp) 16e: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 172: 8b 45 08 mov 0x8(%ebp),%eax 175: 0f b6 00 movzbl (%eax),%eax 178: 84 c0 test %al,%al 17a: 74 10 je 18c <strcmp+0x27> 17c: 8b 45 08 mov 0x8(%ebp),%eax 17f: 0f b6 10 movzbl (%eax),%edx 182: 8b 45 0c mov 0xc(%ebp),%eax 185: 0f b6 00 movzbl (%eax),%eax 188: 38 c2 cmp %al,%dl 18a: 74 de je 16a <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 18c: 8b 45 08 mov 0x8(%ebp),%eax 18f: 0f b6 00 movzbl (%eax),%eax 192: 0f b6 d0 movzbl %al,%edx 195: 8b 45 0c mov 0xc(%ebp),%eax 198: 0f b6 00 movzbl (%eax),%eax 19b: 0f b6 c0 movzbl %al,%eax 19e: 29 c2 sub %eax,%edx 1a0: 89 d0 mov %edx,%eax } 1a2: 5d pop %ebp 1a3: c3 ret 000001a4 <strlen>: uint strlen(char *s) { 1a4: 55 push %ebp 1a5: 89 e5 mov %esp,%ebp 1a7: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 1aa: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 1b1: eb 04 jmp 1b7 <strlen+0x13> 1b3: 83 45 fc 01 addl $0x1,-0x4(%ebp) 1b7: 8b 55 fc mov -0x4(%ebp),%edx 1ba: 8b 45 08 mov 0x8(%ebp),%eax 1bd: 01 d0 add %edx,%eax 1bf: 0f b6 00 movzbl (%eax),%eax 1c2: 84 c0 test %al,%al 1c4: 75 ed jne 1b3 <strlen+0xf> ; return n; 1c6: 8b 45 fc mov -0x4(%ebp),%eax } 1c9: c9 leave 1ca: c3 ret 000001cb <memset>: void* memset(void *dst, int c, uint n) { 1cb: 55 push %ebp 1cc: 89 e5 mov %esp,%ebp stosb(dst, c, n); 1ce: 8b 45 10 mov 0x10(%ebp),%eax 1d1: 50 push %eax 1d2: ff 75 0c pushl 0xc(%ebp) 1d5: ff 75 08 pushl 0x8(%ebp) 1d8: e8 32 ff ff ff call 10f <stosb> 1dd: 83 c4 0c add $0xc,%esp return dst; 1e0: 8b 45 08 mov 0x8(%ebp),%eax } 1e3: c9 leave 1e4: c3 ret 000001e5 <strchr>: char* strchr(const char *s, char c) { 1e5: 55 push %ebp 1e6: 89 e5 mov %esp,%ebp 1e8: 83 ec 04 sub $0x4,%esp 1eb: 8b 45 0c mov 0xc(%ebp),%eax 1ee: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 1f1: eb 14 jmp 207 <strchr+0x22> if(*s == c) 1f3: 8b 45 08 mov 0x8(%ebp),%eax 1f6: 0f b6 00 movzbl (%eax),%eax 1f9: 3a 45 fc cmp -0x4(%ebp),%al 1fc: 75 05 jne 203 <strchr+0x1e> return (char*)s; 1fe: 8b 45 08 mov 0x8(%ebp),%eax 201: eb 13 jmp 216 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 203: 83 45 08 01 addl $0x1,0x8(%ebp) 207: 8b 45 08 mov 0x8(%ebp),%eax 20a: 0f b6 00 movzbl (%eax),%eax 20d: 84 c0 test %al,%al 20f: 75 e2 jne 1f3 <strchr+0xe> if(*s == c) return (char*)s; return 0; 211: b8 00 00 00 00 mov $0x0,%eax } 216: c9 leave 217: c3 ret 00000218 <gets>: char* gets(char *buf, int max) { 218: 55 push %ebp 219: 89 e5 mov %esp,%ebp 21b: 83 ec 18 sub $0x18,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 21e: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 225: eb 42 jmp 269 <gets+0x51> cc = read(0, &c, 1); 227: 83 ec 04 sub $0x4,%esp 22a: 6a 01 push $0x1 22c: 8d 45 ef lea -0x11(%ebp),%eax 22f: 50 push %eax 230: 6a 00 push $0x0 232: e8 d5 01 00 00 call 40c <read> 237: 83 c4 10 add $0x10,%esp 23a: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 23d: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 241: 7e 33 jle 276 <gets+0x5e> break; buf[i++] = c; 243: 8b 45 f4 mov -0xc(%ebp),%eax 246: 8d 50 01 lea 0x1(%eax),%edx 249: 89 55 f4 mov %edx,-0xc(%ebp) 24c: 89 c2 mov %eax,%edx 24e: 8b 45 08 mov 0x8(%ebp),%eax 251: 01 c2 add %eax,%edx 253: 0f b6 45 ef movzbl -0x11(%ebp),%eax 257: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 259: 0f b6 45 ef movzbl -0x11(%ebp),%eax 25d: 3c 0a cmp $0xa,%al 25f: 74 16 je 277 <gets+0x5f> 261: 0f b6 45 ef movzbl -0x11(%ebp),%eax 265: 3c 0d cmp $0xd,%al 267: 74 0e je 277 <gets+0x5f> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 269: 8b 45 f4 mov -0xc(%ebp),%eax 26c: 83 c0 01 add $0x1,%eax 26f: 3b 45 0c cmp 0xc(%ebp),%eax 272: 7c b3 jl 227 <gets+0xf> 274: eb 01 jmp 277 <gets+0x5f> cc = read(0, &c, 1); if(cc < 1) break; 276: 90 nop buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 277: 8b 55 f4 mov -0xc(%ebp),%edx 27a: 8b 45 08 mov 0x8(%ebp),%eax 27d: 01 d0 add %edx,%eax 27f: c6 00 00 movb $0x0,(%eax) return buf; 282: 8b 45 08 mov 0x8(%ebp),%eax } 285: c9 leave 286: c3 ret 00000287 <stat>: int stat(char *n, struct stat *st) { 287: 55 push %ebp 288: 89 e5 mov %esp,%ebp 28a: 83 ec 18 sub $0x18,%esp int fd; int r; fd = open(n, O_RDONLY); 28d: 83 ec 08 sub $0x8,%esp 290: 6a 00 push $0x0 292: ff 75 08 pushl 0x8(%ebp) 295: e8 9a 01 00 00 call 434 <open> 29a: 83 c4 10 add $0x10,%esp 29d: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 2a0: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2a4: 79 07 jns 2ad <stat+0x26> return -1; 2a6: b8 ff ff ff ff mov $0xffffffff,%eax 2ab: eb 25 jmp 2d2 <stat+0x4b> r = fstat(fd, st); 2ad: 83 ec 08 sub $0x8,%esp 2b0: ff 75 0c pushl 0xc(%ebp) 2b3: ff 75 f4 pushl -0xc(%ebp) 2b6: e8 91 01 00 00 call 44c <fstat> 2bb: 83 c4 10 add $0x10,%esp 2be: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 2c1: 83 ec 0c sub $0xc,%esp 2c4: ff 75 f4 pushl -0xc(%ebp) 2c7: e8 50 01 00 00 call 41c <close> 2cc: 83 c4 10 add $0x10,%esp return r; 2cf: 8b 45 f0 mov -0x10(%ebp),%eax } 2d2: c9 leave 2d3: c3 ret 000002d4 <atoi>: int atoi(const char *s) { 2d4: 55 push %ebp 2d5: 89 e5 mov %esp,%ebp 2d7: 83 ec 10 sub $0x10,%esp int n; n = 0; 2da: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 2e1: eb 25 jmp 308 <atoi+0x34> n = n*10 + *s++ - '0'; 2e3: 8b 55 fc mov -0x4(%ebp),%edx 2e6: 89 d0 mov %edx,%eax 2e8: c1 e0 02 shl $0x2,%eax 2eb: 01 d0 add %edx,%eax 2ed: 01 c0 add %eax,%eax 2ef: 89 c1 mov %eax,%ecx 2f1: 8b 45 08 mov 0x8(%ebp),%eax 2f4: 8d 50 01 lea 0x1(%eax),%edx 2f7: 89 55 08 mov %edx,0x8(%ebp) 2fa: 0f b6 00 movzbl (%eax),%eax 2fd: 0f be c0 movsbl %al,%eax 300: 01 c8 add %ecx,%eax 302: 83 e8 30 sub $0x30,%eax 305: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 308: 8b 45 08 mov 0x8(%ebp),%eax 30b: 0f b6 00 movzbl (%eax),%eax 30e: 3c 2f cmp $0x2f,%al 310: 7e 0a jle 31c <atoi+0x48> 312: 8b 45 08 mov 0x8(%ebp),%eax 315: 0f b6 00 movzbl (%eax),%eax 318: 3c 39 cmp $0x39,%al 31a: 7e c7 jle 2e3 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 31c: 8b 45 fc mov -0x4(%ebp),%eax } 31f: c9 leave 320: c3 ret 00000321 <atoo>: int atoo(const char *s) { 321: 55 push %ebp 322: 89 e5 mov %esp,%ebp 324: 83 ec 10 sub $0x10,%esp int n, sign; n = 0; 327: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while (*s == ' ') 32e: eb 04 jmp 334 <atoo+0x13> s++; 330: 83 45 08 01 addl $0x1,0x8(%ebp) int atoo(const char *s) { int n, sign; n = 0; while (*s == ' ') 334: 8b 45 08 mov 0x8(%ebp),%eax 337: 0f b6 00 movzbl (%eax),%eax 33a: 3c 20 cmp $0x20,%al 33c: 74 f2 je 330 <atoo+0xf> s++; sign = (*s == '-') ? -1 : 1; 33e: 8b 45 08 mov 0x8(%ebp),%eax 341: 0f b6 00 movzbl (%eax),%eax 344: 3c 2d cmp $0x2d,%al 346: 75 07 jne 34f <atoo+0x2e> 348: b8 ff ff ff ff mov $0xffffffff,%eax 34d: eb 05 jmp 354 <atoo+0x33> 34f: b8 01 00 00 00 mov $0x1,%eax 354: 89 45 f8 mov %eax,-0x8(%ebp) if (*s == '+' || *s == '-') 357: 8b 45 08 mov 0x8(%ebp),%eax 35a: 0f b6 00 movzbl (%eax),%eax 35d: 3c 2b cmp $0x2b,%al 35f: 74 0a je 36b <atoo+0x4a> 361: 8b 45 08 mov 0x8(%ebp),%eax 364: 0f b6 00 movzbl (%eax),%eax 367: 3c 2d cmp $0x2d,%al 369: 75 27 jne 392 <atoo+0x71> s++; 36b: 83 45 08 01 addl $0x1,0x8(%ebp) while ('0' <= *s && *s <= '7') 36f: eb 21 jmp 392 <atoo+0x71> n = n*8 + *s++ - '0'; 371: 8b 45 fc mov -0x4(%ebp),%eax 374: 8d 0c c5 00 00 00 00 lea 0x0(,%eax,8),%ecx 37b: 8b 45 08 mov 0x8(%ebp),%eax 37e: 8d 50 01 lea 0x1(%eax),%edx 381: 89 55 08 mov %edx,0x8(%ebp) 384: 0f b6 00 movzbl (%eax),%eax 387: 0f be c0 movsbl %al,%eax 38a: 01 c8 add %ecx,%eax 38c: 83 e8 30 sub $0x30,%eax 38f: 89 45 fc mov %eax,-0x4(%ebp) while (*s == ' ') s++; sign = (*s == '-') ? -1 : 1; if (*s == '+' || *s == '-') s++; while ('0' <= *s && *s <= '7') 392: 8b 45 08 mov 0x8(%ebp),%eax 395: 0f b6 00 movzbl (%eax),%eax 398: 3c 2f cmp $0x2f,%al 39a: 7e 0a jle 3a6 <atoo+0x85> 39c: 8b 45 08 mov 0x8(%ebp),%eax 39f: 0f b6 00 movzbl (%eax),%eax 3a2: 3c 37 cmp $0x37,%al 3a4: 7e cb jle 371 <atoo+0x50> n = n*8 + *s++ - '0'; return sign*n; 3a6: 8b 45 f8 mov -0x8(%ebp),%eax 3a9: 0f af 45 fc imul -0x4(%ebp),%eax } 3ad: c9 leave 3ae: c3 ret 000003af <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 3af: 55 push %ebp 3b0: 89 e5 mov %esp,%ebp 3b2: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 3b5: 8b 45 08 mov 0x8(%ebp),%eax 3b8: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 3bb: 8b 45 0c mov 0xc(%ebp),%eax 3be: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 3c1: eb 17 jmp 3da <memmove+0x2b> *dst++ = *src++; 3c3: 8b 45 fc mov -0x4(%ebp),%eax 3c6: 8d 50 01 lea 0x1(%eax),%edx 3c9: 89 55 fc mov %edx,-0x4(%ebp) 3cc: 8b 55 f8 mov -0x8(%ebp),%edx 3cf: 8d 4a 01 lea 0x1(%edx),%ecx 3d2: 89 4d f8 mov %ecx,-0x8(%ebp) 3d5: 0f b6 12 movzbl (%edx),%edx 3d8: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 3da: 8b 45 10 mov 0x10(%ebp),%eax 3dd: 8d 50 ff lea -0x1(%eax),%edx 3e0: 89 55 10 mov %edx,0x10(%ebp) 3e3: 85 c0 test %eax,%eax 3e5: 7f dc jg 3c3 <memmove+0x14> *dst++ = *src++; return vdst; 3e7: 8b 45 08 mov 0x8(%ebp),%eax } 3ea: c9 leave 3eb: c3 ret 000003ec <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 3ec: b8 01 00 00 00 mov $0x1,%eax 3f1: cd 40 int $0x40 3f3: c3 ret 000003f4 <exit>: SYSCALL(exit) 3f4: b8 02 00 00 00 mov $0x2,%eax 3f9: cd 40 int $0x40 3fb: c3 ret 000003fc <wait>: SYSCALL(wait) 3fc: b8 03 00 00 00 mov $0x3,%eax 401: cd 40 int $0x40 403: c3 ret 00000404 <pipe>: SYSCALL(pipe) 404: b8 04 00 00 00 mov $0x4,%eax 409: cd 40 int $0x40 40b: c3 ret 0000040c <read>: SYSCALL(read) 40c: b8 05 00 00 00 mov $0x5,%eax 411: cd 40 int $0x40 413: c3 ret 00000414 <write>: SYSCALL(write) 414: b8 10 00 00 00 mov $0x10,%eax 419: cd 40 int $0x40 41b: c3 ret 0000041c <close>: SYSCALL(close) 41c: b8 15 00 00 00 mov $0x15,%eax 421: cd 40 int $0x40 423: c3 ret 00000424 <kill>: SYSCALL(kill) 424: b8 06 00 00 00 mov $0x6,%eax 429: cd 40 int $0x40 42b: c3 ret 0000042c <exec>: SYSCALL(exec) 42c: b8 07 00 00 00 mov $0x7,%eax 431: cd 40 int $0x40 433: c3 ret 00000434 <open>: SYSCALL(open) 434: b8 0f 00 00 00 mov $0xf,%eax 439: cd 40 int $0x40 43b: c3 ret 0000043c <mknod>: SYSCALL(mknod) 43c: b8 11 00 00 00 mov $0x11,%eax 441: cd 40 int $0x40 443: c3 ret 00000444 <unlink>: SYSCALL(unlink) 444: b8 12 00 00 00 mov $0x12,%eax 449: cd 40 int $0x40 44b: c3 ret 0000044c <fstat>: SYSCALL(fstat) 44c: b8 08 00 00 00 mov $0x8,%eax 451: cd 40 int $0x40 453: c3 ret 00000454 <link>: SYSCALL(link) 454: b8 13 00 00 00 mov $0x13,%eax 459: cd 40 int $0x40 45b: c3 ret 0000045c <mkdir>: SYSCALL(mkdir) 45c: b8 14 00 00 00 mov $0x14,%eax 461: cd 40 int $0x40 463: c3 ret 00000464 <chdir>: SYSCALL(chdir) 464: b8 09 00 00 00 mov $0x9,%eax 469: cd 40 int $0x40 46b: c3 ret 0000046c <dup>: SYSCALL(dup) 46c: b8 0a 00 00 00 mov $0xa,%eax 471: cd 40 int $0x40 473: c3 ret 00000474 <getpid>: SYSCALL(getpid) 474: b8 0b 00 00 00 mov $0xb,%eax 479: cd 40 int $0x40 47b: c3 ret 0000047c <sbrk>: SYSCALL(sbrk) 47c: b8 0c 00 00 00 mov $0xc,%eax 481: cd 40 int $0x40 483: c3 ret 00000484 <sleep>: SYSCALL(sleep) 484: b8 0d 00 00 00 mov $0xd,%eax 489: cd 40 int $0x40 48b: c3 ret 0000048c <uptime>: SYSCALL(uptime) 48c: b8 0e 00 00 00 mov $0xe,%eax 491: cd 40 int $0x40 493: c3 ret 00000494 <halt>: SYSCALL(halt) 494: b8 16 00 00 00 mov $0x16,%eax 499: cd 40 int $0x40 49b: c3 ret 0000049c <date>: SYSCALL(date) 49c: b8 17 00 00 00 mov $0x17,%eax 4a1: cd 40 int $0x40 4a3: c3 ret 000004a4 <getuid>: SYSCALL(getuid) 4a4: b8 18 00 00 00 mov $0x18,%eax 4a9: cd 40 int $0x40 4ab: c3 ret 000004ac <getgid>: SYSCALL(getgid) 4ac: b8 19 00 00 00 mov $0x19,%eax 4b1: cd 40 int $0x40 4b3: c3 ret 000004b4 <getppid>: SYSCALL(getppid) 4b4: b8 1a 00 00 00 mov $0x1a,%eax 4b9: cd 40 int $0x40 4bb: c3 ret 000004bc <setuid>: SYSCALL(setuid) 4bc: b8 1b 00 00 00 mov $0x1b,%eax 4c1: cd 40 int $0x40 4c3: c3 ret 000004c4 <setgid>: SYSCALL(setgid) 4c4: b8 1c 00 00 00 mov $0x1c,%eax 4c9: cd 40 int $0x40 4cb: c3 ret 000004cc <getprocs>: SYSCALL(getprocs) 4cc: b8 1d 00 00 00 mov $0x1d,%eax 4d1: cd 40 int $0x40 4d3: c3 ret 000004d4 <setpriority>: SYSCALL(setpriority) 4d4: b8 1e 00 00 00 mov $0x1e,%eax 4d9: cd 40 int $0x40 4db: c3 ret 000004dc <chmod>: SYSCALL(chmod) 4dc: b8 1f 00 00 00 mov $0x1f,%eax 4e1: cd 40 int $0x40 4e3: c3 ret 000004e4 <chown>: SYSCALL(chown) 4e4: b8 20 00 00 00 mov $0x20,%eax 4e9: cd 40 int $0x40 4eb: c3 ret 000004ec <chgrp>: SYSCALL(chgrp) 4ec: b8 21 00 00 00 mov $0x21,%eax 4f1: cd 40 int $0x40 4f3: c3 ret 000004f4 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 4f4: 55 push %ebp 4f5: 89 e5 mov %esp,%ebp 4f7: 83 ec 18 sub $0x18,%esp 4fa: 8b 45 0c mov 0xc(%ebp),%eax 4fd: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 500: 83 ec 04 sub $0x4,%esp 503: 6a 01 push $0x1 505: 8d 45 f4 lea -0xc(%ebp),%eax 508: 50 push %eax 509: ff 75 08 pushl 0x8(%ebp) 50c: e8 03 ff ff ff call 414 <write> 511: 83 c4 10 add $0x10,%esp } 514: 90 nop 515: c9 leave 516: c3 ret 00000517 <printint>: static void printint(int fd, int xx, int base, int sgn) { 517: 55 push %ebp 518: 89 e5 mov %esp,%ebp 51a: 53 push %ebx 51b: 83 ec 24 sub $0x24,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 51e: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 525: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 529: 74 17 je 542 <printint+0x2b> 52b: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 52f: 79 11 jns 542 <printint+0x2b> neg = 1; 531: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 538: 8b 45 0c mov 0xc(%ebp),%eax 53b: f7 d8 neg %eax 53d: 89 45 ec mov %eax,-0x14(%ebp) 540: eb 06 jmp 548 <printint+0x31> } else { x = xx; 542: 8b 45 0c mov 0xc(%ebp),%eax 545: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 548: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 54f: 8b 4d f4 mov -0xc(%ebp),%ecx 552: 8d 41 01 lea 0x1(%ecx),%eax 555: 89 45 f4 mov %eax,-0xc(%ebp) 558: 8b 5d 10 mov 0x10(%ebp),%ebx 55b: 8b 45 ec mov -0x14(%ebp),%eax 55e: ba 00 00 00 00 mov $0x0,%edx 563: f7 f3 div %ebx 565: 89 d0 mov %edx,%eax 567: 0f b6 80 3c 0c 00 00 movzbl 0xc3c(%eax),%eax 56e: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 572: 8b 5d 10 mov 0x10(%ebp),%ebx 575: 8b 45 ec mov -0x14(%ebp),%eax 578: ba 00 00 00 00 mov $0x0,%edx 57d: f7 f3 div %ebx 57f: 89 45 ec mov %eax,-0x14(%ebp) 582: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 586: 75 c7 jne 54f <printint+0x38> if(neg) 588: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 58c: 74 2d je 5bb <printint+0xa4> buf[i++] = '-'; 58e: 8b 45 f4 mov -0xc(%ebp),%eax 591: 8d 50 01 lea 0x1(%eax),%edx 594: 89 55 f4 mov %edx,-0xc(%ebp) 597: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 59c: eb 1d jmp 5bb <printint+0xa4> putc(fd, buf[i]); 59e: 8d 55 dc lea -0x24(%ebp),%edx 5a1: 8b 45 f4 mov -0xc(%ebp),%eax 5a4: 01 d0 add %edx,%eax 5a6: 0f b6 00 movzbl (%eax),%eax 5a9: 0f be c0 movsbl %al,%eax 5ac: 83 ec 08 sub $0x8,%esp 5af: 50 push %eax 5b0: ff 75 08 pushl 0x8(%ebp) 5b3: e8 3c ff ff ff call 4f4 <putc> 5b8: 83 c4 10 add $0x10,%esp buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 5bb: 83 6d f4 01 subl $0x1,-0xc(%ebp) 5bf: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 5c3: 79 d9 jns 59e <printint+0x87> putc(fd, buf[i]); } 5c5: 90 nop 5c6: 8b 5d fc mov -0x4(%ebp),%ebx 5c9: c9 leave 5ca: c3 ret 000005cb <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 5cb: 55 push %ebp 5cc: 89 e5 mov %esp,%ebp 5ce: 83 ec 28 sub $0x28,%esp char *s; int c, i, state; uint *ap; state = 0; 5d1: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 5d8: 8d 45 0c lea 0xc(%ebp),%eax 5db: 83 c0 04 add $0x4,%eax 5de: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 5e1: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 5e8: e9 59 01 00 00 jmp 746 <printf+0x17b> c = fmt[i] & 0xff; 5ed: 8b 55 0c mov 0xc(%ebp),%edx 5f0: 8b 45 f0 mov -0x10(%ebp),%eax 5f3: 01 d0 add %edx,%eax 5f5: 0f b6 00 movzbl (%eax),%eax 5f8: 0f be c0 movsbl %al,%eax 5fb: 25 ff 00 00 00 and $0xff,%eax 600: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 603: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 607: 75 2c jne 635 <printf+0x6a> if(c == '%'){ 609: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 60d: 75 0c jne 61b <printf+0x50> state = '%'; 60f: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 616: e9 27 01 00 00 jmp 742 <printf+0x177> } else { putc(fd, c); 61b: 8b 45 e4 mov -0x1c(%ebp),%eax 61e: 0f be c0 movsbl %al,%eax 621: 83 ec 08 sub $0x8,%esp 624: 50 push %eax 625: ff 75 08 pushl 0x8(%ebp) 628: e8 c7 fe ff ff call 4f4 <putc> 62d: 83 c4 10 add $0x10,%esp 630: e9 0d 01 00 00 jmp 742 <printf+0x177> } } else if(state == '%'){ 635: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 639: 0f 85 03 01 00 00 jne 742 <printf+0x177> if(c == 'd'){ 63f: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 643: 75 1e jne 663 <printf+0x98> printint(fd, *ap, 10, 1); 645: 8b 45 e8 mov -0x18(%ebp),%eax 648: 8b 00 mov (%eax),%eax 64a: 6a 01 push $0x1 64c: 6a 0a push $0xa 64e: 50 push %eax 64f: ff 75 08 pushl 0x8(%ebp) 652: e8 c0 fe ff ff call 517 <printint> 657: 83 c4 10 add $0x10,%esp ap++; 65a: 83 45 e8 04 addl $0x4,-0x18(%ebp) 65e: e9 d8 00 00 00 jmp 73b <printf+0x170> } else if(c == 'x' || c == 'p'){ 663: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 667: 74 06 je 66f <printf+0xa4> 669: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 66d: 75 1e jne 68d <printf+0xc2> printint(fd, *ap, 16, 0); 66f: 8b 45 e8 mov -0x18(%ebp),%eax 672: 8b 00 mov (%eax),%eax 674: 6a 00 push $0x0 676: 6a 10 push $0x10 678: 50 push %eax 679: ff 75 08 pushl 0x8(%ebp) 67c: e8 96 fe ff ff call 517 <printint> 681: 83 c4 10 add $0x10,%esp ap++; 684: 83 45 e8 04 addl $0x4,-0x18(%ebp) 688: e9 ae 00 00 00 jmp 73b <printf+0x170> } else if(c == 's'){ 68d: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 691: 75 43 jne 6d6 <printf+0x10b> s = (char*)*ap; 693: 8b 45 e8 mov -0x18(%ebp),%eax 696: 8b 00 mov (%eax),%eax 698: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 69b: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 69f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 6a3: 75 25 jne 6ca <printf+0xff> s = "(null)"; 6a5: c7 45 f4 a7 09 00 00 movl $0x9a7,-0xc(%ebp) while(*s != 0){ 6ac: eb 1c jmp 6ca <printf+0xff> putc(fd, *s); 6ae: 8b 45 f4 mov -0xc(%ebp),%eax 6b1: 0f b6 00 movzbl (%eax),%eax 6b4: 0f be c0 movsbl %al,%eax 6b7: 83 ec 08 sub $0x8,%esp 6ba: 50 push %eax 6bb: ff 75 08 pushl 0x8(%ebp) 6be: e8 31 fe ff ff call 4f4 <putc> 6c3: 83 c4 10 add $0x10,%esp s++; 6c6: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 6ca: 8b 45 f4 mov -0xc(%ebp),%eax 6cd: 0f b6 00 movzbl (%eax),%eax 6d0: 84 c0 test %al,%al 6d2: 75 da jne 6ae <printf+0xe3> 6d4: eb 65 jmp 73b <printf+0x170> putc(fd, *s); s++; } } else if(c == 'c'){ 6d6: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 6da: 75 1d jne 6f9 <printf+0x12e> putc(fd, *ap); 6dc: 8b 45 e8 mov -0x18(%ebp),%eax 6df: 8b 00 mov (%eax),%eax 6e1: 0f be c0 movsbl %al,%eax 6e4: 83 ec 08 sub $0x8,%esp 6e7: 50 push %eax 6e8: ff 75 08 pushl 0x8(%ebp) 6eb: e8 04 fe ff ff call 4f4 <putc> 6f0: 83 c4 10 add $0x10,%esp ap++; 6f3: 83 45 e8 04 addl $0x4,-0x18(%ebp) 6f7: eb 42 jmp 73b <printf+0x170> } else if(c == '%'){ 6f9: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 6fd: 75 17 jne 716 <printf+0x14b> putc(fd, c); 6ff: 8b 45 e4 mov -0x1c(%ebp),%eax 702: 0f be c0 movsbl %al,%eax 705: 83 ec 08 sub $0x8,%esp 708: 50 push %eax 709: ff 75 08 pushl 0x8(%ebp) 70c: e8 e3 fd ff ff call 4f4 <putc> 711: 83 c4 10 add $0x10,%esp 714: eb 25 jmp 73b <printf+0x170> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 716: 83 ec 08 sub $0x8,%esp 719: 6a 25 push $0x25 71b: ff 75 08 pushl 0x8(%ebp) 71e: e8 d1 fd ff ff call 4f4 <putc> 723: 83 c4 10 add $0x10,%esp putc(fd, c); 726: 8b 45 e4 mov -0x1c(%ebp),%eax 729: 0f be c0 movsbl %al,%eax 72c: 83 ec 08 sub $0x8,%esp 72f: 50 push %eax 730: ff 75 08 pushl 0x8(%ebp) 733: e8 bc fd ff ff call 4f4 <putc> 738: 83 c4 10 add $0x10,%esp } state = 0; 73b: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 742: 83 45 f0 01 addl $0x1,-0x10(%ebp) 746: 8b 55 0c mov 0xc(%ebp),%edx 749: 8b 45 f0 mov -0x10(%ebp),%eax 74c: 01 d0 add %edx,%eax 74e: 0f b6 00 movzbl (%eax),%eax 751: 84 c0 test %al,%al 753: 0f 85 94 fe ff ff jne 5ed <printf+0x22> putc(fd, c); } state = 0; } } } 759: 90 nop 75a: c9 leave 75b: c3 ret 0000075c <free>: static Header base; static Header *freep; void free(void *ap) { 75c: 55 push %ebp 75d: 89 e5 mov %esp,%ebp 75f: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 762: 8b 45 08 mov 0x8(%ebp),%eax 765: 83 e8 08 sub $0x8,%eax 768: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 76b: a1 68 0c 00 00 mov 0xc68,%eax 770: 89 45 fc mov %eax,-0x4(%ebp) 773: eb 24 jmp 799 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 775: 8b 45 fc mov -0x4(%ebp),%eax 778: 8b 00 mov (%eax),%eax 77a: 3b 45 fc cmp -0x4(%ebp),%eax 77d: 77 12 ja 791 <free+0x35> 77f: 8b 45 f8 mov -0x8(%ebp),%eax 782: 3b 45 fc cmp -0x4(%ebp),%eax 785: 77 24 ja 7ab <free+0x4f> 787: 8b 45 fc mov -0x4(%ebp),%eax 78a: 8b 00 mov (%eax),%eax 78c: 3b 45 f8 cmp -0x8(%ebp),%eax 78f: 77 1a ja 7ab <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) 791: 8b 45 fc mov -0x4(%ebp),%eax 794: 8b 00 mov (%eax),%eax 796: 89 45 fc mov %eax,-0x4(%ebp) 799: 8b 45 f8 mov -0x8(%ebp),%eax 79c: 3b 45 fc cmp -0x4(%ebp),%eax 79f: 76 d4 jbe 775 <free+0x19> 7a1: 8b 45 fc mov -0x4(%ebp),%eax 7a4: 8b 00 mov (%eax),%eax 7a6: 3b 45 f8 cmp -0x8(%ebp),%eax 7a9: 76 ca jbe 775 <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 7ab: 8b 45 f8 mov -0x8(%ebp),%eax 7ae: 8b 40 04 mov 0x4(%eax),%eax 7b1: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 7b8: 8b 45 f8 mov -0x8(%ebp),%eax 7bb: 01 c2 add %eax,%edx 7bd: 8b 45 fc mov -0x4(%ebp),%eax 7c0: 8b 00 mov (%eax),%eax 7c2: 39 c2 cmp %eax,%edx 7c4: 75 24 jne 7ea <free+0x8e> bp->s.size += p->s.ptr->s.size; 7c6: 8b 45 f8 mov -0x8(%ebp),%eax 7c9: 8b 50 04 mov 0x4(%eax),%edx 7cc: 8b 45 fc mov -0x4(%ebp),%eax 7cf: 8b 00 mov (%eax),%eax 7d1: 8b 40 04 mov 0x4(%eax),%eax 7d4: 01 c2 add %eax,%edx 7d6: 8b 45 f8 mov -0x8(%ebp),%eax 7d9: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 7dc: 8b 45 fc mov -0x4(%ebp),%eax 7df: 8b 00 mov (%eax),%eax 7e1: 8b 10 mov (%eax),%edx 7e3: 8b 45 f8 mov -0x8(%ebp),%eax 7e6: 89 10 mov %edx,(%eax) 7e8: eb 0a jmp 7f4 <free+0x98> } else bp->s.ptr = p->s.ptr; 7ea: 8b 45 fc mov -0x4(%ebp),%eax 7ed: 8b 10 mov (%eax),%edx 7ef: 8b 45 f8 mov -0x8(%ebp),%eax 7f2: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 7f4: 8b 45 fc mov -0x4(%ebp),%eax 7f7: 8b 40 04 mov 0x4(%eax),%eax 7fa: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 801: 8b 45 fc mov -0x4(%ebp),%eax 804: 01 d0 add %edx,%eax 806: 3b 45 f8 cmp -0x8(%ebp),%eax 809: 75 20 jne 82b <free+0xcf> p->s.size += bp->s.size; 80b: 8b 45 fc mov -0x4(%ebp),%eax 80e: 8b 50 04 mov 0x4(%eax),%edx 811: 8b 45 f8 mov -0x8(%ebp),%eax 814: 8b 40 04 mov 0x4(%eax),%eax 817: 01 c2 add %eax,%edx 819: 8b 45 fc mov -0x4(%ebp),%eax 81c: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 81f: 8b 45 f8 mov -0x8(%ebp),%eax 822: 8b 10 mov (%eax),%edx 824: 8b 45 fc mov -0x4(%ebp),%eax 827: 89 10 mov %edx,(%eax) 829: eb 08 jmp 833 <free+0xd7> } else p->s.ptr = bp; 82b: 8b 45 fc mov -0x4(%ebp),%eax 82e: 8b 55 f8 mov -0x8(%ebp),%edx 831: 89 10 mov %edx,(%eax) freep = p; 833: 8b 45 fc mov -0x4(%ebp),%eax 836: a3 68 0c 00 00 mov %eax,0xc68 } 83b: 90 nop 83c: c9 leave 83d: c3 ret 0000083e <morecore>: static Header* morecore(uint nu) { 83e: 55 push %ebp 83f: 89 e5 mov %esp,%ebp 841: 83 ec 18 sub $0x18,%esp char *p; Header *hp; if(nu < 4096) 844: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 84b: 77 07 ja 854 <morecore+0x16> nu = 4096; 84d: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 854: 8b 45 08 mov 0x8(%ebp),%eax 857: c1 e0 03 shl $0x3,%eax 85a: 83 ec 0c sub $0xc,%esp 85d: 50 push %eax 85e: e8 19 fc ff ff call 47c <sbrk> 863: 83 c4 10 add $0x10,%esp 866: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 869: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 86d: 75 07 jne 876 <morecore+0x38> return 0; 86f: b8 00 00 00 00 mov $0x0,%eax 874: eb 26 jmp 89c <morecore+0x5e> hp = (Header*)p; 876: 8b 45 f4 mov -0xc(%ebp),%eax 879: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 87c: 8b 45 f0 mov -0x10(%ebp),%eax 87f: 8b 55 08 mov 0x8(%ebp),%edx 882: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 885: 8b 45 f0 mov -0x10(%ebp),%eax 888: 83 c0 08 add $0x8,%eax 88b: 83 ec 0c sub $0xc,%esp 88e: 50 push %eax 88f: e8 c8 fe ff ff call 75c <free> 894: 83 c4 10 add $0x10,%esp return freep; 897: a1 68 0c 00 00 mov 0xc68,%eax } 89c: c9 leave 89d: c3 ret 0000089e <malloc>: void* malloc(uint nbytes) { 89e: 55 push %ebp 89f: 89 e5 mov %esp,%ebp 8a1: 83 ec 18 sub $0x18,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 8a4: 8b 45 08 mov 0x8(%ebp),%eax 8a7: 83 c0 07 add $0x7,%eax 8aa: c1 e8 03 shr $0x3,%eax 8ad: 83 c0 01 add $0x1,%eax 8b0: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 8b3: a1 68 0c 00 00 mov 0xc68,%eax 8b8: 89 45 f0 mov %eax,-0x10(%ebp) 8bb: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 8bf: 75 23 jne 8e4 <malloc+0x46> base.s.ptr = freep = prevp = &base; 8c1: c7 45 f0 60 0c 00 00 movl $0xc60,-0x10(%ebp) 8c8: 8b 45 f0 mov -0x10(%ebp),%eax 8cb: a3 68 0c 00 00 mov %eax,0xc68 8d0: a1 68 0c 00 00 mov 0xc68,%eax 8d5: a3 60 0c 00 00 mov %eax,0xc60 base.s.size = 0; 8da: c7 05 64 0c 00 00 00 movl $0x0,0xc64 8e1: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 8e4: 8b 45 f0 mov -0x10(%ebp),%eax 8e7: 8b 00 mov (%eax),%eax 8e9: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 8ec: 8b 45 f4 mov -0xc(%ebp),%eax 8ef: 8b 40 04 mov 0x4(%eax),%eax 8f2: 3b 45 ec cmp -0x14(%ebp),%eax 8f5: 72 4d jb 944 <malloc+0xa6> if(p->s.size == nunits) 8f7: 8b 45 f4 mov -0xc(%ebp),%eax 8fa: 8b 40 04 mov 0x4(%eax),%eax 8fd: 3b 45 ec cmp -0x14(%ebp),%eax 900: 75 0c jne 90e <malloc+0x70> prevp->s.ptr = p->s.ptr; 902: 8b 45 f4 mov -0xc(%ebp),%eax 905: 8b 10 mov (%eax),%edx 907: 8b 45 f0 mov -0x10(%ebp),%eax 90a: 89 10 mov %edx,(%eax) 90c: eb 26 jmp 934 <malloc+0x96> else { p->s.size -= nunits; 90e: 8b 45 f4 mov -0xc(%ebp),%eax 911: 8b 40 04 mov 0x4(%eax),%eax 914: 2b 45 ec sub -0x14(%ebp),%eax 917: 89 c2 mov %eax,%edx 919: 8b 45 f4 mov -0xc(%ebp),%eax 91c: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 91f: 8b 45 f4 mov -0xc(%ebp),%eax 922: 8b 40 04 mov 0x4(%eax),%eax 925: c1 e0 03 shl $0x3,%eax 928: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 92b: 8b 45 f4 mov -0xc(%ebp),%eax 92e: 8b 55 ec mov -0x14(%ebp),%edx 931: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 934: 8b 45 f0 mov -0x10(%ebp),%eax 937: a3 68 0c 00 00 mov %eax,0xc68 return (void*)(p + 1); 93c: 8b 45 f4 mov -0xc(%ebp),%eax 93f: 83 c0 08 add $0x8,%eax 942: eb 3b jmp 97f <malloc+0xe1> } if(p == freep) 944: a1 68 0c 00 00 mov 0xc68,%eax 949: 39 45 f4 cmp %eax,-0xc(%ebp) 94c: 75 1e jne 96c <malloc+0xce> if((p = morecore(nunits)) == 0) 94e: 83 ec 0c sub $0xc,%esp 951: ff 75 ec pushl -0x14(%ebp) 954: e8 e5 fe ff ff call 83e <morecore> 959: 83 c4 10 add $0x10,%esp 95c: 89 45 f4 mov %eax,-0xc(%ebp) 95f: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 963: 75 07 jne 96c <malloc+0xce> return 0; 965: b8 00 00 00 00 mov $0x0,%eax 96a: eb 13 jmp 97f <malloc+0xe1> 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){ 96c: 8b 45 f4 mov -0xc(%ebp),%eax 96f: 89 45 f0 mov %eax,-0x10(%ebp) 972: 8b 45 f4 mov -0xc(%ebp),%eax 975: 8b 00 mov (%eax),%eax 977: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 97a: e9 6d ff ff ff jmp 8ec <malloc+0x4e> } 97f: c9 leave 980: c3 ret
Assembler/testHla.asm
Rohansi/LoonyVM
1
4554
<reponame>Rohansi/LoonyVM include 'loonyvm.inc' mov r0, 10 .while r0 >= 0 .if r0 = 5 invoke printString, msgFive .else invoke_va printf, msgCountFmt, r0 .endif dec r0 .endw jmp $ msgCountFmt: db 'n = %i', 10, 0 msgFive: db 'hi im 5', 10, 0 include 'lib/string.asm' include 'lib/printf.asm' include 'lib/term.asm'
theorems/homotopy/Pi2HSusp.agda
mikeshulman/HoTT-Agda
0
3083
{-# OPTIONS --without-K --rewriting #-} open import HoTT open import homotopy.HSpace renaming (HSpaceStructure to HSS) import homotopy.WedgeExtension as WedgeExt module homotopy.Pi2HSusp where module Pi2HSusp {i} {X : Ptd i} (gA : has-level 1 (de⊙ X)) (cA : is-connected 0 (de⊙ X)) (H-X : HSS X) where {- TODO this belongs somewhere else, but where? -} private Type=-ext : ∀ {i} {A B : Type i} (p q : A == B) → ((x : A) → coe p x == coe q x) → p == q Type=-ext p q α = ! (ua-η p) ∙ ap ua (Subtype=-out is-equiv-prop (λ= α)) ∙ ua-η q open HSS H-X open ConnectedHSpace cA H-X private A = de⊙ X e = pt X P : Susp A → Type i P x = Trunc 1 (north == x) module Codes = SuspRec A A (λ a → ua (μ-e-r-equiv a)) Codes : Susp A → Type i Codes = Codes.f Codes-level : (x : Susp A) → has-level 1 (Codes x) Codes-level = Susp-elim gA gA (λ _ → prop-has-all-paths-↓ has-level-is-prop) encode₀ : {x : Susp A} → (north == x) → Codes x encode₀ α = transport Codes α e encode : {x : Susp A} → P x → Codes x encode {x} = Trunc-rec (Codes-level x) encode₀ decode' : A → P north decode' a = [ (merid a ∙ ! (merid e)) ] abstract transport-Codes-mer : (a a' : A) → transport Codes (merid a) a' == μ a a' transport-Codes-mer a a' = coe (ap Codes (merid a)) a' =⟨ Codes.merid-β a |in-ctx (λ w → coe w a') ⟩ coe (ua (μ-e-r-equiv a)) a' =⟨ coe-β (μ-e-r-equiv a) a' ⟩ μ a a' ∎ transport-Codes-mer-e-! : (a : A) → transport Codes (! (merid e)) a == a transport-Codes-mer-e-! a = coe (ap Codes (! (merid e))) a =⟨ ap-! Codes (merid e) |in-ctx (λ w → coe w a) ⟩ coe (! (ap Codes (merid e))) a =⟨ Codes.merid-β e |in-ctx (λ w → coe (! w) a) ⟩ coe (! (ua (μ-e-r-equiv e))) a =⟨ Type=-ext (ua (μ-e-r-equiv e)) idp (λ x → coe-β _ x ∙ μ-e-l x) |in-ctx (λ w → coe (! w) a) ⟩ coe (! idp) a ∎ abstract encode-decode' : (a : A) → encode (decode' a) == a encode-decode' a = transport Codes (merid a ∙ ! (merid e)) e =⟨ transp-∙ {B = Codes} (merid a) (! (merid e)) e ⟩ transport Codes (! (merid e)) (transport Codes (merid a) e) =⟨ transport-Codes-mer a e ∙ μ-e-r a |in-ctx (λ w → transport Codes (! (merid e)) w) ⟩ transport Codes (! (merid e)) a =⟨ transport-Codes-mer-e-! a ⟩ a ∎ abstract homomorphism : (a a' : A) → Path {A = Trunc 1 (north == south)} [ merid (μ a a' ) ] [ merid a' ∙ ! (merid e) ∙ merid a ] homomorphism = WedgeExt.ext args where args : WedgeExt.args {a₀ = e} {b₀ = e} args = record {m = -1; n = -1; cA = cA; cB = cA; P = λ a a' → (_ , Trunc-level {n = 1} _ _); f = λ a → ap [_] $ merid (μ a e) =⟨ ap merid (μ-e-r a) ⟩ merid a =⟨ ap (λ w → w ∙ merid a) (! (!-inv-r (merid e))) ∙ ∙-assoc (merid e) (! (merid e)) (merid a) ⟩ merid e ∙ ! (merid e) ∙ merid a ∎; g = λ a' → ap [_] $ merid (μ e a') =⟨ ap merid (μ-e-l a') ⟩ merid a' =⟨ ! (∙-unit-r (merid a')) ∙ ap (λ w → merid a' ∙ w) (! (!-inv-l (merid e))) ⟩ merid a' ∙ ! (merid e) ∙ merid e ∎ ; p = ap (λ {(p₁ , p₂) → ap [_] $ merid (μ e e) =⟨ p₁ ⟩ merid e =⟨ p₂ ⟩ merid e ∙ ! (merid e) ∙ merid e ∎}) (pair×= (ap (λ x → ap merid x) (! μ-coh)) (coh (merid e)))} where coh : {B : Type i} {b b' : B} (p : b == b') → ap (λ w → w ∙ p) (! (!-inv-r p)) ∙ ∙-assoc p (! p) p == ! (∙-unit-r p) ∙ ap (λ w → p ∙ w) (! (!-inv-l p)) coh idp = idp decode : {x : Susp A} → Codes x → P x decode {x} = Susp-elim {P = λ x → Codes x → P x} decode' (λ a → [ merid a ]) (λ a → ↓-→-from-transp (λ= $ STS a)) x where abstract STS : (a a' : A) → transport P (merid a) (decode' a') == [ merid (transport Codes (merid a) a') ] STS a a' = transport P (merid a) [ merid a' ∙ ! (merid e) ] =⟨ transport-Trunc (north ==_) (merid a) _ ⟩ [ transport (north ==_) (merid a) (merid a' ∙ ! (merid e)) ] =⟨ ap [_] (transp-cst=idf {A = Susp A} (merid a) _) ⟩ [ (merid a' ∙ ! (merid e)) ∙ merid a ] =⟨ ap [_] (∙-assoc (merid a') (! (merid e)) (merid a)) ⟩ [ merid a' ∙ ! (merid e) ∙ merid a ] =⟨ ! (homomorphism a a') ⟩ [ merid (μ a a') ] =⟨ ap ([_] ∘ merid) (! (transport-Codes-mer a a')) ⟩ [ merid (transport Codes (merid a) a') ] ∎ abstract decode-encode : {x : Susp A} (tα : P x) → decode {x} (encode {x} tα) == tα decode-encode {x} = Trunc-elim {P = λ tα → decode {x} (encode {x} tα) == tα} (λ _ → =-preserves-level Trunc-level) (J (λ y p → decode {y} (encode {y} [ p ]) == [ p ]) (ap [_] (!-inv-r (merid e)))) main-lemma-eq : Trunc 1 (north' A == north) ≃ A main-lemma-eq = equiv encode decode' encode-decode' decode-encode ⊙main-lemma : ⊙Trunc 1 (⊙Ω (⊙Susp X)) ⊙≃ X ⊙main-lemma = ≃-to-⊙≃ main-lemma-eq idp abstract main-lemma-iso : Ω^S-group 0 (⊙Trunc 1 (⊙Ω (⊙Susp X))) Trunc-level ≃ᴳ Ω^S-group 0 (⊙Trunc 1 X) Trunc-level main-lemma-iso = (record {f = f; pres-comp = pres-comp} , ie) where h : ⊙Trunc 1 (⊙Ω (⊙Susp X)) ⊙→ ⊙Trunc 1 X h = (λ x → [ encode x ]) , idp f : Ω (⊙Trunc 1 (⊙Ω (⊙Susp X))) → Ω (⊙Trunc 1 X) f = Ω-fmap h pres-comp : (p q : Ω^ 1 (⊙Trunc 1 (⊙Ω (⊙Susp X)))) → f (Ω^S-∙ 0 p q) == Ω^S-∙ 0 (f p) (f q) pres-comp = Ω^S-fmap-∙ 0 h ie : is-equiv f ie = Ω^-isemap 1 h (snd $ ((unTrunc-equiv A gA)⁻¹ ∘e main-lemma-eq)) abstract π₂-Susp : πS 1 (⊙Susp X) ≃ᴳ πS 0 X π₂-Susp = πS 1 (⊙Susp X) ≃ᴳ⟨ πS-Ω-split-iso 0 (⊙Susp X) ⟩ πS 0 (⊙Ω (⊙Susp X)) ≃ᴳ⟨ Ω^S-group-Trunc-fuse-diag-iso 0 (⊙Ω (⊙Susp X)) ⁻¹ᴳ ⟩ Ω^S-group 0 (⊙Trunc 1 (⊙Ω (⊙Susp X))) Trunc-level ≃ᴳ⟨ main-lemma-iso ⟩ Ω^S-group 0 (⊙Trunc 1 X) Trunc-level ≃ᴳ⟨ Ω^S-group-Trunc-fuse-diag-iso 0 X ⟩ πS 0 X ≃ᴳ∎
unittests/ASM/pslldq.asm
cobalt2727/FEX
628
27725
<gh_stars>100-1000 %ifdef CONFIG { "Match": "All", "RegData": { "XMM0": ["0xadbeefbad0dad100", "0x41414141414141de"], "XMM1": ["0x41deadbeefbad0da", "0x0041414141414141"] } } %endif mov rdx, 0xe8000000 mov rax, 0xDEADBEEFBAD0DAD1 mov rcx, 0x4141414141414141 mov [rdx], rax mov [rdx + 8], rcx movups xmm0, [rdx] pslldq xmm0, 1 movups xmm1, [rdx] psrldq xmm1, 1 hlt
programs/oeis/131/A131755.asm
karttu/loda
1
246207
; A131755: a(n) = floor of the average of distances between consecutive positive divisors of n. Also, a(n) = floor((n-1)/(d(n)-1)), where d(n) = A000005(n). ; 1,2,1,4,1,6,2,4,3,10,2,12,4,4,3,16,3,18,3,6,7,22,3,12,8,8,5,28,4,30,6,10,11,11,4,36,12,12,5,40,5,42,8,8,15,46,5,24,9,16,10,52,7,18,7,18,19,58,5,60,20,12,10,21,9,66,13,22,9,70,6,72,24,14,15,25,11,78,8 add $0,1 mov $1,$0 cal $0,5 ; d(n) (also called tau(n) or sigma_0(n)), the number of divisors of n. sub $0,1 div $1,$0
data/pokemon/base_stats/sinnoh/riolu.asm
Dev727/ancientplatinum
0
240831
db 0 ; 447 DEX NO db 40, 70, 40, 60, 35, 40 ; hp atk def spd sat sdf db FIGHTING, FIGHTING ; type db 75 ; catch rate db 72 ; base exp db NO_ITEM, NO_ITEM ; items db GENDER_F12_5 ; gender ratio db 100 ; unknown 1 db 25 ; step cycles to hatch db 5 ; unknown 2 INCBIN "gfx/pokemon/sinnoh/riolu/front.dimensions" db 0, 0, 0, 0 ; padding db GROWTH_MEDIUM_SLOW ; growth rate dn EGG_NONE, EGG_NONE ; egg groups ; tm/hm learnset tmhm ; end
alloy4fun_models/trainstlt/models/13/ktarPcc37MrTky56p.als
Kaixi26/org.alloytools.alloy
0
876
open main pred idktarPcc37MrTky56p_prop14 { always ( all t:Train | (some t.pos and one (t.pos.signal :>Green) and no t.pos' )implies (t.pos'.signal in Signal-Green) ) } pred __repair { idktarPcc37MrTky56p_prop14 } check __repair { idktarPcc37MrTky56p_prop14 <=> prop14o }
src/main/fragment/mos6502-common/pbuc1_derefidx_(_deref_pbuz1)=_inc_pbuc1_derefidx_(_deref_pbuz1).asm
jbrandwood/kickc
2
18427
<reponame>jbrandwood/kickc ldy #0 lda ({z1}),y tax inc {c1},x
libsrc/_DEVELOPMENT/math/float/math32/c/sccz80/cm32_sccz80_fsmul2.asm
jpoikela/z88dk
640
83980
<reponame>jpoikela/z88dk SECTION code_fp_math32 PUBLIC cm32_sccz80_fsmul2 EXTERN cm32_sccz80_fsread1, m32_fsmul2_fastcall cm32_sccz80_fsmul2: call cm32_sccz80_fsread1 jp m32_fsmul2_fastcall
src/asis/a4g-vcheck.adb
My-Colaborations/dynamo
15
8177
------------------------------------------------------------------------------ -- -- -- ASIS-for-GNAT IMPLEMENTATION COMPONENTS -- -- -- -- A 4 G . V C H E C K -- -- -- -- B o d y -- -- -- -- Copyright (C) 1995-2012, 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.adaccore.com). -- -- -- ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; with GNAT.OS_Lib; use GNAT.OS_Lib; with Asis.Compilation_Units; use Asis.Compilation_Units; with Asis.Elements; use Asis.Elements; with Asis.Exceptions; use Asis.Exceptions; with Asis.Implementation; use Asis.Implementation; with Asis.Set_Get; use Asis.Set_Get; with Asis.Text.Set_Get; use Asis.Text.Set_Get; with A4G.A_Debug; use A4G.A_Debug; with A4G.A_Opt; use A4G.A_Opt; with A4G.A_Output; use A4G.A_Output; with Fname; use Fname; with Gnatvsn; use Gnatvsn; with Lib; use Lib; with Namet; use Namet; with Output; use Output; with Sinput; use Sinput; with Types; use Types; package body A4G.Vcheck is ---------------- -- Local Data -- ---------------- Recursion_Count : Natural := 0; -- Used in Report_ASIS_Bug to prevent too many runaway recursion steps to -- be done if something bad happens while reporting an ASIS bug. The -- problem is that ASIS queries are used to form the diagnostic message, -- and some circularities are possible here. Max_Recursions_Allowed : constant Positive := 1; -- This constant limits the number of recursion calls of Report_ASIS_Bug. -- When this limit is achieved, we try once again, but with turning OFF -- including the text position into Element's debug image. If this last -- step also results in resursive call to Report_ASIS_Bug, we -- unconditionally do OS_Abort. -- -- Until we finish the revising of all the exception handlers in the -- ASIS implementation code, we limit the recursion depth by one, because -- some circularities are possible in the routines that are not "terminal" -- ASIS queries but which make use of ASIS queries and contain exception -- handlers forming or modifying diagnostic info. LT : String renames A4G.A_Types.ASIS_Line_Terminator; Current_Pos : Natural range 0 .. Diagnosis_String_Length; -- The pointer to the last filled position in the logical text line -- in the Diagnosis buffer ----------------------- -- Local subprograms -- ----------------------- procedure Add_Str (Str : String); -- This procedure is similar to Add, but it tries to keep the lengths -- of strings stores in Diagnosis_Buffer under 76 characters. Str should -- not contain any character(s) caused line breaks. If (a part of) the -- argument can be added to the current Diagnosis string and if this string -- already contains some text, (a part of) the argument is separated by a -- space character. procedure Close_Str; -- Closes a current string in the Diagnosis buffer procedure Reset_Diagnosis_Buffer; -- Resets the Diagnosis buffer -- ??? The diagnosis buffer needs a proper documentation!!!! procedure Set_Error_Status_Internal (Status : Error_Kinds := Not_An_Error; Diagnosis : String := Nil_Asis_String; Query : String := Nil_Asis_String); -- This procedure allows to avoid dynamicaly allocated strings in calls -- to Set_Error_Status in Check_Validity. Check_Validity is called in -- all ASIS structural and semantic queries, so a dynamic string as an -- argument of internal call results in significant performance penalties. -- (See E705-008). --------- -- Add -- --------- procedure Add (Phrase : String) is begin if Diagnosis_Len = Max_Diagnosis_Length then return; end if; for I in Phrase'Range loop Diagnosis_Len := Diagnosis_Len + 1; Diagnosis_Buffer (Diagnosis_Len) := Phrase (I); if Diagnosis_Len = Max_Diagnosis_Length then exit; end if; end loop; end Add; ------------- -- Add_Str -- ------------- procedure Add_Str (Str : String) is First_Idx : Natural := Str'First; Last_Idx : Natural := First_Idx; -- Indexes of the first and last subwords in Str Word_Len : Positive; Available : Positive; Str_Last : constant Positive := Str'Last; begin while Last_Idx < Str_Last loop Last_Idx := Str_Last; for J in First_Idx .. Str_Last loop if Str (J) = ' ' then Last_Idx := J - 1; exit; end if; end loop; Word_Len := Last_Idx - First_Idx; if Current_Pos = 0 then Available := Diagnosis_String_Length; else Available := Diagnosis_String_Length - (Current_Pos + 1); end if; if Word_Len <= Available then if Current_Pos > 0 then Add (" "); Current_Pos := Current_Pos + 1; end if; Add (Str (First_Idx .. Last_Idx)); Current_Pos := Current_Pos + Word_Len; else Add (ASIS_Line_Terminator); Add (Str (First_Idx .. Last_Idx)); Current_Pos := Word_Len; end if; if Current_Pos >= Diagnosis_String_Length - ASIS_Line_Terminator'Length then Add (ASIS_Line_Terminator); Current_Pos := 0; end if; First_Idx := Last_Idx + 2; end loop; end Add_Str; ---------------------- -- Check_Validity -- ---------------------- procedure Check_Validity (Compilation_Unit : Asis.Compilation_Unit; Query : String) is begin if Not_Nil (Compilation_Unit) and then not Valid (Compilation_Unit) then Set_Error_Status_Internal (Status => Value_Error, Diagnosis => "Invalid Unit value in ", Query => Query); raise ASIS_Inappropriate_Compilation_Unit; end if; end Check_Validity; procedure Check_Validity (Element : Asis.Element; Query : String) is begin if Kind (Element) /= Not_An_Element and then not Valid (Element) then Set_Error_Status_Internal (Status => Value_Error, Diagnosis => "Invalid Element value in ", Query => Query); raise ASIS_Inappropriate_Element; end if; end Check_Validity; procedure Check_Validity (Line : Asis.Text.Line; Query : String) is begin if not Asis.Text.Is_Nil (Line) and then not Valid (Line) then Set_Error_Status_Internal (Status => Value_Error, Diagnosis => "Invalid Line value in ", Query => Query); raise ASIS_Inappropriate_Line; end if; end Check_Validity; procedure Check_Validity (Context : Asis.Context; Query : String) is begin if not Valid (Context) then Set_Error_Status_Internal (Status => Value_Error, Diagnosis => "Unopened Context argument in ", Query => Query); raise ASIS_Inappropriate_Context; end if; end Check_Validity; --------------- -- Close_Str -- --------------- procedure Close_Str is begin Add (ASIS_Line_Terminator); Current_Pos := 0; end Close_Str; --------------------- -- Report_ASIS_Bug -- --------------------- procedure Report_ASIS_Bug (Query_Name : String; Ex : Exception_Occurrence; Arg_Element : Asis.Element := Nil_Element; Arg_Element_2 : Asis.Element := Nil_Element; Arg_CU : Asis.Compilation_Unit := Nil_Compilation_Unit; Arg_CU_2 : Asis.Compilation_Unit := Nil_Compilation_Unit; Arg_Line : Asis.Text.Line := Nil_Line; Arg_Span : Asis.Text.Span := Nil_Span; Bool_Par_ON : Boolean := False; Context_Par : Boolean := False -- What else??? ) is Is_GPL_Version : constant Boolean := Gnatvsn.Build_Type = GPL; Is_FSF_Version : constant Boolean := Gnatvsn.Build_Type = FSF; procedure Repeat_Char (Char : Character; Col : Nat; After : Character); -- This procedure is similar to Comperr.Repeat_Char, but it does nothing -- if Generate_Bug_Box is set OFF. -- -- Output Char until current column is at or past Col, and then output -- the character given by After (if column is already past Col on entry, -- then the effect is simply to output the After character). procedure End_Line; -- This procedure is similar to Comperr.End_Line, but it does nothing -- if Generate_Bug_Box is set OFF. -- -- Add blanks up to column 76, and then a final vertical bar procedure Write_Char (C : Character); procedure Write_Str (S : String); procedure Write_Eol; -- These three subprograms are similar to the procedures with the same -- names from the GNAT Output package except that they do nothing in -- case if Generate_Bug_Box is set OFF. procedure End_Line is begin if Generate_Bug_Box then Repeat_Char (' ', 76, '|'); Write_Eol; end if; end End_Line; procedure Repeat_Char (Char : Character; Col : Nat; After : Character) is begin if Generate_Bug_Box then while Column < Col loop Write_Char (Char); end loop; Write_Char (After); end if; end Repeat_Char; procedure Write_Char (C : Character) is begin if Generate_Bug_Box then Output.Write_Char (C); end if; end Write_Char; procedure Write_Str (S : String) is begin if Generate_Bug_Box then Output.Write_Str (S); end if; end Write_Str; procedure Write_Eol is begin if Generate_Bug_Box then Output.Write_Eol; end if; end Write_Eol; begin if Recursion_Count >= Max_Recursions_Allowed then if Debug_Flag_I then -- We can not do anything reasonable any more: OS_Abort; else -- We will try the last time with turning off span computing -- as a part of debug output Debug_Flag_I := True; -- It is not safe to put this flag OFF (it it was set OFF before -- the call to Report_ASIS_Bug), because it may be some -- circularities (see the comment for Max_Recursions_Allowed -- global variable). We may want to revise this decision when -- the revision of all the exception handlers in the ASIS code -- is complete. end if; end if; Recursion_Count := Recursion_Count + 1; -- This procedure is called in case of an ASIS implementation bug, so -- we do not care very much about efficiency Set_Standard_Error; -- Generate header for bug box Write_Eol; Write_Char ('+'); Repeat_Char ('=', 29, 'A'); Write_Str ("SIS BUG DETECTED"); Repeat_Char ('=', 76, '+'); Write_Eol; -- Output ASIS version identification Write_Str ("| "); Write_Str (To_String (ASIS_Implementor_Version)); -- Output the exception info: Write_Str (" "); Write_Str (Exception_Name (Ex)); Write_Char (' '); Write_Str (Exception_Message (Ex)); End_Line; -- Output the query name and call details Write_Str ("| when processing "); Write_Str (Query_Name); if Bool_Par_ON then Write_Str (" (Boolean par => ON)"); elsif Context_Par then Write_Str (" (with Context parameter)"); end if; End_Line; -- Add to ASIS Diagnosis: Reset_Diagnosis_Buffer; Add_Str ("ASIS internal implementation error detected for"); Close_Str; Add_Str (Query_Name); if Bool_Par_ON then Add_Str ("(Boolean par => ON)"); elsif Context_Par then Add_Str ("(with Context parameter)"); end if; Close_Str; -- Add information about the argument of the call (bug box) if not Is_Nil (Arg_Element) or else not Is_Nil (Arg_CU) then Write_Str ("| "); Write_Str ("called with "); if not Is_Nil (Arg_Element) then Write_Str (Int_Kind (Arg_Element)'Img); Write_Str (" Element"); End_Line; elsif not Is_Nil (Arg_CU) then Write_Str (Kind (Arg_CU)'Img); Write_Str (" Compilation Unit"); End_Line; end if; Write_Str ("| (for full details see the debug image after the box)"); End_Line; end if; -- Add information about the argument of the call (Diagnosis string) if not Is_Nil (Arg_Element) or else not Is_Nil (Arg_CU) then Add_Str ("called with"); Close_Str; if not Is_Nil (Arg_Element) then Debug_String (Arg_Element, No_Abort => True); Add (Debug_Buffer (1 .. Debug_Buffer_Len)); elsif not Is_Nil (Arg_CU) then Debug_String (Arg_CU, No_Abort => True); Add (Debug_Buffer (1 .. Debug_Buffer_Len)); end if; Close_Str; -- Note, that if we do not generate the bug box, in case if the query -- have two Element or CU parameters, the information about the -- second parameter is missed in the ASIS Diagnosis end if; Add_Str (Exception_Name (Ex)); Add (" "); Add_Str (Exception_Message (Ex)); if not Generate_Bug_Box then Close_Str; Add_Str ("For more details activate the ASIS bug box"); end if; -- Completing the bug box if Is_FSF_Version then Write_Str ("| Please submit a bug report; see" & " http://gcc.gnu.org/bugs.html."); End_Line; elsif Is_GPL_Version then Write_Str ("| Please submit a bug report by email " & "to <EMAIL>."); End_Line; Write_Str ("| GAP members can alternatively use GNAT Tracker:"); End_Line; Write_Str ("| http://www.adacore.com/ " & "section 'send a report'."); End_Line; Write_Str ("| See gnatinfo.txt for full info on procedure " & "for submitting bugs."); End_Line; else Write_Str ("| Please submit a bug report using GNAT Tracker:"); End_Line; Write_Str ("| http://www.adacore.com/gnattracker/ " & "section 'send a report'."); End_Line; Write_Str ("| alternatively submit a bug report by email " & "to <EMAIL>,"); End_Line; Write_Str ("| including your customer number #nnn " & "in the subject line."); End_Line; end if; Write_Str ("| Use a subject line meaningful to you and us to track the bug."); End_Line; Write_Str ("| Include the entire contents of this bug " & "box and the ASIS debug info"); End_Line; Write_Str ("| in the report."); End_Line; Write_Str ("| Include the exact list of the parameters of the ASIS queries "); End_Line; Write_Str ("| Asis.Implementation.Initialize and " & "Asis.Ada_Environments.Associate"); End_Line; Write_Str ("| from the ASIS application for which the bug is detected"); End_Line; Write_Str ("| Also include sources listed below in gnatchop format"); End_Line; Write_Str ("| (concatenated together with no headers between files)."); End_Line; if not Is_FSF_Version then Write_Str ("| Use plain ASCII or MIME attachment."); End_Line; end if; Write_Str ("| NOTE: ASIS bugs may be submitted to <EMAIL>"); End_Line; -- Complete output of bug box Write_Char ('+'); Repeat_Char ('=', 76, '+'); Write_Eol; Write_Eol; -- Argument debug image(s) if not Is_Nil (Arg_Element) or else not Is_Nil (Arg_CU) or else not Is_Nil (Arg_Line) then Write_Str ("The debug image(s) of the argument(s) of the call"); Write_Eol; if not (Is_Nil (Arg_Element_2) and then Is_Nil (Arg_CU_2)) then Write_Str ("***First argument***"); Write_Eol; end if; Write_Str (Debug_Buffer (1 .. Debug_Buffer_Len)); Write_Eol; Write_Eol; if not Is_Nil (Arg_Element_2) then Debug_String (Arg_Element_2, No_Abort => True); elsif not Is_Nil (Arg_CU_2) then Debug_String (Arg_CU_2, No_Abort => True); end if; if not (Is_Nil (Arg_Element_2) and then Is_Nil (Arg_CU_2)) then Write_Str ("***Second argument***"); Write_Eol; Write_Str (Debug_Buffer (1 .. Debug_Buffer_Len)); Write_Eol; Write_Eol; end if; if not Is_Nil (Arg_Line) then if not Is_Nil (Arg_Element) then Write_Str ("***Line argument***"); Write_Eol; end if; if Recursion_Count >= Max_Recursions_Allowed and then Debug_Flag_I then -- There is a real possibility that we can not output the -- debug image of the argument line because of the bug being -- reported: Write_Str ("Line image can not be reported "); Write_Str ("because of the internal error"); Write_Eol; Write_Eol; else Write_Str (To_String (Debug_Image (Arg_Line))); Write_Eol; Write_Eol; end if; end if; if not Is_Nil (Arg_Span) then if not Is_Nil (Arg_Element) then Write_Str ("***Span argument***"); Write_Eol; end if; Write_Str ("First_Line =>"); Write_Str (Arg_Span.First_Line'Img); Write_Eol; Write_Str ("First_Column =>"); Write_Str (Arg_Span.First_Column'Img); Write_Eol; Write_Str ("Last_Line =>"); Write_Str (Arg_Span.Last_Line'Img); Write_Eol; Write_Str ("Last_Column =>"); Write_Str (Arg_Span.Last_Column'Img); Write_Eol; Write_Eol; end if; end if; Write_Str ("Please include these source files with error report"); Write_Eol; Write_Str ("Note that list may not be accurate in some cases, "); Write_Eol; Write_Str ("so please double check that the problem can still "); Write_Eol; Write_Str ("be reproduced with the set of files listed."); Write_Eol; Write_Eol; if Generate_Bug_Box then for U in Main_Unit .. Last_Unit loop begin if not Is_Internal_File_Name (File_Name (Source_Index (U))) then Write_Name (Full_File_Name (Source_Index (U))); Write_Eol; end if; -- No point in double bug box if we blow up trying to print -- the list of file names! Output informative msg and quit. exception when others => Write_Str ("list may be incomplete"); exit; end; end loop; end if; Write_Eol; Set_Standard_Output; if Keep_Going then -- Raise ASIS_Failed and go ahead (the Diagnosis is already formed) Status_Indicator := Unhandled_Exception_Error; Recursion_Count := Recursion_Count - 1; raise ASIS_Failed; else OS_Exit (1); end if; exception when ASIS_Failed => raise; when Internal_Ex : others => Write_Eol; Write_Str ("The diagnostis can not be completed because of " & "the following error:"); Write_Eol; Write_Str (Exception_Name (Ex)); Write_Char (' '); Write_Str (Exception_Message (Ex)); Write_Eol; Close_Str; Add_Str ("The diagnostis can not be completed because of " & "the following error:"); Close_Str; Add_Str (Exception_Name (Ex)); Add (" "); Add_Str (Exception_Message (Ex)); Add_Str (Exception_Information (Internal_Ex)); Set_Standard_Output; if Keep_Going then Status_Indicator := Unhandled_Exception_Error; -- Debug_Flag_I := Skip_Span_In_Debug_Image; raise ASIS_Failed; else OS_Exit (1); end if; end Report_ASIS_Bug; ---------------------------- -- Reset_Diagnosis_Buffer -- ---------------------------- procedure Reset_Diagnosis_Buffer is begin Diagnosis_Len := 0; Current_Pos := 0; end Reset_Diagnosis_Buffer; ----------------------------- -- Raise_ASIS_Failed (new) -- ----------------------------- procedure Raise_ASIS_Failed (Diagnosis : String; Argument : Asis.Element := Nil_Element; Stat : Asis.Errors.Error_Kinds := Internal_Error; Bool_Par : Boolean := False; Internal_Bug : Boolean := True) is begin Diagnosis_Len := 0; if Internal_Bug then Add ("Internal implementation error: "); end if; Add (Diagnosis); if Bool_Par then Add (LT & "(Boolean parameter is TRUE)"); end if; if not Is_Nil (Argument) then Add (LT & "when processing "); Debug_String (Argument); Add (Debug_Buffer (1 .. Debug_Buffer_Len)); end if; Status_Indicator := Stat; raise ASIS_Failed; end Raise_ASIS_Failed; ------------------------------------- -- Raise_ASIS_Failed_In_Traversing -- ------------------------------------- procedure Raise_ASIS_Failed_In_Traversing (Start_Element : Asis.Element; Failure_At : Asis.Element; Pre_Op : Boolean; Exception_Info : String) is begin Diagnosis_Len := 0; Add ("Traversal failure. Tarversal started at:" & LT); Debug_String (Start_Element); Add (Debug_Buffer (1 .. Debug_Buffer_Len) & LT); if Pre_Op then Add ("Pre-operation"); else Add ("Post-operation"); end if; Add (" failed at:" & LT); Debug_String (Failure_At); Add (Debug_Buffer (1 .. Debug_Buffer_Len)); Add (LT & Exception_Info); Status_Indicator := Unhandled_Exception_Error; raise ASIS_Failed; end Raise_ASIS_Failed_In_Traversing; --------------------------------------------------------------- procedure Raise_ASIS_Inappropriate_Compilation_Unit (Diagnosis : String) is begin Set_Error_Status (Status => Value_Error, Diagnosis => "Inappropriate Unit Kind in " & Diagnosis); raise ASIS_Inappropriate_Compilation_Unit; end Raise_ASIS_Inappropriate_Compilation_Unit; ---------------------------------------------------------------------- procedure Raise_ASIS_Inappropriate_Element (Diagnosis : String; Wrong_Kind : Internal_Element_Kinds; Status : Error_Kinds := Value_Error) is begin Set_Error_Status (Status => Status, Diagnosis => "Inappropriate Element Kind in " & Diagnosis & " (" & Wrong_Kind'Img & ")"); raise ASIS_Inappropriate_Element; end Raise_ASIS_Inappropriate_Element; ---------------------------------------------------------------------- procedure Raise_ASIS_Inappropriate_Line_Number (Diagnosis : String; Status : Error_Kinds := Value_Error) is begin Set_Error_Status (Status => Status, Diagnosis => "Inappropriate Lines/Span Kind in " & Diagnosis); raise ASIS_Inappropriate_Line_Number; end Raise_ASIS_Inappropriate_Line_Number; ---------------------------------------------------------------------- procedure Not_Implemented_Yet (Diagnosis : String) is begin Set_Error_Status (Status => Not_Implemented_Error, Diagnosis => "Not Implemented Query:" & LT & Diagnosis); raise ASIS_Failed; end Not_Implemented_Yet; -------------------------------------------------------------------- procedure Set_Error_Status (Status : Error_Kinds := Not_An_Error; Diagnosis : String := Nil_Asis_String) is begin if Status = Not_An_Error and then Diagnosis /= Nil_Asis_String then Status_Indicator := Internal_Error; Diagnosis_Len := Incorrect_Setting_Len + ASIS_Line_Terminator_Len; Diagnosis_Buffer (1 .. Diagnosis_Len) := Incorrect_Setting & ASIS_Line_Terminator; raise ASIS_Failed; end if; Status_Indicator := Status; Diagnosis_Len := Diagnosis'Length; Diagnosis_Buffer (1 .. Diagnosis_Len) := Diagnosis; end Set_Error_Status; procedure Set_Error_Status_Internal (Status : Error_Kinds := Not_An_Error; Diagnosis : String := Nil_Asis_String; Query : String := Nil_Asis_String) is begin Set_Error_Status (Status => Status, Diagnosis => Diagnosis & Query); end Set_Error_Status_Internal; ---------------------------------------------------------------------- -------------------------- -- Add_Call_Information -- -------------------------- procedure Add_Call_Information (Outer_Call : String; Argument : Asis.Element := Nil_Element; Bool_Par : Boolean := False) is begin Add (LT & "called in " & Outer_Call); if Bool_Par then Add (LT & "(Boolean parameter is TRUE)"); end if; if not Is_Nil (Argument) then Add (LT & "with the argument : "); Debug_String (Argument); Add (Debug_Buffer (1 .. Debug_Buffer_Len)); end if; end Add_Call_Information; end A4G.Vcheck;
_build/dispatcher/jmp_ippsAES_CCMGetSize_fd640cbd.asm
zyktrcn/ippcp
1
169448
extern m7_ippsAES_CCMGetSize:function extern n8_ippsAES_CCMGetSize:function extern y8_ippsAES_CCMGetSize:function extern e9_ippsAES_CCMGetSize:function extern l9_ippsAES_CCMGetSize:function extern n0_ippsAES_CCMGetSize:function extern k0_ippsAES_CCMGetSize:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsAES_CCMGetSize .Larraddr_ippsAES_CCMGetSize: dq m7_ippsAES_CCMGetSize dq n8_ippsAES_CCMGetSize dq y8_ippsAES_CCMGetSize dq e9_ippsAES_CCMGetSize dq l9_ippsAES_CCMGetSize dq n0_ippsAES_CCMGetSize dq k0_ippsAES_CCMGetSize segment .text global ippsAES_CCMGetSize:function (ippsAES_CCMGetSize.LEndippsAES_CCMGetSize - ippsAES_CCMGetSize) .Lin_ippsAES_CCMGetSize: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsAES_CCMGetSize: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsAES_CCMGetSize] mov r11, qword [r11+rax*8] jmp r11 .LEndippsAES_CCMGetSize:
programs/oeis/132/A132728.asm
jmorken/loda
1
24419
<reponame>jmorken/loda<gh_stars>1-10 ; A132728: Triangle T(n, k) = 4 - 3*(-1)^k, read by rows. ; 1,1,7,1,7,1,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1,7,1 cal $0,25675 ; Exponent of 8 (value of j) in n-th number of form 7^i*8^j. mod $0,2 mov $1,$0 mul $1,6 add $1,1
data/baseStats/magmar.asm
etdv-thevoid/pokemon-rgb-enhanced
1
1626
db MAGMAR ; pokedex id db 65 ; base hp db 95 ; base attack db 57 ; base defense db 93 ; base speed db 85 ; base special db FIRE ; species type 1 db FIRE ; species type 2 db 45 ; catch rate db 167 ; base exp yield INCBIN "pic/gsmon/magmar.pic",0,1 ; 66, sprite dimensions dw MagmarPicFront dw MagmarPicBack ; attacks known at lvl 0 db SMOG db 0 db 0 db 0 db 0 ; growth rate ; learnset tmlearn 1,5,6,8 tmlearn 9,10,15 tmlearn 20 tmlearn 31,32 tmlearn 33,34,35,37,38 tmlearn 44 tmlearn 50,54 db BANK(MagmarPicFront)
oeis/048/A048297.asm
neoneye/loda-programs
11
13074
<filename>oeis/048/A048297.asm ; A048297: Coefficients in power series expansion over GF(2)[ X^(-1) ] of continued fraction [ 0, X, X^2, X^4, X^8, X^16, ... ]. ; Submitted by <NAME> ; 1,4,7,13,16,25,28,31,49,52,55,61,64,97,100,103,109,112,121,124,127,193,196,199,205,208,217,220,223,241,244,247,253,256,385,388,391,397,400,409,412,415,433,436,439,445,448,481,484,487,493,496,505 seq $0,22340 ; Even Fibbinary numbers (A003714); also 2*Fibbinary(n). div $0,2 mul $0,3 add $0,1
alloy4fun_models/trashltl/models/17/8fndohF3LJijw84Rf.als
Kaixi26/org.alloytools.alloy
0
795
<reponame>Kaixi26/org.alloytools.alloy open main pred id8fndohF3LJijw84Rf_prop18 { always all f:File | f in Protected until f not in Trash } pred __repair { id8fndohF3LJijw84Rf_prop18 } check __repair { id8fndohF3LJijw84Rf_prop18 <=> prop18o }
hello.adb
am1006/toolchain
19
20224
with Ada.Text_IO; use Ada.Text_IO; procedure Hello is begin Put_Line ("Hello World!"); end Hello;
src/tilda/grammar/TildaSQL.g4
generaldevelopers/Tilda
0
5448
/* =========================================================================== * Copyright (C) 2016 CapsicoHealth Inc. * * 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. */ grammar TildaSQL; where : expr EOF ; expr : bool_expr | bin_expr | between_expr | expr_sub ; expr_sub : '(' expr ')' ; bool_expr : l_expr=bool_expr op=bool_op r_expr=bool_expr | s_expr=bin_expr | isnull_expr | bool_expr_sub ; bool_op : K_AND K_NOT? | K_OR K_NOT? ; bool_expr_sub : '(' bool_expr ')' ; bin_expr : bin_expr_lhs bin_op (column | arithmetic_expr_base) | bin_expr_lhs (K_NOT)? K_IN value_list ; bin_expr_lhs : column (('+' | '||') column)* ; value_list : '(' value (',' value)* ')' ; bin_op: K_LT | K_LTE | K_GT | K_GTE | K_EQ | K_NEQ | (K_NOT)? K_LIKE; arithmetic_expr_base : arithmetic_expr ; arithmetic_expr : arithmetic_expr arithmetic_op_mul arithmetic_expr # ArithmeticExpr | arithmetic_expr arithmetic_op_add arithmetic_expr # ArithmeticExpr | value # ArithmeticExprVal | arithmetic_expr_sub # ArithmeticExprSub ; arithmetic_expr_sub : '(' s_expr=arithmetic_expr ')' ; arithmetic_op_add: '+' | K_MINUS; arithmetic_op_mul: '*' | K_DIV; isnull_expr : column isnull_op ; isnull_op : K_IS K_NOT? K_NULL ; between_expr : col=column op=between_op val1=value K_AND val2=value ; between_op : K_NOT? K_BETWEEN ; value : numeric_literal # ValueNumericLiteral | timestamp_literal # ValueTimestampLiteral | string_literal # ValueStringLiteral | bind_parameter # ValueBindParam ; numeric_literal : NUMERIC_LITERAL ; NUMERIC_LITERAL : DIGIT+ ( '.' DIGIT* )? ; timestamp_literal // ISO: '2011-12-03T10:15:30+01:00'. : TIMESTAMP_LITERAL | CURRENT_TIMESTAMP | TIMESTAMP_YESTERDAY LAST? | TIMESTAMP_TODAY LAST? | TIMESTAMP_TOMORROW LAST? ; TIMESTAMP_LITERAL : '\'' YEAR_LITERAL '-' MONTH_LITERAL '-' DAY_LITERAL ('T' HOUR_LITERAL_24 ':' MINUTE_LITERAL (':' SECOND_LITERAL (PLUS_MINUS HOUR_LITERAL_12 ':' MINUTE_LITERAL)?)?)? '\'' ; CURRENT_TIMESTAMP : C U R R E N T '_' T I M E S T A M P; TIMESTAMP_YESTERDAY : T I M E S T A M P '_' Y E S T E R D A Y; TIMESTAMP_TODAY : T I M E S T A M P '_' T O D A Y; TIMESTAMP_TOMORROW : T I M E S T A M P '_' T O M O R R O W; LAST: L A S T; string_literal : STRING_LITERAL ; STRING_LITERAL : '\'' ( ~'\'' | '\'\'' )* '\'' ; bind_parameter : BIND_PARAMETER ; BIND_PARAMETER : '?{' IDENTIFIER '}' ; function : IDENTIFIER '(' ( arithmetic_expr_base ( ',' arithmetic_expr_base )* )? ')' ; column : ( IDENTIFIER '.' )? IDENTIFIER ; K_AND : A N D; K_BETWEEN : B E T W E E N; K_IN : I N; K_IS : I S; K_LIKE : L I K E; K_NOT : N O T; K_NULL : N U L L; K_OR : O R; K_REGEXP : R E G E X P; K_LT: '<'; K_LTE: '<='; K_GT: '>'; K_GTE: '>='; K_EQ: '=' '='?; K_NEQ: '<>' | '!='; K_DIV: '/'; K_MINUS: '-'; IDENTIFIER : [a-zA-Z_] [a-zA-Z_0-9]* ; PLUS_MINUS : '+' | '-' ; YEAR_LITERAL // 1800-2199 // : ([0-9])|('2'[0-1]) DIGIT DIGIT : DIGIT DIGIT DIGIT DIGIT ; MONTH_LITERAL // : ('0'[1-9])|('1'[0-2]) : DIGIT DIGIT ; DAY_LITERAL // : ('0'[1-9])|([1-2][0-9])|('3'[0-1]) : DIGIT DIGIT ; HOUR_LITERAL_24 // : ([0-1][0-9]) | ('2'[0-3]) : DIGIT DIGIT ; MINUTE_LITERAL // : ([0-5][0-9]) : DIGIT DIGIT ; SECOND_LITERAL // : ([0-5][0-9]) : DIGIT DIGIT ; HOUR_LITERAL_12 // : ('0'[0-9])|('1'[0-2]) : DIGIT DIGIT ; SPACES : [ \u000B\t\r\n] -> channel(HIDDEN) ; UNEXPECTED_CHAR : . ; fragment DIGIT : [0-9]; fragment A : [aA]; fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ];
oeis/041/A041616.asm
neoneye/loda-programs
11
84167
; A041616: Numerators of continued fraction convergents to sqrt(327). ; Submitted by <NAME> ; 18,217,7830,94177,3398202,40872601,1474811838,17738614657,640064939490,7698517888537,277786708926822,3341139025010401,120558791609301258,1450046638336625497,52322237771727819150,629316899899070455297,22707730634138264209842,273122084509558240973401,9855102772978234939252278,118534355360248377512000737,4277091895741919825371278810,51443637104263286281967346457,1856248027649220225976195751262,22326419968894905997996316361601,805607366907865836153843584768898,9689614822863284939844119333588377 add $0,1 mov $3,1 lpb $0 sub $0,1 add $2,$3 mov $3,$1 mov $1,$2 dif $2,3 mul $2,18 add $3,$2 lpe mov $0,$3
libsrc/vz/vz_brick.asm
meesokim/z88dk
0
102642
; CALLER LINKAGE FOR FUNCTION POINTERS PUBLIC vz_brick EXTERN vz_brick_callee EXTERN ASMDISP_VZ_BRICK_CALLEE .vz_brick pop hl pop bc pop de push de push bc push hl jp vz_brick_callee + ASMDISP_VZ_BRICK_CALLEE
software/profi/net-tools/src/pqdos/browser/gopher/render/plaintext.asm
andykarpov/karabas-pro
26
2553
renderPlainTextScreen: call prepareScreen ld b, PER_PAGE .loop push bc ld a, PER_PAGE : sub b ld b, a, e, a, a, (page_offset) : add b : ld b, a : call Render.findLine ld a, h : or l : jr z, .exit ld a, e add CURSOR_OFFSET : ld d, a, e, 1 : call TextMode.gotoXY call print70Text pop bc djnz .loop ret .exit pop bc ret plainTextLoop: call Console.getC cp Console.KEY_DN : jp z, textDown cp Console.KEY_UP : jp z, textUp cp 'h' : jp z, History.home cp 'H' : jp z, History.home cp 'b' : jp z, History.back cp 'B' : jp z, History.back cp BACKSPACE : jp z, History.back cp CR : jp z, navigate cp ESC : jp z, exit jr plainTextLoop textDown: ld a, (page_offset) : add PER_PAGE : ld (page_offset), a call renderPlainTextScreen jp plainTextLoop textUp: ld hl, page_offset ld a, (hl) : and a : jr z, plainTextLoop sub PER_PAGE : ld (hl), a call renderPlainTextScreen jp plainTextLoop
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_83_292.asm
ljhsiun2/medusa
9
19979
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r13 push %r9 lea addresses_WC_ht+0xf89, %r13 nop nop nop nop add %r12, %r12 mov $0x6162636465666768, %r9 movq %r9, %xmm0 and $0xffffffffffffffc0, %r13 movaps %xmm0, (%r13) nop nop nop nop nop sub $8832, %r9 pop %r9 pop %r13 pop %r12 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r8 push %rbp push %rbx // Store mov $0x3339e500000005f9, %r8 nop nop xor $51975, %rbx movl $0x51525354, (%r8) nop dec %rbp // Faulty Load lea addresses_normal+0x1b3f9, %r15 nop nop nop nop nop sub $14206, %rbp movups (%r15), %xmm4 vpextrq $1, %xmm4, %r14 lea oracles, %r15 and $0xff, %r14 shlq $12, %r14 mov (%r15,%r14,1), %r14 pop %rbx pop %rbp pop %r8 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 0}} {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 9}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_normal', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 4}} {'34': 83} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
programs/oeis/010/A010062.asm
jmorken/loda
1
96990
<gh_stars>1-10 ; A010062: a(0)=1; thereafter a(n+1) = a(n) + number of 1's in binary representation of a(n). ; 1,2,3,5,7,10,12,14,17,19,22,25,28,31,36,38,41,44,47,52,55,60,64,65,67,70,73,76,79,84,87,92,96,98,101,105,109,114,118,123,129,131,134,137,140,143,148,151,156,160,162,165,169,173,178,182,187,193,196,199,204,208,211,216,220,225,229,234,239,246,252,258,260,262,265,268,271,276,279,284,288,290,293,297,301,306,310,315,321,324,327,332,336,339,344,348,353,357,362,367,374,380,386,389,393,397,402,406,411,417,421,426,431,438,444,450,454,459,465,470,476,482,487,494,501,508,515,518,521,524,527,532,535,540,544,546,549,553,557,562,566,571,577,580,583,588,592,595,600,604,609,613,618,623,630,636,642,645,649,653,658,662,667,673,677,682,687,694,700,706,710,715,721,726,732,738,743,750,757,764,771,775,780,784,787,792,796,801,805,810,815,822,828,834,838,843,849,854,860,866,871,878,885,892,899,904,908,913,918,924,930,935,942,949,956,963,969,975,983,991,1000,1006,1014,1022,1031,1035,1039,1044,1047,1052,1056,1058,1061,1065,1069,1074,1078,1083,1089,1092,1095,1100,1104,1107,1112,1116,1121,1125,1130,1135 mov $1,1 mov $2,$0 mov $4,2 lpb $2 mov $3,$1 mul $1,$4 div $3,2 lpb $1 sub $1,$3 div $3,2 lpe sub $2,1 lpe
tools/scitools/conf/understand/ada/ada12/a-dynpri.ads
brucegua/moocos
1
23205
<reponame>brucegua/moocos ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME COMPONENTS -- -- -- -- A D A . D Y N A M I C _ P R I O R I T I E S -- -- -- -- S p e c -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. In accordance with the copyright of that document, you can freely -- -- copy and modify this specification, provided that if you redistribute a -- -- modified version, any changes that you have made are clearly indicated. -- -- -- ------------------------------------------------------------------------------ with System; with Ada.Task_Identification; package Ada.Dynamic_Priorities is pragma Preelaborate_05; -- In accordance with Ada 2005 AI-362 procedure Set_Priority (Priority : System.Any_Priority; T : Ada.Task_Identification.Task_Id := Ada.Task_Identification.Current_Task); function Get_Priority (T : Ada.Task_Identification.Task_Id := Ada.Task_Identification.Current_Task) return System.Any_Priority; end Ada.Dynamic_Priorities;
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0xca_notsx.log_21829_1670.asm
ljhsiun2/medusa
9
161968
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r8 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x797d, %rsi lea addresses_A_ht+0x5f5b, %rdi nop nop nop nop xor %r13, %r13 mov $2, %rcx rep movsb nop add %r14, %r14 lea addresses_WC_ht+0x1ba11, %r14 nop nop nop nop add $58321, %rdx mov $0x6162636465666768, %rsi movq %rsi, (%r14) nop nop nop nop nop add $42098, %r14 lea addresses_WT_ht+0xbdef, %rdi nop nop nop nop nop add %r8, %r8 mov (%rdi), %edx nop nop nop nop dec %r14 lea addresses_D_ht+0xbaef, %r8 nop nop nop nop add %rcx, %rcx movw $0x6162, (%r8) nop nop xor %rdi, %rdi lea addresses_A_ht+0x6723, %rdx nop and %rcx, %rcx movb $0x61, (%rdx) nop nop nop nop nop cmp %rcx, %rcx lea addresses_WC_ht+0x260f, %rsi lea addresses_A_ht+0x8cef, %rdi nop nop nop nop nop inc %rbp mov $1, %rcx rep movsw nop nop nop nop dec %rsi lea addresses_WC_ht+0x17bef, %rsi lea addresses_WC_ht+0x7a07, %rdi clflush (%rsi) nop nop nop nop lfence mov $104, %rcx rep movsq nop sub %rdx, %rdx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r8 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r13 push %r9 push %rbx push %rcx push %rdi // Store lea addresses_WC+0x34f4, %r9 nop nop nop nop nop inc %r12 mov $0x5152535455565758, %r13 movq %r13, (%r9) nop and %r13, %r13 // Store lea addresses_WC+0x187bf, %r12 nop nop nop nop nop sub $4449, %r11 movw $0x5152, (%r12) add %r12, %r12 // Store lea addresses_UC+0x1f63f, %rcx nop nop nop nop and $262, %r13 movl $0x51525354, (%rcx) add $58886, %r11 // Store lea addresses_PSE+0x688f, %r12 clflush (%r12) nop dec %rbx mov $0x5152535455565758, %rcx movq %rcx, (%r12) nop nop nop nop add $30244, %r12 // Faulty Load lea addresses_RW+0x90ef, %rdi nop nop sub $25781, %r12 mov (%rdi), %ecx lea oracles, %r13 and $0xff, %rcx shlq $12, %rcx mov (%r13,%rcx,1), %rcx pop %rdi pop %rcx pop %rbx pop %r9 pop %r13 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 0, 'NT': False, 'type': 'addresses_WC', 'size': 8, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_WC', 'size': 2, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 4, 'NT': False, 'type': 'addresses_UC', 'size': 4, 'AVXalign': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 5, 'NT': False, 'type': 'addresses_PSE', 'size': 8, 'AVXalign': False}} [Faulty Load] {'src': {'same': True, 'congruent': 0, 'NT': False, 'type': 'addresses_RW', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 1, 'NT': False, 'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False}} {'src': {'same': False, 'congruent': 6, 'NT': False, 'type': 'addresses_WT_ht', 'size': 4, 'AVXalign': False}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 9, 'NT': False, 'type': 'addresses_D_ht', 'size': 2, 'AVXalign': True}} {'OP': 'STOR', 'dst': {'same': False, 'congruent': 2, 'NT': False, 'type': 'addresses_A_ht', 'size': 1, 'AVXalign': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_A_ht', 'congruent': 10, 'same': False}} {'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
src/Ethambda/Common.agda
fredefox/ethambda-agda
0
972
module Ethambda.Common where open import Eth.Prelude infixr 3 _<<_ infixr 3 _<d>_ export _<d>_ : String -> String -> String v <d> w = if isNullStr v then v else v ++ " " ++ " " ++ w export ShowS : Type ShowS = String -> String export _<d_ : String -> ShowS -> ShowS s <d c = (s <.>) . c
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/noreturn2.adb
best08618/asylo
7
12393
-- { dg-do compile } package body Noreturn2 is procedure Raise_Exception_No_Defer (Message : String); pragma No_Return (Raise_Exception_No_Defer); procedure Raise_From (X : Exception_Occurrence) is Occurrence_Message : constant String := Exception_Message (X); begin if Occurrence_Message = "$" then Raise_Exception_No_Defer (Occurrence_Message); else Raise_Exception_No_Defer ("::" & Occurrence_Message); end if; end; procedure Raise_Exception_No_Defer (Message : String) is begin raise Program_Error; end; end Noreturn2;
oeis/128/A128937.asm
neoneye/loda-programs
11
230
; A128937: Triangle formed by reading A039598 mod 2. ; Submitted by <NAME> ; 1,0,1,1,0,1,0,0,0,1,0,0,1,0,1,0,1,0,0,0,1,1,0,1,0,1,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,1,0,1,0,0,0,0,0,1,0,1,0,1,0,0,0,1,0,0,0 seq $0,156290 ; Triangle read by rows: alternating binomial coefficients with signs. mod $0,2
programs/oeis/166/A166514.asm
neoneye/loda
22
97518
; A166514: Zig-zag function for first two columns of a matrix (take numbers in consecutive pairs). ; 0,1,1,0,2,1,3,0,4,1,5,0,6,1,7,0,8,1,9,0,10,1,11,0,12,1,13,0,14,1,15,0,16,1,17,0,18,1,19,0,20,1,21,0,22,1,23,0,24,1,25,0,26,1,27,0,28,1,29,0,30,1,31,0,32,1,33,0,34,1,35,0,36,1,37,0,38,1,39,0,40,1,41,0,42,1,43,0,44,1,45,0,46,1,47,0,48,1,49,0 mov $1,$0 add $0,1 div $0,2 mod $1,2 lpb $1 mod $0,2 sub $1,1 lpe
data/mapHeaders/SafariZoneGate.asm
AmateurPanda92/pokemon-rby-dx
9
84035
SafariZoneGate_h: db GATE ; tileset db SAFARI_ZONE_GATE_HEIGHT, SAFARI_ZONE_GATE_WIDTH ; dimensions (y, x) dw SafariZoneGate_Blocks ; blocks dw SafariZoneGate_TextPointers ; texts dw SafariZoneGate_Script ; scripts db 0 ; connections dw SafariZoneGate_Object ; objects
Bve5_Parsing/MapGrammar/V1Parser/ANTLR_SyntaxDefinitions/MapGrammarV1Lexer.g4
aoisupersix/IronyTest
5
2835
/* * MapGrammarV1のANTLR字句定義ファイルです。 */ lexer grammar MapGrammarV1Lexer; // Map element name CURVE : C U R V E; GRADIENT : G R A D I E N T; TRACK : T R A C K; STRUCTURE : S T R U C T U R E; REPEATER : R E P E A T E R; BACKGROUND : B A C K G R O U N D; STATION : S T A T I O N; SECTION : S E C T I O N; SIGNAL : S I G N A L; BEACON : B E A C O N; SPEEDLIMIT : S P E E D L I M I T; PRETRAIN : P R E T R A I N; LIGHT : L I G H T; FOG : F O G; CABILLUMINANCE : C A B I L L U M I N A N C E; IRREGULARITY : I R R E G U L A R I T Y; ADHESION : A D H E S I O N; SOUND : S O U N D; SOUND3D : S O U N D '3' D; ROLLINGNOISE : R O L L I N G N O I S E; FLANGENOISE : F L A N G E N O I S E; JOINTNOISE : J O I N T N O I S E; TRAIN : T R A I N; LEGACY : L E G A C Y; // Function name GAUGE : G A U G E; CANT : C A N T; SET : S E T; SET_SIGNAL : S E T S I G N A L; SET_TRACK : S E T T R A C K; BEGIN_TRANSITION : B E G I N T R A N S I T I O N; BEGIN : B E G I N; BEGIN0 : B E G I N '0'; BEGIN_CIRCULAR : B E G I N C I R C U L A R; BEGIN_CONST : B E G I N C O N S T; BEGIN_NEW : B E G I N N E W; END : E N D; CHANGE : C H A N G E; POSITION : P O S I T I O N; LOAD : L O A D; PUT : P U T; PUT0 : P U T '0'; PUTBETWEEN : P U T B E T W E E N; PASS : P A S S; AMBIENT : A M B I E N T; DIFFUSE : D I F F U S E; DIRECTION : D I R E C T I O N; PLAY : P L A Y; ADD : A D D; ENABLE : E N A B L E; STOP : S T O P; PITCH : P I T C H; TURN : T U R N; // Statement delimiter STATE_END : ';'; DOT : '.'; // Numbers NUM : [0-9]+ ('.' [0-9]*)? | '.' [0-9]+ ; // Brackets ARG_START : '(' -> pushMode(ARG_MODE); KEY_START : '[' -> pushMode(ARG_MODE); WS : [\t \r\n]+ -> skip; COMMENT : ('#' | '//') ~[\r\n]* -> skip; ERROR_CHAR : . -> skip; // Ignore case fragment A : [aA]; fragment B : [bB]; fragment C : [cC]; fragment D : [dD]; fragment E : [eE]; fragment F : [fF]; fragment G : [gG]; fragment H : [hH]; fragment I : [iI]; fragment J : [jJ]; fragment K : [kK]; fragment L : [lL]; fragment M : [mM]; fragment N : [nN]; fragment O : [oO]; fragment P : [pP]; fragment Q : [qQ]; fragment R : [rR]; fragment S : [sS]; fragment T : [tT]; fragment U : [uU]; fragment V : [vV]; fragment W : [wW]; fragment X : [xX]; fragment Y : [yY]; fragment Z : [zZ]; mode ARG_MODE; ARG_END: ')' WS* STATE_END -> popMode; KEY_END : ']' WS* DOT -> popMode; ARG_FORCE_END: STATE_END -> popMode; //このルールは正常な構文であれば必ず通らないが、ARG_MODEを抜けるために作っておく。 COMMA : ','; NULL : N U L L; ARG_WS : WS -> skip; ARG_COMMENT : COMMENT -> skip; CHAR : .;
alloy4fun_models/trashltl/models/9/8ppYw9zRQhzJHa9nu.als
Kaixi26/org.alloytools.alloy
0
4543
open main pred id8ppYw9zRQhzJHa9nu_prop10 { always all p : Protected | p in Protected' } pred __repair { id8ppYw9zRQhzJHa9nu_prop10 } check __repair { id8ppYw9zRQhzJHa9nu_prop10 <=> prop10o }
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/a74106c.ada
best08618/asylo
7
191
<filename>gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/a/a74106c.ada -- A74106C.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 FULL DECLARATION FOR A PRIVATE TYPE OR FOR A LIMITED -- PRIVATE TYPE CAN BE GIVEN IN TERMS OF ANY SCALAR TYPE, ARRAY -- TYPE, RECORD TYPE (WITH OR WITHOUT DISCRIMINANTS), ACCESS TYPE -- (WITH OR WITHOUT DISCRIMINANTS), OR ANY TYPE DERIVED FROM ANY -- OF THE ABOVE. -- PART C: TYPES INVOLVING FIXED-POINT DATA. -- HISTORY: -- RM 05/11/81 CREATED ORIGINAL TEST. -- DHH 10/15/87 CORRECTED RANGE ERRORS. WITH REPORT; PROCEDURE A74106C IS USE REPORT; BEGIN TEST( "A74106C" , "CHECK THAT PRIVATE TYPES AND LIMITED PRIVATE" & " TYPES CAN BE DEFINED IN TERMS OF" & " FIXED-POINT TYPES" ); DECLARE PACKAGE P0 IS TYPE F0 IS PRIVATE; PRIVATE TYPE F0 IS DELTA 1.0 RANGE 0.0 .. 10.0; END P0; PACKAGE P1 IS USE P0; TYPE FX IS DELTA 0.1 RANGE 0.0 .. 1.0; TYPE F1 IS PRIVATE; TYPE F2 IS PRIVATE; TYPE F3 IS PRIVATE; TYPE F4 IS PRIVATE; TYPE F5 IS PRIVATE; TYPE F6 IS PRIVATE; TYPE F7 IS PRIVATE; TYPE F8 IS PRIVATE; TYPE F9 IS PRIVATE; TYPE FA IS PRIVATE; TYPE FB IS PRIVATE; TYPE FC IS PRIVATE; TYPE NF IS DELTA 0.1 RANGE 1.0 .. 2.0; TYPE ARR_F IS ARRAY(1..2) OF FX; TYPE ACC_F IS ACCESS FX; TYPE REC_F IS RECORD F : FX; END RECORD; TYPE D_REC_F(I : INTEGER := 1) IS RECORD F : FX; END RECORD; PRIVATE TYPE FC IS NEW F0; TYPE F1 IS DELTA 100.0 RANGE -100.0 .. 900.0; TYPE F2 IS NEW FX RANGE 0.0 .. 0.5; TYPE F3 IS NEW NF; TYPE F4 IS ARRAY(1..2) OF FX; TYPE F5 IS NEW ARR_F; TYPE F6 IS ACCESS FX; TYPE F7 IS NEW ACC_F; TYPE F8 IS RECORD F : FX; END RECORD; TYPE F9 IS NEW REC_F; TYPE FA IS ACCESS D_REC_F; TYPE FB IS ACCESS D_REC_F; END P1; BEGIN NULL; END; DECLARE PACKAGE P0 IS TYPE F0 IS LIMITED PRIVATE; PRIVATE TYPE F0 IS DELTA 1.0 RANGE 0.0 .. 10.0; END P0; PACKAGE P1 IS USE P0; TYPE FX IS DELTA 0.1 RANGE 0.0 .. 1.0; TYPE F1 IS LIMITED PRIVATE; TYPE F2 IS LIMITED PRIVATE; TYPE F3 IS LIMITED PRIVATE; TYPE F4 IS LIMITED PRIVATE; TYPE F5 IS LIMITED PRIVATE; TYPE F6 IS LIMITED PRIVATE; TYPE F7 IS LIMITED PRIVATE; TYPE F8 IS LIMITED PRIVATE; TYPE F9 IS LIMITED PRIVATE; TYPE FA IS LIMITED PRIVATE; TYPE FB IS LIMITED PRIVATE; TYPE FC IS LIMITED PRIVATE; TYPE NF IS DELTA 0.1 RANGE 1.0 .. 2.0; TYPE ARR_F IS ARRAY(1..2) OF FX; TYPE ACC_F IS ACCESS FX; TYPE REC_F IS RECORD F : FX; END RECORD; TYPE D_REC_F(I : INTEGER := 1) IS RECORD F : FX; END RECORD; PRIVATE TYPE FC IS NEW F0; TYPE F1 IS DELTA 100.0 RANGE -100.0 .. 900.0; TYPE F2 IS NEW FX RANGE 0.0 .. 0.5; TYPE F3 IS NEW NF; TYPE F4 IS ARRAY(1..2) OF FX; TYPE F5 IS NEW ARR_F; TYPE F6 IS ACCESS FX; TYPE F7 IS NEW ACC_F; TYPE F8 IS RECORD F : FX; END RECORD; TYPE F9 IS NEW REC_F; TYPE FA IS ACCESS D_REC_F; TYPE FB IS ACCESS D_REC_F; END P1; BEGIN NULL; END; RESULT; END A74106C;
programs/oeis/047/A047284.asm
neoneye/loda
22
175433
<reponame>neoneye/loda ; A047284: Numbers that are congruent to {2, 3, 6} mod 7. ; 2,3,6,9,10,13,16,17,20,23,24,27,30,31,34,37,38,41,44,45,48,51,52,55,58,59,62,65,66,69,72,73,76,79,80,83,86,87,90,93,94,97,100,101,104,107,108,111,114,115,118,121,122,125,128,129,132,135,136,139,142 mov $1,$0 mul $0,2 div $0,3 mul $0,2 add $0,$1 add $0,2
top.asm
HareeshwarKarthikeyan/Top-Command-in-Xv6-Operating-System
1
95850
_top: file format elf32-i386 Disassembly of section .text: 00000000 <main>: *(buffer) = buf; return buf[0]; } int main(int argc, char *argv[]) { 0: 55 push %ebp 1: 89 e5 mov %esp,%ebp 3: 53 push %ebx 4: 83 e4 f0 and $0xfffffff0,%esp 7: 83 ec 20 sub $0x20,%esp a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi //clear screen printf(1, "\033[2J\033[1;1H\n"); 10: c7 44 24 04 b6 07 00 movl $0x7b6,0x4(%esp) 17: 00 18: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1f: e8 2c 04 00 00 call 450 <printf> gettop(); 24: e8 79 03 00 00 call 3a2 <gettop> char *c; *c = getc(1, &c); 29: 8d 44 24 1c lea 0x1c(%esp),%eax 2d: 8b 5c 24 1c mov 0x1c(%esp),%ebx 31: e8 2a 00 00 00 call 60 <getc.constprop.0> 36: 88 03 mov %al,(%ebx) while (*c != 'q' && *c != 'Q') 38: 8b 44 24 1c mov 0x1c(%esp),%eax 3c: 0f b6 00 movzbl (%eax),%eax 3f: 83 e0 df and $0xffffffdf,%eax 42: 3c 51 cmp $0x51,%al 44: 75 ca jne 10 <main+0x10> //clear screen printf(1, "\033[2J\033[1;1H\n"); gettop(); *c = getc(1, &c); } printf(1, "\033[2J\033[1;1H\n"); 46: c7 44 24 04 b6 07 00 movl $0x7b6,0x4(%esp) 4d: 00 4e: c7 04 24 01 00 00 00 movl $0x1,(%esp) 55: e8 f6 03 00 00 call 450 <printf> exit(); 5a: e8 93 02 00 00 call 2f2 <exit> 5f: 90 nop 00000060 <getc.constprop.0>: #include "types.h" #include "user.h" #include "stat.h" static char getc(int fd, char **buffer) 60: 55 push %ebp 61: 89 e5 mov %esp,%ebp 63: 57 push %edi 64: 89 c7 mov %eax,%edi 66: 56 push %esi { int i = 0; 67: 31 f6 xor %esi,%esi #include "types.h" #include "user.h" #include "stat.h" static char getc(int fd, char **buffer) 69: 53 push %ebx 6a: 81 ec 1c 01 00 00 sub $0x11c,%esp 70: 8d 9d e8 fe ff ff lea -0x118(%ebp),%ebx 76: eb 14 jmp 8c <getc.constprop.0+0x2c> { int i = 0; char buf[256]; // read input into buffer while (read(fd, &buf[i], 1)) { if ((buf[i] == '\n' || buf[i] == ' ' || buf[i] == '\t' || buf[i] == '\r' || buf[i] == '\v' || buf[i] == '\f')) 78: 0f b6 03 movzbl (%ebx),%eax 7b: 3c 20 cmp $0x20,%al 7d: 74 29 je a8 <getc.constprop.0+0x48> 7f: 83 e8 09 sub $0x9,%eax 82: 83 c3 01 add $0x1,%ebx 85: 3c 04 cmp $0x4,%al 87: 76 1f jbe a8 <getc.constprop.0+0x48> break; else i++; 89: 83 c6 01 add $0x1,%esi static char getc(int fd, char **buffer) { int i = 0; char buf[256]; // read input into buffer while (read(fd, &buf[i], 1)) 8c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 93: 00 94: 89 5c 24 04 mov %ebx,0x4(%esp) 98: c7 04 24 01 00 00 00 movl $0x1,(%esp) 9f: e8 66 02 00 00 call 30a <read> a4: 85 c0 test %eax,%eax a6: 75 d0 jne 78 <getc.constprop.0+0x18> break; else i++; } buf[i] = '\0'; *(buffer) = buf; a8: 8d 85 e8 fe ff ff lea -0x118(%ebp),%eax if ((buf[i] == '\n' || buf[i] == ' ' || buf[i] == '\t' || buf[i] == '\r' || buf[i] == '\v' || buf[i] == '\f')) break; else i++; } buf[i] = '\0'; ae: c6 84 35 e8 fe ff ff movb $0x0,-0x118(%ebp,%esi,1) b5: 00 *(buffer) = buf; b6: 89 07 mov %eax,(%edi) return buf[0]; b8: 0f b6 85 e8 fe ff ff movzbl -0x118(%ebp),%eax } bf: 81 c4 1c 01 00 00 add $0x11c,%esp c5: 5b pop %ebx c6: 5e pop %esi c7: 5f pop %edi c8: 5d pop %ebp c9: c3 ret ca: 66 90 xchg %ax,%ax cc: 66 90 xchg %ax,%ax ce: 66 90 xchg %ax,%ax 000000d0 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, const char *t) { d0: 55 push %ebp d1: 89 e5 mov %esp,%ebp d3: 8b 45 08 mov 0x8(%ebp),%eax d6: 8b 4d 0c mov 0xc(%ebp),%ecx d9: 53 push %ebx char *os; os = s; while((*s++ = *t++) != 0) da: 89 c2 mov %eax,%edx dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi e0: 83 c1 01 add $0x1,%ecx e3: 0f b6 59 ff movzbl -0x1(%ecx),%ebx e7: 83 c2 01 add $0x1,%edx ea: 84 db test %bl,%bl ec: 88 5a ff mov %bl,-0x1(%edx) ef: 75 ef jne e0 <strcpy+0x10> ; return os; } f1: 5b pop %ebx f2: 5d pop %ebp f3: c3 ret f4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi fa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 00000100 <strcmp>: int strcmp(const char *p, const char *q) { 100: 55 push %ebp 101: 89 e5 mov %esp,%ebp 103: 8b 55 08 mov 0x8(%ebp),%edx 106: 53 push %ebx 107: 8b 4d 0c mov 0xc(%ebp),%ecx while(*p && *p == *q) 10a: 0f b6 02 movzbl (%edx),%eax 10d: 84 c0 test %al,%al 10f: 74 2d je 13e <strcmp+0x3e> 111: 0f b6 19 movzbl (%ecx),%ebx 114: 38 d8 cmp %bl,%al 116: 74 0e je 126 <strcmp+0x26> 118: eb 2b jmp 145 <strcmp+0x45> 11a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 120: 38 c8 cmp %cl,%al 122: 75 15 jne 139 <strcmp+0x39> p++, q++; 124: 89 d9 mov %ebx,%ecx 126: 83 c2 01 add $0x1,%edx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 129: 0f b6 02 movzbl (%edx),%eax p++, q++; 12c: 8d 59 01 lea 0x1(%ecx),%ebx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 12f: 0f b6 49 01 movzbl 0x1(%ecx),%ecx 133: 84 c0 test %al,%al 135: 75 e9 jne 120 <strcmp+0x20> 137: 31 c0 xor %eax,%eax p++, q++; return (uchar)*p - (uchar)*q; 139: 29 c8 sub %ecx,%eax } 13b: 5b pop %ebx 13c: 5d pop %ebp 13d: c3 ret 13e: 0f b6 09 movzbl (%ecx),%ecx } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 141: 31 c0 xor %eax,%eax 143: eb f4 jmp 139 <strcmp+0x39> 145: 0f b6 cb movzbl %bl,%ecx 148: eb ef jmp 139 <strcmp+0x39> 14a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000150 <strlen>: return (uchar)*p - (uchar)*q; } uint strlen(const char *s) { 150: 55 push %ebp 151: 89 e5 mov %esp,%ebp 153: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 156: 80 39 00 cmpb $0x0,(%ecx) 159: 74 12 je 16d <strlen+0x1d> 15b: 31 d2 xor %edx,%edx 15d: 8d 76 00 lea 0x0(%esi),%esi 160: 83 c2 01 add $0x1,%edx 163: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1) 167: 89 d0 mov %edx,%eax 169: 75 f5 jne 160 <strlen+0x10> ; return n; } 16b: 5d pop %ebp 16c: c3 ret uint strlen(const char *s) { int n; for(n = 0; s[n]; n++) 16d: 31 c0 xor %eax,%eax ; return n; } 16f: 5d pop %ebp 170: c3 ret 171: eb 0d jmp 180 <memset> 173: 90 nop 174: 90 nop 175: 90 nop 176: 90 nop 177: 90 nop 178: 90 nop 179: 90 nop 17a: 90 nop 17b: 90 nop 17c: 90 nop 17d: 90 nop 17e: 90 nop 17f: 90 nop 00000180 <memset>: void* memset(void *dst, int c, uint n) { 180: 55 push %ebp 181: 89 e5 mov %esp,%ebp 183: 8b 55 08 mov 0x8(%ebp),%edx 186: 57 push %edi } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 187: 8b 4d 10 mov 0x10(%ebp),%ecx 18a: 8b 45 0c mov 0xc(%ebp),%eax 18d: 89 d7 mov %edx,%edi 18f: fc cld 190: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 192: 89 d0 mov %edx,%eax 194: 5f pop %edi 195: 5d pop %ebp 196: c3 ret 197: 89 f6 mov %esi,%esi 199: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001a0 <strchr>: char* strchr(const char *s, char c) { 1a0: 55 push %ebp 1a1: 89 e5 mov %esp,%ebp 1a3: 8b 45 08 mov 0x8(%ebp),%eax 1a6: 53 push %ebx 1a7: 8b 55 0c mov 0xc(%ebp),%edx for(; *s; s++) 1aa: 0f b6 18 movzbl (%eax),%ebx 1ad: 84 db test %bl,%bl 1af: 74 1d je 1ce <strchr+0x2e> if(*s == c) 1b1: 38 d3 cmp %dl,%bl 1b3: 89 d1 mov %edx,%ecx 1b5: 75 0d jne 1c4 <strchr+0x24> 1b7: eb 17 jmp 1d0 <strchr+0x30> 1b9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1c0: 38 ca cmp %cl,%dl 1c2: 74 0c je 1d0 <strchr+0x30> } char* strchr(const char *s, char c) { for(; *s; s++) 1c4: 83 c0 01 add $0x1,%eax 1c7: 0f b6 10 movzbl (%eax),%edx 1ca: 84 d2 test %dl,%dl 1cc: 75 f2 jne 1c0 <strchr+0x20> if(*s == c) return (char*)s; return 0; 1ce: 31 c0 xor %eax,%eax } 1d0: 5b pop %ebx 1d1: 5d pop %ebp 1d2: c3 ret 1d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 1d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi 000001e0 <gets>: char* gets(char *buf, int max) { 1e0: 55 push %ebp 1e1: 89 e5 mov %esp,%ebp 1e3: 57 push %edi 1e4: 56 push %esi int i, cc; char c; for(i=0; i+1 < max; ){ 1e5: 31 f6 xor %esi,%esi return 0; } char* gets(char *buf, int max) { 1e7: 53 push %ebx 1e8: 83 ec 2c sub $0x2c,%esp int i, cc; char c; for(i=0; i+1 < max; ){ cc = read(0, &c, 1); 1eb: 8d 7d e7 lea -0x19(%ebp),%edi gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1ee: eb 31 jmp 221 <gets+0x41> cc = read(0, &c, 1); 1f0: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1f7: 00 1f8: 89 7c 24 04 mov %edi,0x4(%esp) 1fc: c7 04 24 00 00 00 00 movl $0x0,(%esp) 203: e8 02 01 00 00 call 30a <read> if(cc < 1) 208: 85 c0 test %eax,%eax 20a: 7e 1d jle 229 <gets+0x49> break; buf[i++] = c; 20c: 0f b6 45 e7 movzbl -0x19(%ebp),%eax gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 210: 89 de mov %ebx,%esi cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 212: 8b 55 08 mov 0x8(%ebp),%edx if(c == '\n' || c == '\r') 215: 3c 0d cmp $0xd,%al for(i=0; i+1 < max; ){ cc = read(0, &c, 1); if(cc < 1) break; buf[i++] = c; 217: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if(c == '\n' || c == '\r') 21b: 74 0c je 229 <gets+0x49> 21d: 3c 0a cmp $0xa,%al 21f: 74 08 je 229 <gets+0x49> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 221: 8d 5e 01 lea 0x1(%esi),%ebx 224: 3b 5d 0c cmp 0xc(%ebp),%ebx 227: 7c c7 jl 1f0 <gets+0x10> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 229: 8b 45 08 mov 0x8(%ebp),%eax 22c: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } 230: 83 c4 2c add $0x2c,%esp 233: 5b pop %ebx 234: 5e pop %esi 235: 5f pop %edi 236: 5d pop %ebp 237: c3 ret 238: 90 nop 239: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000240 <stat>: int stat(const char *n, struct stat *st) { 240: 55 push %ebp 241: 89 e5 mov %esp,%ebp 243: 56 push %esi 244: 53 push %ebx 245: 83 ec 10 sub $0x10,%esp int fd; int r; fd = open(n, O_RDONLY); 248: 8b 45 08 mov 0x8(%ebp),%eax 24b: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 252: 00 253: 89 04 24 mov %eax,(%esp) 256: e8 d7 00 00 00 call 332 <open> if(fd < 0) 25b: 85 c0 test %eax,%eax stat(const char *n, struct stat *st) { int fd; int r; fd = open(n, O_RDONLY); 25d: 89 c3 mov %eax,%ebx if(fd < 0) 25f: 78 27 js 288 <stat+0x48> return -1; r = fstat(fd, st); 261: 8b 45 0c mov 0xc(%ebp),%eax 264: 89 1c 24 mov %ebx,(%esp) 267: 89 44 24 04 mov %eax,0x4(%esp) 26b: e8 da 00 00 00 call 34a <fstat> close(fd); 270: 89 1c 24 mov %ebx,(%esp) int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; r = fstat(fd, st); 273: 89 c6 mov %eax,%esi close(fd); 275: e8 a0 00 00 00 call 31a <close> return r; 27a: 89 f0 mov %esi,%eax } 27c: 83 c4 10 add $0x10,%esp 27f: 5b pop %ebx 280: 5e pop %esi 281: 5d pop %ebp 282: c3 ret 283: 90 nop 284: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi int fd; int r; fd = open(n, O_RDONLY); if(fd < 0) return -1; 288: b8 ff ff ff ff mov $0xffffffff,%eax 28d: eb ed jmp 27c <stat+0x3c> 28f: 90 nop 00000290 <atoi>: return r; } int atoi(const char *s) { 290: 55 push %ebp 291: 89 e5 mov %esp,%ebp 293: 8b 4d 08 mov 0x8(%ebp),%ecx 296: 53 push %ebx int n; n = 0; while('0' <= *s && *s <= '9') 297: 0f be 11 movsbl (%ecx),%edx 29a: 8d 42 d0 lea -0x30(%edx),%eax 29d: 3c 09 cmp $0x9,%al int atoi(const char *s) { int n; n = 0; 29f: b8 00 00 00 00 mov $0x0,%eax while('0' <= *s && *s <= '9') 2a4: 77 17 ja 2bd <atoi+0x2d> 2a6: 66 90 xchg %ax,%ax n = n*10 + *s++ - '0'; 2a8: 83 c1 01 add $0x1,%ecx 2ab: 8d 04 80 lea (%eax,%eax,4),%eax 2ae: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 2b2: 0f be 11 movsbl (%ecx),%edx 2b5: 8d 5a d0 lea -0x30(%edx),%ebx 2b8: 80 fb 09 cmp $0x9,%bl 2bb: 76 eb jbe 2a8 <atoi+0x18> n = n*10 + *s++ - '0'; return n; } 2bd: 5b pop %ebx 2be: 5d pop %ebp 2bf: c3 ret 000002c0 <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 2c0: 55 push %ebp char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 2c1: 31 d2 xor %edx,%edx return n; } void* memmove(void *vdst, const void *vsrc, int n) { 2c3: 89 e5 mov %esp,%ebp 2c5: 56 push %esi 2c6: 8b 45 08 mov 0x8(%ebp),%eax 2c9: 53 push %ebx 2ca: 8b 5d 10 mov 0x10(%ebp),%ebx 2cd: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 2d0: 85 db test %ebx,%ebx 2d2: 7e 12 jle 2e6 <memmove+0x26> 2d4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi *dst++ = *src++; 2d8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx 2dc: 88 0c 10 mov %cl,(%eax,%edx,1) 2df: 83 c2 01 add $0x1,%edx char *dst; const char *src; dst = vdst; src = vsrc; while(n-- > 0) 2e2: 39 da cmp %ebx,%edx 2e4: 75 f2 jne 2d8 <memmove+0x18> *dst++ = *src++; return vdst; } 2e6: 5b pop %ebx 2e7: 5e pop %esi 2e8: 5d pop %ebp 2e9: c3 ret 000002ea <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 2ea: b8 01 00 00 00 mov $0x1,%eax 2ef: cd 40 int $0x40 2f1: c3 ret 000002f2 <exit>: SYSCALL(exit) 2f2: b8 02 00 00 00 mov $0x2,%eax 2f7: cd 40 int $0x40 2f9: c3 ret 000002fa <wait>: SYSCALL(wait) 2fa: b8 03 00 00 00 mov $0x3,%eax 2ff: cd 40 int $0x40 301: c3 ret 00000302 <pipe>: SYSCALL(pipe) 302: b8 04 00 00 00 mov $0x4,%eax 307: cd 40 int $0x40 309: c3 ret 0000030a <read>: SYSCALL(read) 30a: b8 05 00 00 00 mov $0x5,%eax 30f: cd 40 int $0x40 311: c3 ret 00000312 <write>: SYSCALL(write) 312: b8 10 00 00 00 mov $0x10,%eax 317: cd 40 int $0x40 319: c3 ret 0000031a <close>: SYSCALL(close) 31a: b8 15 00 00 00 mov $0x15,%eax 31f: cd 40 int $0x40 321: c3 ret 00000322 <kill>: SYSCALL(kill) 322: b8 06 00 00 00 mov $0x6,%eax 327: cd 40 int $0x40 329: c3 ret 0000032a <exec>: SYSCALL(exec) 32a: b8 07 00 00 00 mov $0x7,%eax 32f: cd 40 int $0x40 331: c3 ret 00000332 <open>: SYSCALL(open) 332: b8 0f 00 00 00 mov $0xf,%eax 337: cd 40 int $0x40 339: c3 ret 0000033a <mknod>: SYSCALL(mknod) 33a: b8 11 00 00 00 mov $0x11,%eax 33f: cd 40 int $0x40 341: c3 ret 00000342 <unlink>: SYSCALL(unlink) 342: b8 12 00 00 00 mov $0x12,%eax 347: cd 40 int $0x40 349: c3 ret 0000034a <fstat>: SYSCALL(fstat) 34a: b8 08 00 00 00 mov $0x8,%eax 34f: cd 40 int $0x40 351: c3 ret 00000352 <link>: SYSCALL(link) 352: b8 13 00 00 00 mov $0x13,%eax 357: cd 40 int $0x40 359: c3 ret 0000035a <mkdir>: SYSCALL(mkdir) 35a: b8 14 00 00 00 mov $0x14,%eax 35f: cd 40 int $0x40 361: c3 ret 00000362 <chdir>: SYSCALL(chdir) 362: b8 09 00 00 00 mov $0x9,%eax 367: cd 40 int $0x40 369: c3 ret 0000036a <dup>: SYSCALL(dup) 36a: b8 0a 00 00 00 mov $0xa,%eax 36f: cd 40 int $0x40 371: c3 ret 00000372 <getpid>: SYSCALL(getpid) 372: b8 0b 00 00 00 mov $0xb,%eax 377: cd 40 int $0x40 379: c3 ret 0000037a <sbrk>: SYSCALL(sbrk) 37a: b8 0c 00 00 00 mov $0xc,%eax 37f: cd 40 int $0x40 381: c3 ret 00000382 <sleep>: SYSCALL(sleep) 382: b8 0d 00 00 00 mov $0xd,%eax 387: cd 40 int $0x40 389: c3 ret 0000038a <uptime>: SYSCALL(uptime) 38a: b8 0e 00 00 00 mov $0xe,%eax 38f: cd 40 int $0x40 391: c3 ret 00000392 <hello>: SYSCALL(hello) 392: b8 16 00 00 00 mov $0x16,%eax 397: cd 40 int $0x40 399: c3 ret 0000039a <halt>: SYSCALL(halt) 39a: b8 17 00 00 00 mov $0x17,%eax 39f: cd 40 int $0x40 3a1: c3 ret 000003a2 <gettop>: SYSCALL(gettop) 3a2: b8 18 00 00 00 mov $0x18,%eax 3a7: cd 40 int $0x40 3a9: c3 ret 3aa: 66 90 xchg %ax,%ax 3ac: 66 90 xchg %ax,%ax 3ae: 66 90 xchg %ax,%ax 000003b0 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { 3b0: 55 push %ebp 3b1: 89 e5 mov %esp,%ebp 3b3: 57 push %edi 3b4: 56 push %esi 3b5: 89 c6 mov %eax,%esi 3b7: 53 push %ebx 3b8: 83 ec 4c sub $0x4c,%esp char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 3bb: 8b 5d 08 mov 0x8(%ebp),%ebx 3be: 85 db test %ebx,%ebx 3c0: 74 09 je 3cb <printint+0x1b> 3c2: 89 d0 mov %edx,%eax 3c4: c1 e8 1f shr $0x1f,%eax 3c7: 84 c0 test %al,%al 3c9: 75 75 jne 440 <printint+0x90> neg = 1; x = -xx; } else { x = xx; 3cb: 89 d0 mov %edx,%eax static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 3cd: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp) 3d4: 89 75 c0 mov %esi,-0x40(%ebp) x = -xx; } else { x = xx; } i = 0; 3d7: 31 ff xor %edi,%edi 3d9: 89 ce mov %ecx,%esi 3db: 8d 5d d7 lea -0x29(%ebp),%ebx 3de: eb 02 jmp 3e2 <printint+0x32> do{ buf[i++] = digits[x % base]; 3e0: 89 cf mov %ecx,%edi 3e2: 31 d2 xor %edx,%edx 3e4: f7 f6 div %esi 3e6: 8d 4f 01 lea 0x1(%edi),%ecx 3e9: 0f b6 92 c9 07 00 00 movzbl 0x7c9(%edx),%edx }while((x /= base) != 0); 3f0: 85 c0 test %eax,%eax x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 3f2: 88 14 0b mov %dl,(%ebx,%ecx,1) }while((x /= base) != 0); 3f5: 75 e9 jne 3e0 <printint+0x30> if(neg) 3f7: 8b 55 c4 mov -0x3c(%ebp),%edx x = xx; } i = 0; do{ buf[i++] = digits[x % base]; 3fa: 89 c8 mov %ecx,%eax 3fc: 8b 75 c0 mov -0x40(%ebp),%esi }while((x /= base) != 0); if(neg) 3ff: 85 d2 test %edx,%edx 401: 74 08 je 40b <printint+0x5b> buf[i++] = '-'; 403: 8d 4f 02 lea 0x2(%edi),%ecx 406: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1) while(--i >= 0) 40b: 8d 79 ff lea -0x1(%ecx),%edi 40e: 66 90 xchg %ax,%ax 410: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax 415: 83 ef 01 sub $0x1,%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 418: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 41f: 00 420: 89 5c 24 04 mov %ebx,0x4(%esp) 424: 89 34 24 mov %esi,(%esp) 427: 88 45 d7 mov %al,-0x29(%ebp) 42a: e8 e3 fe ff ff call 312 <write> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 42f: 83 ff ff cmp $0xffffffff,%edi 432: 75 dc jne 410 <printint+0x60> putc(fd, buf[i]); } 434: 83 c4 4c add $0x4c,%esp 437: 5b pop %ebx 438: 5e pop %esi 439: 5f pop %edi 43a: 5d pop %ebp 43b: c3 ret 43c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi uint x; neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; 440: 89 d0 mov %edx,%eax 442: f7 d8 neg %eax int i, neg; uint x; neg = 0; if(sgn && xx < 0){ neg = 1; 444: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp) 44b: eb 87 jmp 3d4 <printint+0x24> 44d: 8d 76 00 lea 0x0(%esi),%esi 00000450 <printf>: } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 450: 55 push %ebp 451: 89 e5 mov %esp,%ebp 453: 57 push %edi char *s; int c, i, state; uint *ap; state = 0; 454: 31 ff xor %edi,%edi } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 456: 56 push %esi 457: 53 push %ebx 458: 83 ec 3c sub $0x3c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 45b: 8b 5d 0c mov 0xc(%ebp),%ebx char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 45e: 8d 45 10 lea 0x10(%ebp),%eax } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 461: 8b 75 08 mov 0x8(%ebp),%esi char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 464: 89 45 d4 mov %eax,-0x2c(%ebp) for(i = 0; fmt[i]; i++){ 467: 0f b6 13 movzbl (%ebx),%edx 46a: 83 c3 01 add $0x1,%ebx 46d: 84 d2 test %dl,%dl 46f: 75 39 jne 4aa <printf+0x5a> 471: e9 c2 00 00 00 jmp 538 <printf+0xe8> 476: 66 90 xchg %ax,%ax c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ 478: 83 fa 25 cmp $0x25,%edx 47b: 0f 84 bf 00 00 00 je 540 <printf+0xf0> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 481: 8d 45 e2 lea -0x1e(%ebp),%eax 484: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 48b: 00 48c: 89 44 24 04 mov %eax,0x4(%esp) 490: 89 34 24 mov %esi,(%esp) c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); 493: 88 55 e2 mov %dl,-0x1e(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 496: e8 77 fe ff ff call 312 <write> 49b: 83 c3 01 add $0x1,%ebx int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 49e: 0f b6 53 ff movzbl -0x1(%ebx),%edx 4a2: 84 d2 test %dl,%dl 4a4: 0f 84 8e 00 00 00 je 538 <printf+0xe8> c = fmt[i] & 0xff; if(state == 0){ 4aa: 85 ff test %edi,%edi uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; 4ac: 0f be c2 movsbl %dl,%eax if(state == 0){ 4af: 74 c7 je 478 <printf+0x28> if(c == '%'){ state = '%'; } else { putc(fd, c); } } else if(state == '%'){ 4b1: 83 ff 25 cmp $0x25,%edi 4b4: 75 e5 jne 49b <printf+0x4b> if(c == 'd'){ 4b6: 83 fa 64 cmp $0x64,%edx 4b9: 0f 84 31 01 00 00 je 5f0 <printf+0x1a0> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 4bf: 25 f7 00 00 00 and $0xf7,%eax 4c4: 83 f8 70 cmp $0x70,%eax 4c7: 0f 84 83 00 00 00 je 550 <printf+0x100> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 4cd: 83 fa 73 cmp $0x73,%edx 4d0: 0f 84 a2 00 00 00 je 578 <printf+0x128> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 4d6: 83 fa 63 cmp $0x63,%edx 4d9: 0f 84 35 01 00 00 je 614 <printf+0x1c4> putc(fd, *ap); ap++; } else if(c == '%'){ 4df: 83 fa 25 cmp $0x25,%edx 4e2: 0f 84 e0 00 00 00 je 5c8 <printf+0x178> #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4e8: 8d 45 e6 lea -0x1a(%ebp),%eax 4eb: 83 c3 01 add $0x1,%ebx 4ee: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 4f5: 00 } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 4f6: 31 ff xor %edi,%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 4f8: 89 44 24 04 mov %eax,0x4(%esp) 4fc: 89 34 24 mov %esi,(%esp) 4ff: 89 55 d0 mov %edx,-0x30(%ebp) 502: c6 45 e6 25 movb $0x25,-0x1a(%ebp) 506: e8 07 fe ff ff call 312 <write> } else if(c == '%'){ putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); 50b: 8b 55 d0 mov -0x30(%ebp),%edx #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 50e: 8d 45 e7 lea -0x19(%ebp),%eax 511: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 518: 00 519: 89 44 24 04 mov %eax,0x4(%esp) 51d: 89 34 24 mov %esi,(%esp) } else if(c == '%'){ putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); 520: 88 55 e7 mov %dl,-0x19(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 523: e8 ea fd ff ff call 312 <write> int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 528: 0f b6 53 ff movzbl -0x1(%ebx),%edx 52c: 84 d2 test %dl,%dl 52e: 0f 85 76 ff ff ff jne 4aa <printf+0x5a> 534: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi putc(fd, c); } state = 0; } } } 538: 83 c4 3c add $0x3c,%esp 53b: 5b pop %ebx 53c: 5e pop %esi 53d: 5f pop %edi 53e: 5d pop %ebp 53f: c3 ret ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; 540: bf 25 00 00 00 mov $0x25,%edi 545: e9 51 ff ff ff jmp 49b <printf+0x4b> 54a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 550: 8b 45 d4 mov -0x2c(%ebp),%eax 553: b9 10 00 00 00 mov $0x10,%ecx } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 558: 31 ff xor %edi,%edi } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); 55a: c7 04 24 00 00 00 00 movl $0x0,(%esp) 561: 8b 10 mov (%eax),%edx 563: 89 f0 mov %esi,%eax 565: e8 46 fe ff ff call 3b0 <printint> ap++; 56a: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 56e: e9 28 ff ff ff jmp 49b <printf+0x4b> 573: 90 nop 574: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi } else if(c == 's'){ s = (char*)*ap; 578: 8b 45 d4 mov -0x2c(%ebp),%eax ap++; 57b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) ap++; } else if(c == 'x' || c == 'p'){ printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ s = (char*)*ap; 57f: 8b 38 mov (%eax),%edi ap++; if(s == 0) s = "(null)"; 581: b8 c2 07 00 00 mov $0x7c2,%eax 586: 85 ff test %edi,%edi 588: 0f 44 f8 cmove %eax,%edi while(*s != 0){ 58b: 0f b6 07 movzbl (%edi),%eax 58e: 84 c0 test %al,%al 590: 74 2a je 5bc <printf+0x16c> 592: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 598: 88 45 e3 mov %al,-0x1d(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 59b: 8d 45 e3 lea -0x1d(%ebp),%eax ap++; if(s == 0) s = "(null)"; while(*s != 0){ putc(fd, *s); s++; 59e: 83 c7 01 add $0x1,%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5a1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 5a8: 00 5a9: 89 44 24 04 mov %eax,0x4(%esp) 5ad: 89 34 24 mov %esi,(%esp) 5b0: e8 5d fd ff ff call 312 <write> } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 5b5: 0f b6 07 movzbl (%edi),%eax 5b8: 84 c0 test %al,%al 5ba: 75 dc jne 598 <printf+0x148> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5bc: 31 ff xor %edi,%edi 5be: e9 d8 fe ff ff jmp 49b <printf+0x4b> 5c3: 90 nop 5c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5c8: 8d 45 e5 lea -0x1b(%ebp),%eax } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5cb: 31 ff xor %edi,%edi #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 5cd: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 5d4: 00 5d5: 89 44 24 04 mov %eax,0x4(%esp) 5d9: 89 34 24 mov %esi,(%esp) 5dc: c6 45 e5 25 movb $0x25,-0x1b(%ebp) 5e0: e8 2d fd ff ff call 312 <write> 5e5: e9 b1 fe ff ff jmp 49b <printf+0x4b> 5ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 5f0: 8b 45 d4 mov -0x2c(%ebp),%eax 5f3: b9 0a 00 00 00 mov $0xa,%ecx } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 5f8: 66 31 ff xor %di,%di } else { putc(fd, c); } } else if(state == '%'){ if(c == 'd'){ printint(fd, *ap, 10, 1); 5fb: c7 04 24 01 00 00 00 movl $0x1,(%esp) 602: 8b 10 mov (%eax),%edx 604: 89 f0 mov %esi,%eax 606: e8 a5 fd ff ff call 3b0 <printint> ap++; 60b: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 60f: e9 87 fe ff ff jmp 49b <printf+0x4b> while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ putc(fd, *ap); 614: 8b 45 d4 mov -0x2c(%ebp),%eax } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; 617: 31 ff xor %edi,%edi while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ putc(fd, *ap); 619: 8b 00 mov (%eax),%eax #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 61b: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 622: 00 623: 89 34 24 mov %esi,(%esp) while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ putc(fd, *ap); 626: 88 45 e4 mov %al,-0x1c(%ebp) #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); 629: 8d 45 e4 lea -0x1c(%ebp),%eax 62c: 89 44 24 04 mov %eax,0x4(%esp) 630: e8 dd fc ff ff call 312 <write> putc(fd, *s); s++; } } else if(c == 'c'){ putc(fd, *ap); ap++; 635: 83 45 d4 04 addl $0x4,-0x2c(%ebp) 639: e9 5d fe ff ff jmp 49b <printf+0x4b> 63e: 66 90 xchg %ax,%ax 00000640 <free>: static Header base; static Header *freep; void free(void *ap) { 640: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 641: a1 70 0a 00 00 mov 0xa70,%eax static Header base; static Header *freep; void free(void *ap) { 646: 89 e5 mov %esp,%ebp 648: 57 push %edi 649: 56 push %esi 64a: 53 push %ebx 64b: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 64e: 8b 08 mov (%eax),%ecx void free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; 650: 8d 53 f8 lea -0x8(%ebx),%edx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 653: 39 d0 cmp %edx,%eax 655: 72 11 jb 668 <free+0x28> 657: 90 nop if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 658: 39 c8 cmp %ecx,%eax 65a: 72 04 jb 660 <free+0x20> 65c: 39 ca cmp %ecx,%edx 65e: 72 10 jb 670 <free+0x30> 660: 89 c8 mov %ecx,%eax free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 662: 39 d0 cmp %edx,%eax if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 664: 8b 08 mov (%eax),%ecx free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 666: 73 f0 jae 658 <free+0x18> 668: 39 ca cmp %ecx,%edx 66a: 72 04 jb 670 <free+0x30> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 66c: 39 c8 cmp %ecx,%eax 66e: 72 f0 jb 660 <free+0x20> break; if(bp + bp->s.size == p->s.ptr){ 670: 8b 73 fc mov -0x4(%ebx),%esi 673: 8d 3c f2 lea (%edx,%esi,8),%edi 676: 39 cf cmp %ecx,%edi 678: 74 1e je 698 <free+0x58> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 67a: 89 4b f8 mov %ecx,-0x8(%ebx) if(p + p->s.size == bp){ 67d: 8b 48 04 mov 0x4(%eax),%ecx 680: 8d 34 c8 lea (%eax,%ecx,8),%esi 683: 39 f2 cmp %esi,%edx 685: 74 28 je 6af <free+0x6f> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 687: 89 10 mov %edx,(%eax) freep = p; 689: a3 70 0a 00 00 mov %eax,0xa70 } 68e: 5b pop %ebx 68f: 5e pop %esi 690: 5f pop %edi 691: 5d pop %ebp 692: c3 ret 693: 90 nop 694: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ bp->s.size += p->s.ptr->s.size; 698: 03 71 04 add 0x4(%ecx),%esi 69b: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 69e: 8b 08 mov (%eax),%ecx 6a0: 8b 09 mov (%ecx),%ecx 6a2: 89 4b f8 mov %ecx,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 6a5: 8b 48 04 mov 0x4(%eax),%ecx 6a8: 8d 34 c8 lea (%eax,%ecx,8),%esi 6ab: 39 f2 cmp %esi,%edx 6ad: 75 d8 jne 687 <free+0x47> p->s.size += bp->s.size; 6af: 03 4b fc add -0x4(%ebx),%ecx p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; freep = p; 6b2: a3 70 0a 00 00 mov %eax,0xa70 bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ p->s.size += bp->s.size; 6b7: 89 48 04 mov %ecx,0x4(%eax) p->s.ptr = bp->s.ptr; 6ba: 8b 53 f8 mov -0x8(%ebx),%edx 6bd: 89 10 mov %edx,(%eax) } else p->s.ptr = bp; freep = p; } 6bf: 5b pop %ebx 6c0: 5e pop %esi 6c1: 5f pop %edi 6c2: 5d pop %ebp 6c3: c3 ret 6c4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 6ca: 8d bf 00 00 00 00 lea 0x0(%edi),%edi 000006d0 <malloc>: return freep; } void* malloc(uint nbytes) { 6d0: 55 push %ebp 6d1: 89 e5 mov %esp,%ebp 6d3: 57 push %edi 6d4: 56 push %esi 6d5: 53 push %ebx 6d6: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6d9: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 6dc: 8b 1d 70 0a 00 00 mov 0xa70,%ebx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6e2: 8d 48 07 lea 0x7(%eax),%ecx 6e5: c1 e9 03 shr $0x3,%ecx if((prevp = freep) == 0){ 6e8: 85 db test %ebx,%ebx malloc(uint nbytes) { Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 6ea: 8d 71 01 lea 0x1(%ecx),%esi if((prevp = freep) == 0){ 6ed: 0f 84 9b 00 00 00 je 78e <malloc+0xbe> 6f3: 8b 13 mov (%ebx),%edx 6f5: 8b 7a 04 mov 0x4(%edx),%edi base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ 6f8: 39 fe cmp %edi,%esi 6fa: 76 64 jbe 760 <malloc+0x90> 6fc: 8d 04 f5 00 00 00 00 lea 0x0(,%esi,8),%eax morecore(uint nu) { char *p; Header *hp; if(nu < 4096) 703: bb 00 80 00 00 mov $0x8000,%ebx 708: 89 45 e4 mov %eax,-0x1c(%ebp) 70b: eb 0e jmp 71b <malloc+0x4b> 70d: 8d 76 00 lea 0x0(%esi),%esi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 710: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 712: 8b 78 04 mov 0x4(%eax),%edi 715: 39 fe cmp %edi,%esi 717: 76 4f jbe 768 <malloc+0x98> 719: 89 c2 mov %eax,%edx p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 71b: 3b 15 70 0a 00 00 cmp 0xa70,%edx 721: 75 ed jne 710 <malloc+0x40> morecore(uint nu) { char *p; Header *hp; if(nu < 4096) 723: 8b 45 e4 mov -0x1c(%ebp),%eax 726: 81 fe 00 10 00 00 cmp $0x1000,%esi 72c: bf 00 10 00 00 mov $0x1000,%edi 731: 0f 43 fe cmovae %esi,%edi 734: 0f 42 c3 cmovb %ebx,%eax nu = 4096; p = sbrk(nu * sizeof(Header)); 737: 89 04 24 mov %eax,(%esp) 73a: e8 3b fc ff ff call 37a <sbrk> if(p == (char*)-1) 73f: 83 f8 ff cmp $0xffffffff,%eax 742: 74 18 je 75c <malloc+0x8c> return 0; hp = (Header*)p; hp->s.size = nu; 744: 89 78 04 mov %edi,0x4(%eax) free((void*)(hp + 1)); 747: 83 c0 08 add $0x8,%eax 74a: 89 04 24 mov %eax,(%esp) 74d: e8 ee fe ff ff call 640 <free> return freep; 752: 8b 15 70 0a 00 00 mov 0xa70,%edx } freep = prevp; return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) 758: 85 d2 test %edx,%edx 75a: 75 b4 jne 710 <malloc+0x40> return 0; 75c: 31 c0 xor %eax,%eax 75e: eb 20 jmp 780 <malloc+0xb0> 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){ if(p->s.size >= nunits){ 760: 89 d0 mov %edx,%eax 762: 89 da mov %ebx,%edx 764: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p->s.size == nunits) 768: 39 fe cmp %edi,%esi 76a: 74 1c je 788 <malloc+0xb8> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 76c: 29 f7 sub %esi,%edi 76e: 89 78 04 mov %edi,0x4(%eax) p += p->s.size; 771: 8d 04 f8 lea (%eax,%edi,8),%eax p->s.size = nunits; 774: 89 70 04 mov %esi,0x4(%eax) } freep = prevp; 777: 89 15 70 0a 00 00 mov %edx,0xa70 return (void*)(p + 1); 77d: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 780: 83 c4 1c add $0x1c,%esp 783: 5b pop %ebx 784: 5e pop %esi 785: 5f pop %edi 786: 5d pop %ebp 787: c3 ret base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ if(p->s.size >= nunits){ if(p->s.size == nunits) prevp->s.ptr = p->s.ptr; 788: 8b 08 mov (%eax),%ecx 78a: 89 0a mov %ecx,(%edx) 78c: eb e9 jmp 777 <malloc+0xa7> Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 78e: c7 05 70 0a 00 00 74 movl $0xa74,0xa70 795: 0a 00 00 base.s.size = 0; 798: ba 74 0a 00 00 mov $0xa74,%edx Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; 79d: c7 05 74 0a 00 00 74 movl $0xa74,0xa74 7a4: 0a 00 00 base.s.size = 0; 7a7: c7 05 78 0a 00 00 00 movl $0x0,0xa78 7ae: 00 00 00 7b1: e9 46 ff ff ff jmp 6fc <malloc+0x2c>
Cubical/Foundations/Univalence.agda
Edlyr/cubical
0
17375
<filename>Cubical/Foundations/Univalence.agda {- Proof of the standard formulation of the univalence theorem and various consequences of univalence - Re-exports Glue types from Cubical.Core.Glue - The ua constant and its computation rule (up to a path) - Proof of univalence using that unglue is an equivalence ([EquivContr]) - Equivalence induction ([EquivJ], [elimEquiv]) - Univalence theorem ([univalence]) - The computation rule for ua ([uaβ]) - Isomorphism induction ([elimIso]) -} {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Foundations.Univalence where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Function open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Equiv open import Cubical.Foundations.GroupoidLaws open import Cubical.Data.Sigma.Base open import Cubical.Core.Glue public using ( Glue ; glue ; unglue ; lineToEquiv ) open import Cubical.Reflection.StrictEquiv private variable ℓ ℓ' : Level -- The ua constant ua : ∀ {A B : Type ℓ} → A ≃ B → A ≡ B ua {A = A} {B = B} e i = Glue B (λ { (i = i0) → (A , e) ; (i = i1) → (B , idEquiv B) }) uaIdEquiv : {A : Type ℓ} → ua (idEquiv A) ≡ refl uaIdEquiv {A = A} i j = Glue A {φ = i ∨ ~ j ∨ j} (λ _ → A , idEquiv A) -- Propositional extensionality hPropExt : {A B : Type ℓ} → isProp A → isProp B → (A → B) → (B → A) → A ≡ B hPropExt Aprop Bprop f g = ua (propBiimpl→Equiv Aprop Bprop f g) -- the unglue and glue primitives specialized to the case of ua ua-unglue : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : ua e i) → B {- [ _ ↦ (λ { (i = i0) → e .fst x ; (i = i1) → x }) ] -} ua-unglue e i x = unglue (i ∨ ~ i) x ua-glue : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : Partial (~ i) A) (y : B [ _ ↦ (λ { (i = i0) → e .fst (x 1=1) }) ]) → ua e i {- [ _ ↦ (λ { (i = i0) → x 1=1 ; (i = i1) → outS y }) ] -} ua-glue e i x y = glue {φ = i ∨ ~ i} (λ { (i = i0) → x 1=1 ; (i = i1) → outS y }) (outS y) module _ {A B : Type ℓ} (e : A ≃ B) {x : A} {y : B} where -- sometimes more useful are versions of these functions with the (i : I) factored in ua-ungluePath : PathP (λ i → ua e i) x y → e .fst x ≡ y ua-ungluePath p i = ua-unglue e i (p i) ua-gluePath : e .fst x ≡ y → PathP (λ i → ua e i) x y ua-gluePath p i = ua-glue e i (λ { (i = i0) → x }) (inS (p i)) -- ua-ungluePath and ua-gluePath are definitional inverses ua-ungluePath-Equiv : (PathP (λ i → ua e i) x y) ≃ (e .fst x ≡ y) unquoteDef ua-ungluePath-Equiv = defStrictEquiv ua-ungluePath-Equiv ua-ungluePath ua-gluePath -- ua-unglue and ua-glue are also definitional inverses, in a way -- strengthening the types of ua-unglue and ua-glue gives a nicer formulation of this, see below ua-unglue-glue : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : Partial (~ i) A) (y : B [ _ ↦ _ ]) → ua-unglue e i (ua-glue e i x y) ≡ outS y ua-unglue-glue _ _ _ _ = refl ua-glue-unglue : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : ua e i) → ua-glue e i (λ { (i = i0) → x }) (inS (ua-unglue e i x)) ≡ x ua-glue-unglue _ _ _ = refl -- mainly for documentation purposes, ua-unglue and ua-glue wrapped in cubical subtypes ua-unglueS : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : A) (y : B) → ua e i [ _ ↦ (λ { (i = i0) → x ; (i = i1) → y }) ] → B [ _ ↦ (λ { (i = i0) → e .fst x ; (i = i1) → y }) ] ua-unglueS e i x y s = inS (ua-unglue e i (outS s)) ua-glueS : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : A) (y : B) → B [ _ ↦ (λ { (i = i0) → e .fst x ; (i = i1) → y }) ] → ua e i [ _ ↦ (λ { (i = i0) → x ; (i = i1) → y }) ] ua-glueS e i x y s = inS (ua-glue e i (λ { (i = i0) → x }) (inS (outS s))) ua-unglueS-glueS : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : A) (y : B) (s : B [ _ ↦ (λ { (i = i0) → e .fst x ; (i = i1) → y }) ]) → outS (ua-unglueS e i x y (ua-glueS e i x y s)) ≡ outS s ua-unglueS-glueS _ _ _ _ _ = refl ua-glueS-unglueS : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : A) (y : B) (s : ua e i [ _ ↦ (λ { (i = i0) → x ; (i = i1) → y }) ]) → outS (ua-glueS e i x y (ua-unglueS e i x y s)) ≡ outS s ua-glueS-unglueS _ _ _ _ _ = refl -- a version of ua-glue with a single endpoint, identical to `ua-gluePath e {x} refl i` ua-gluePt : ∀ {A B : Type ℓ} (e : A ≃ B) (i : I) (x : A) → ua e i {- [ _ ↦ (λ { (i = i0) → x ; (i = i1) → e .fst x }) ] -} ua-gluePt e i x = ua-glue e i (λ { (i = i0) → x }) (inS (e .fst x)) -- Proof of univalence using that unglue is an equivalence: -- unglue is an equivalence unglueIsEquiv : ∀ (A : Type ℓ) (φ : I) (f : PartialP φ (λ o → Σ[ T ∈ Type ℓ ] T ≃ A)) → isEquiv {A = Glue A f} (unglue φ) equiv-proof (unglueIsEquiv A φ f) = λ (b : A) → let u : I → Partial φ A u i = λ{ (φ = i1) → equivCtr (f 1=1 .snd) b .snd (~ i) } ctr : fiber (unglue φ) b ctr = ( glue (λ { (φ = i1) → equivCtr (f 1=1 .snd) b .fst }) (hcomp u b) , λ j → hfill u (inS b) (~ j)) in ( ctr , λ (v : fiber (unglue φ) b) i → let u' : I → Partial (φ ∨ ~ i ∨ i) A u' j = λ { (φ = i1) → equivCtrPath (f 1=1 .snd) b v i .snd (~ j) ; (i = i0) → hfill u (inS b) j ; (i = i1) → v .snd (~ j) } in ( glue (λ { (φ = i1) → equivCtrPath (f 1=1 .snd) b v i .fst }) (hcomp u' b) , λ j → hfill u' (inS b) (~ j))) -- Any partial family of equivalences can be extended to a total one -- from Glue [ φ ↦ (T,f) ] A to A unglueEquiv : ∀ (A : Type ℓ) (φ : I) (f : PartialP φ (λ o → Σ[ T ∈ Type ℓ ] T ≃ A)) → (Glue A f) ≃ A unglueEquiv A φ f = ( unglue φ , unglueIsEquiv A φ f ) -- The following is a formulation of univalence proposed by <NAME>: -- https://groups.google.com/forum/#!msg/homotopytypetheory/HfCB_b-PNEU/Ibb48LvUMeUJ -- See also Theorem 5.8.4 of the HoTT Book. -- -- The reason we have this formulation in the core library and not the -- standard one is that this one is more direct to prove using that -- unglue is an equivalence. The standard formulation can be found in -- Cubical/Basics/Univalence. -- EquivContr : ∀ (A : Type ℓ) → ∃![ T ∈ Type ℓ ] (T ≃ A) EquivContr {ℓ = ℓ} A = ( (A , idEquiv A) , idEquiv≡ ) where idEquiv≡ : (y : Σ (Type ℓ) (λ T → T ≃ A)) → (A , idEquiv A) ≡ y idEquiv≡ w = \ { i .fst → Glue A (f i) ; i .snd .fst → unglueEquiv _ _ (f i) .fst ; i .snd .snd .equiv-proof → unglueEquiv _ _ (f i) .snd .equiv-proof } where f : ∀ i → PartialP (~ i ∨ i) (λ x → Σ[ T ∈ Type ℓ ] T ≃ A) f i = λ { (i = i0) → A , idEquiv A ; (i = i1) → w } contrSinglEquiv : {A B : Type ℓ} (e : A ≃ B) → (B , idEquiv B) ≡ (A , e) contrSinglEquiv {A = A} {B = B} e = isContr→isProp (EquivContr B) (B , idEquiv B) (A , e) -- Equivalence induction EquivJ : {A B : Type ℓ} (P : (A : Type ℓ) → (e : A ≃ B) → Type ℓ') → (r : P B (idEquiv B)) → (e : A ≃ B) → P A e EquivJ P r e = subst (λ x → P (x .fst) (x .snd)) (contrSinglEquiv e) r -- Assuming that we have an inverse to ua we can easily prove univalence module Univalence (au : ∀ {ℓ} {A B : Type ℓ} → A ≡ B → A ≃ B) (aurefl : ∀ {ℓ} {A B : Type ℓ} → au refl ≡ idEquiv A) where ua-au : {A B : Type ℓ} (p : A ≡ B) → ua (au p) ≡ p ua-au {B = B} = J (λ _ p → ua (au p) ≡ p) (cong ua (aurefl {B = B}) ∙ uaIdEquiv) au-ua : {A B : Type ℓ} (e : A ≃ B) → au (ua e) ≡ e au-ua {B = B} = EquivJ (λ _ f → au (ua f) ≡ f) (subst (λ r → au r ≡ idEquiv _) (sym uaIdEquiv) (aurefl {B = B})) isoThm : ∀ {ℓ} {A B : Type ℓ} → Iso (A ≡ B) (A ≃ B) isoThm .Iso.fun = au isoThm .Iso.inv = ua isoThm .Iso.rightInv = au-ua isoThm .Iso.leftInv = ua-au thm : ∀ {ℓ} {A B : Type ℓ} → isEquiv au thm {A = A} {B = B} = isoToIsEquiv {B = A ≃ B} isoThm pathToEquiv : {A B : Type ℓ} → A ≡ B → A ≃ B pathToEquiv p = lineToEquiv (λ i → p i) pathToEquivRefl : {A : Type ℓ} → pathToEquiv refl ≡ idEquiv A pathToEquivRefl {A = A} = equivEq (λ i x → transp (λ _ → A) i x) pathToEquiv-ua : {A B : Type ℓ} (e : A ≃ B) → pathToEquiv (ua e) ≡ e pathToEquiv-ua = Univalence.au-ua pathToEquiv pathToEquivRefl ua-pathToEquiv : {A B : Type ℓ} (p : A ≡ B) → ua (pathToEquiv p) ≡ p ua-pathToEquiv = Univalence.ua-au pathToEquiv pathToEquivRefl -- Univalence univalenceIso : {A B : Type ℓ} → Iso (A ≡ B) (A ≃ B) univalenceIso = Univalence.isoThm pathToEquiv pathToEquivRefl univalence : {A B : Type ℓ} → (A ≡ B) ≃ (A ≃ B) univalence = ( pathToEquiv , Univalence.thm pathToEquiv pathToEquivRefl ) -- The original map from UniMath/Foundations eqweqmap : {A B : Type ℓ} → A ≡ B → A ≃ B eqweqmap {A = A} e = J (λ X _ → A ≃ X) (idEquiv A) e eqweqmapid : {A : Type ℓ} → eqweqmap refl ≡ idEquiv A eqweqmapid {A = A} = JRefl (λ X _ → A ≃ X) (idEquiv A) univalenceStatement : {A B : Type ℓ} → isEquiv (eqweqmap {ℓ} {A} {B}) univalenceStatement = Univalence.thm eqweqmap eqweqmapid univalenceUAH : {A B : Type ℓ} → (A ≡ B) ≃ (A ≃ B) univalenceUAH = ( _ , univalenceStatement ) univalencePath : {A B : Type ℓ} → (A ≡ B) ≡ Lift (A ≃ B) univalencePath = ua (compEquiv univalence LiftEquiv) -- The computation rule for ua. Because of "ghcomp" it is now very -- simple compared to cubicaltt: -- https://github.com/mortberg/cubicaltt/blob/master/examples/univalence.ctt#L202 uaβ : {A B : Type ℓ} (e : A ≃ B) (x : A) → transport (ua e) x ≡ equivFun e x uaβ e x = transportRefl (equivFun e x) uaη : ∀ {A B : Type ℓ} → (P : A ≡ B) → ua (pathToEquiv P) ≡ P uaη = J (λ _ q → ua (pathToEquiv q) ≡ q) (cong ua pathToEquivRefl ∙ uaIdEquiv) -- Lemmas for constructing and destructing dependent paths in a function type where the domain is ua. ua→ : ∀ {ℓ ℓ'} {A₀ A₁ : Type ℓ} {e : A₀ ≃ A₁} {B : (i : I) → Type ℓ'} {f₀ : A₀ → B i0} {f₁ : A₁ → B i1} → ((a : A₀) → PathP B (f₀ a) (f₁ (e .fst a))) → PathP (λ i → ua e i → B i) f₀ f₁ ua→ {e = e} {f₀ = f₀} {f₁} h i a = hcomp (λ j → λ { (i = i0) → f₀ a ; (i = i1) → f₁ (lem a j) }) (h (transp (λ j → ua e (~ j ∧ i)) (~ i) a) i) where lem : ∀ a₁ → e .fst (transport (sym (ua e)) a₁) ≡ a₁ lem a₁ = retEq e _ ∙ transportRefl _ ua→⁻ : ∀ {ℓ ℓ'} {A₀ A₁ : Type ℓ} {e : A₀ ≃ A₁} {B : (i : I) → Type ℓ'} {f₀ : A₀ → B i0} {f₁ : A₁ → B i1} → PathP (λ i → ua e i → B i) f₀ f₁ → ((a : A₀) → PathP B (f₀ a) (f₁ (e .fst a))) ua→⁻ {e = e} {f₀ = f₀} {f₁} p a i = hcomp (λ k → λ { (i = i0) → f₀ a ; (i = i1) → f₁ (uaβ e a k) }) (p i (transp (λ j → ua e (j ∧ i)) (~ i) a)) -- Useful lemma for unfolding a transported function over ua -- If we would have regularity this would be refl transportUAop₁ : ∀ {A B : Type ℓ} → (e : A ≃ B) (f : A → A) (x : B) → transport (λ i → ua e i → ua e i) f x ≡ equivFun e (f (invEq e x)) transportUAop₁ e f x i = transportRefl (equivFun e (f (invEq e (transportRefl x i)))) i -- Binary version transportUAop₂ : ∀ {ℓ} {A B : Type ℓ} → (e : A ≃ B) (f : A → A → A) (x y : B) → transport (λ i → ua e i → ua e i → ua e i) f x y ≡ equivFun e (f (invEq e x) (invEq e y)) transportUAop₂ e f x y i = transportRefl (equivFun e (f (invEq e (transportRefl x i)) (invEq e (transportRefl y i)))) i -- Alternative version of EquivJ that only requires a predicate on functions elimEquivFun : {A B : Type ℓ} (P : (A : Type ℓ) → (A → B) → Type ℓ') → (r : P B (idfun B)) → (e : A ≃ B) → P A (e .fst) elimEquivFun P r e = subst (λ x → P (x .fst) (x .snd .fst)) (contrSinglEquiv e) r -- Isomorphism induction elimIso : {B : Type ℓ} → (Q : {A : Type ℓ} → (A → B) → (B → A) → Type ℓ') → (h : Q (idfun B) (idfun B)) → {A : Type ℓ} → (f : A → B) → (g : B → A) → section f g → retract f g → Q f g elimIso {ℓ} {ℓ'} {B} Q h {A} f g sfg rfg = rem1 f g sfg rfg where P : (A : Type ℓ) → (f : A → B) → Type (ℓ-max ℓ' ℓ) P A f = (g : B → A) → section f g → retract f g → Q f g rem : P B (idfun B) rem g sfg rfg = subst (Q (idfun B)) (λ i b → (sfg b) (~ i)) h rem1 : {A : Type ℓ} → (f : A → B) → P A f rem1 f g sfg rfg = elimEquivFun P rem (f , isoToIsEquiv (iso f g sfg rfg)) g sfg rfg uaInvEquiv : ∀ {A B : Type ℓ} → (e : A ≃ B) → ua (invEquiv e) ≡ sym (ua e) uaInvEquiv {B = B} = EquivJ (λ _ e → ua (invEquiv e) ≡ sym (ua e)) (cong ua (invEquivIdEquiv B)) uaCompEquiv : ∀ {A B C : Type ℓ} → (e : A ≃ B) (f : B ≃ C) → ua (compEquiv e f) ≡ ua e ∙ ua f uaCompEquiv {B = B} {C} = EquivJ (λ _ e → (f : B ≃ C) → ua (compEquiv e f) ≡ ua e ∙ ua f) (λ f → cong ua (compEquivIdEquiv f) ∙ sym (cong (λ x → x ∙ ua f) uaIdEquiv ∙ sym (lUnit (ua f))))
Programs/Program4.asm
trivedi-vatsal/8085-programs
2
165134
<filename>Programs/Program4.asm ;Exchange the contents of memory locations 1000H and 2000H LXI H,1000H ;initlize HL register pair as a pointer to memory location 1000h LXI D,2000H ;initialize DE register pair as a pointer to memory location 2000h MOV B,M ;get the contents of memory location 1000h into B register LDAX D ;get the contents of memory location 2000h into A register MOV M,A ;store the contents of A register into memory location 1000h MOV A,B ;copy the contents of B register into accumulator STAX D ;store the contents of A register into memory location 2000H HLT ;terminate program execution
_build/dispatcher/jmp_ippsGFpIsUnityElement_9c83155f.asm
zyktrcn/ippcp
1
239
extern m7_ippsGFpIsUnityElement:function extern n8_ippsGFpIsUnityElement:function extern y8_ippsGFpIsUnityElement:function extern e9_ippsGFpIsUnityElement:function extern l9_ippsGFpIsUnityElement:function extern n0_ippsGFpIsUnityElement:function extern k0_ippsGFpIsUnityElement:function extern ippcpJumpIndexForMergedLibs extern ippcpSafeInit:function segment .data align 8 dq .Lin_ippsGFpIsUnityElement .Larraddr_ippsGFpIsUnityElement: dq m7_ippsGFpIsUnityElement dq n8_ippsGFpIsUnityElement dq y8_ippsGFpIsUnityElement dq e9_ippsGFpIsUnityElement dq l9_ippsGFpIsUnityElement dq n0_ippsGFpIsUnityElement dq k0_ippsGFpIsUnityElement segment .text global ippsGFpIsUnityElement:function (ippsGFpIsUnityElement.LEndippsGFpIsUnityElement - ippsGFpIsUnityElement) .Lin_ippsGFpIsUnityElement: db 0xf3, 0x0f, 0x1e, 0xfa call ippcpSafeInit wrt ..plt align 16 ippsGFpIsUnityElement: db 0xf3, 0x0f, 0x1e, 0xfa mov rax, qword [rel ippcpJumpIndexForMergedLibs wrt ..gotpc] movsxd rax, dword [rax] lea r11, [rel .Larraddr_ippsGFpIsUnityElement] mov r11, qword [r11+rax*8] jmp r11 .LEndippsGFpIsUnityElement:
source/context/webidl-contexts.ads
reznikmm/webidl
0
15916
<gh_stars>0 -- SPDX-FileCopyrightText: 2021 <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: MIT ------------------------------------------------------------- with League.String_Vectors; package WebIDL.Contexts is pragma Preelaborate; type Context is tagged limited private; private type Context is tagged limited record null; end record; end WebIDL.Contexts;
oeis/110/A110892.asm
neoneye/loda-programs
11
23400
<filename>oeis/110/A110892.asm<gh_stars>10-100 ; A110892: Sum of the squares of digits of n^2. ; Submitted by <NAME> ; 1,16,81,37,29,45,97,52,65,1,6,33,118,118,33,65,149,29,46,16,33,96,110,110,65,121,134,129,81,81,118,21,146,63,34,122,127,49,31,37,102,102,162,127,33,42,89,29,21,29,41,69,149,122,38,55,110,70,90,45,63,105,207,133 add $0,1 pow $0,2 lpb $0 mov $2,$0 div $0,10 mod $2,10 pow $2,2 add $1,$2 lpe mov $0,$1
src/vulkan-math/genmatrix/vulkan-math-genmatrix.ads
zrmyers/VulkanAda
1
3118
-------------------------------------------------------------------------------- -- MIT License -- -- Copyright (c) 2020 <NAME> -- -- 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, 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 -- AUTHORS OR 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. -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- --< @group Vulkan Math GenMatrix -------------------------------------------------------------------------------- --< @summary --< This generic package provides constructors, getters, and setters for generic --< matrix types. --< --< @description --< The Vkm_Matrix type is a generic floating point matrix that can contain up to --< 4 rows and 4 columns. -------------------------------------------------------------------------------- generic type Base_Type is digits <>; type Base_Vector_Type (<>) is tagged private; with function Image (instance : Base_Vector_Type) return String; ---------------------------------------------------------------------------- --< @summary --< Retrieve the x-component of the vector. --< --< @description --< Retrieve the x-component of the vector. --< --< @param vec --< The vector to retrieve the x-component from. --< --< @return --< The x-component of the vector. ---------------------------------------------------------------------------- with function x (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the y-component of the vector. --< --< @description --< Retrieve the y-component of the vector. --< --< @param vec --< The vector to retrieve the y-component from. --< --< @return --< The y-component of the vector. ---------------------------------------------------------------------------- with function y (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the z-component of the vector. --< --< @description --< Retrieve the z-component of the vector. --< --< @param vec --< The vector to retrieve the z-component from. --< --< @return --< The z-component of the vector. ---------------------------------------------------------------------------- with function z (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Retrieve the w-component of the vector. --< --< @description --< Retrieve the w-component of the vector. --< --< @param vec --< The vector to retrieve the w-component from. --< --< @return --< The w-component of the vector. ---------------------------------------------------------------------------- with function w (vec : in Base_Vector_Type) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Set the component of the vector. --< --< @description --< Set the component of the vector. --< --< @param vec --< The vector to set the component for. --< ---------------------------------------------------------------------------- with procedure Set(vec : in out Base_Vector_Type; index : in Vkm_Indices; value : in Base_Type); with function Get(vec : in Base_Vector_Type; index : in Vkm_Indices) return Base_Type; ---------------------------------------------------------------------------- --< @summary --< Construct a Base_Vector_Type. --< --< @description --< Construct a Base_Vector_Type. --< --< @param size --< The number of components in the Base_Vector_Type. --< --< @param value1 --< The value to set for the x-component of the Base_Vector_Type. --< --< @param value2 --< The value to set for the y-component of the Base_Vector_Type. --< --< @param value3 --< The value to set for the z-component of the Base_Vector_Type. --< --< @param value4 --< The value to set for the w-component of the Base_Vector_Type. --< --< @return --< The w-component of the vector. ---------------------------------------------------------------------------- with function Make_GenType ( size : in Vkm_Length; value1, value2, value3, value4 : in Base_Type := 0.0) return Base_Vector_Type; package Vulkan.Math.GenMatrix is pragma Preelaborate; pragma Pure; INCOMPATIBLE_MATRICES : exception; ---------------------------------------------------------------------------- -- Types ---------------------------------------------------------------------------- --< The matrix type is a 2D array with indices in the range of the Vkm_Indices --< type [0 .. 3]. Because of this, the number of columns is 1-4 and the --< number of rows is 1-4. type Vkm_Matrix is array(Vkm_Indices range <>, Vkm_Indices range <>) of aliased Base_Type; pragma Convention(C,Vkm_Matrix); --< The matrix is a discriminant tagged record which encapsulates the --< Vkm_Matrix type. This allows use of "." to perform functions on an --< instance of matrix. --< --< @field last_column_index --< The discriminant, last_column_index, determines the number of columns in the --< matrix. --< --< @field last_row_index --< The discriminant, last_row_index, determines the number of rows in the matrix. --< --< @field data --< The matrix data for the record. This information is able to be --< passed to a C/C++ context. type Vkm_GenMatrix(last_column_index : Vkm_Indices; last_row_index : Vkm_Indices) is tagged record data : Vkm_Matrix(Vkm_Indices'First .. last_column_index, Vkm_Indices'First .. last_row_index); end record; --< A reference to a generic matrix type. The Vkm_GenMatrix instance is --< automatically dereferenced on use. type Vkm_GenMatrix_Reference(instance : not null access Vkm_GenMatrix) is null record with Implicit_Dereference => instance; ---------------------------------------------------------------------------- --< @summary --< The image of the matrix --< --< @description --< Generates a human readable string which contains the contents of the --< instance of Vkm_GenMatrix. For a 2x2 matrix, this appears as a list of --< the row vectors --< --< "[ " & Image(mat.r0) & ", " & Image(mat.r1) & " ]" --< --< The Image() subprogram that is supplied during generic instantiation is used --< to print the component of Base_Vector_Type. --< --< @param instance --< The instance of Vkm_GenMatrix. --< --< @return --< The human readable image of the matrix ---------------------------------------------------------------------------- function Image (instance : in Vkm_GenMatrix) return String; ---------------------------------------------------------------------------- -- Element Getters ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Gets the value of an element at the specified column and row index. --< --< @param instance --< The Vkm_GenMatrix instance to get the element value of. --< --< @param col_index --< The index of the column at which to get an element. --< --< @param row_index --< The index of the row at which to get an element. --< --< @return --< The value of the specified element. ---------------------------------------------------------------------------- function Element(instance : in Vkm_GenMatrix; col_index, row_index : in Vkm_Indices) return Base_Type; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c0r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 0, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c1r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 1, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c2r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 2, 3)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r0 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 0)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r1 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 1)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r2 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 2)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to retrieve the element from. --< --< @return --< The element from the matrix. function c3r3 (instance : in Vkm_GenMatrix) return Base_Type is (Element(instance, 3, 3)) with Inline; ---------------------------------------------------------------------------- -- Element Setters ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Sets the element at the specified column and row index to a value. --< --< @param instance --< The Vkm_GenMatrix instance to set the element of. --< --< @param col_index --< The index of the column at which to set an element. --< --< @param row_index --< The index of the row at which to set an element. --< --< @param value --< The value to set the specified element. ---------------------------------------------------------------------------- procedure Element( instance : in out Vkm_GenMatrix; col_index, row_index : in Vkm_Indices; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c0r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c1r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c2r3( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r0( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r1( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r2( instance : in out Vkm_GenMatrix; value : in Base_Type); --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. procedure c3r3( instance : in out Vkm_GenMatrix; value : in Base_Type); ---------------------------------------------------------------------------- --< @summary --< Vkm_GenMatrix element accessor. --< --< @description --< Sets the element at the specified column and row index to a value. A --< reference to the matrix is returned upon completion. --< --< @param instance --< The Vkm_GenMatrix instance to set the element of. --< --< @param col_index --< The index of the column at which to set an element. --< --< @param row_index --< The index of the row at which to set an element. --< --< @param value --< The value to set the specified element. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Element( instance : in out Vkm_GenMatrix; col_index, row_index : in Vkm_Indices ; value : in Base_Type ) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c0r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 0, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c1r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 1, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c2r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 2, 3, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r0 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 0, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r1 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 1, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r2 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 2, value)) with Inline; --< @private --< This is a named accessor for an element of an instance of Vkm_GenMatrix. --< --< @param instance --< The Instance of Vkm_GenMatrix to set the element for. --< --< @param value --< The value to set for the matrix element. --< --< @return --< A reference to the modified matrix instance. function c3r3 ( instance : in out Vkm_GenMatrix; value : in Base_Type ) return Vkm_GenMatrix_Reference is (Element(instance, 3, 3, value)) with Inline; ---------------------------------------------------------------------------- -- Column Accessors ---------------------------------------------------------------------------- --< @summary --< Get the indicated column of the matrix as a vector. --< --< @description --< Retrieve the indicated column of the matrix as a vector: --< --< cI := [ instance.cIr0 instance.cIr1 ... instance.cIrN ] --< --< @param instance --< The instance of Vkm_GenMatrix from which the column is retrieved. --< --< @param col_index --< The index of the column to retrieve from the matrix. --< --< @return --< The vector that contains all elements in the indicated column. ---------------------------------------------------------------------------- function Column ( instance : in Vkm_GenMatrix; col_index : in Vkm_Indices) return Base_Vector_Type is (Make_GenType( To_Vkm_Length(instance.last_row_index), instance.Element(col_index, 0), instance.Element(col_index, 1), instance.Element(col_index, 2), instance.Element(col_index, 3))) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c0 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 0)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c1 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 1)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c2 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 2)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a column. --< --< @return --< The indicated column from the matrix. function c3 ( instance : in Vkm_GenMatrix) return Base_Vector_Type is (Column(instance, 3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Set the indicated column of the matrix given a vector. --< --< @description --< Sets the indicated column of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the column is set. --< --< @param col_index --< The index of the column to set for the matrix. --< --< @param col_val --< The vector value to set the column to. ---------------------------------------------------------------------------- procedure Column ( instance : in out Vkm_GenMatrix; col_index : in Vkm_Indices; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c0 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c1 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c2 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. procedure c3 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type); ---------------------------------------------------------------------------- --< @summary --< Set the indicated column of the matrix given a vector. --< --< @description --< Sets the indicated column of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the column is set. --< --< @param col_index --< The index of the column to set for the matrix. --< --< @param col_val --< The vector value to set the column to. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Column( instance : in out Vkm_GenMatrix; col_index : in Vkm_Indices ; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c0 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 0, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c1 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 1, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c2 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 2, col_val)) with Inline; --< @private --< This is a named accessor for a column of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a column. --< --< @param col_val --< The vector to set the column equal to. --< --< @return --< A reference to the instance of Vkm_GenMatrix. function c3 ( instance : in out Vkm_GenMatrix; col_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Column(instance, 3, col_val)) with Inline; ---------------------------------------------------------------------------- -- Row Accessors ---------------------------------------------------------------------------- --< @summary --< Get the indicated row of the matrix as a vector. --< --< @description --< Retrieve the indicated row of the matrix as a vector: --< --< rI := [ instance.c0rI instance.c1rI ... instance.cNrI ] --< --< @param instance --< The instance of Vkm_GenMatrix from which the row is retrieved. --< --< @param row_index --< The index of the row to retrieve from the matrix. --< --< @return --< The vector that contains all elements in the indicated row. ---------------------------------------------------------------------------- function Row ( instance : in Vkm_GenMatrix; row_index : in Vkm_Indices) return Base_Vector_Type is (Make_GenType( To_Vkm_Length(instance.last_column_index), instance.Element(0, row_index), instance.Element(1, row_index), instance.Element(2, row_index), instance.Element(3, row_index))) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r0 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 0)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r1 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 1)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r2 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 2)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix from which to retrieve a row. --< --< @return --< The indicated row from the matrix. function r3 (instance : in Vkm_GenMatrix) return Base_Vector_Type is (Row(instance, 3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Set the indicated row of the matrix given a vector. --< --< @description --< Sets the indicated row of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the row is set. --< --< @param row_index --< The index of the row to set for the matrix. --< --< @param row_val --< The vector value to set the row to. ---------------------------------------------------------------------------- procedure Row ( instance : in out Vkm_GenMatrix; row_index : in Vkm_Indices; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r0 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r1 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r2 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. procedure r3 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type); ---------------------------------------------------------------------------- --< @summary --< Set the indicated row of the matrix given a vector. --< --< @description --< Sets the indicated row of the matrix to the specified value. --< --< @param instance --< The instance of Vkm_GenMatrix for which the row is set. --< --< @param row_index --< The index of the row to set for the matrix. --< --< @param row_val --< The vector value to set the row to. --< --< @return --< A reference to the Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Row ( instance : in out Vkm_GenMatrix; row_index : in Vkm_Indices; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r0 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 0, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r1 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 1, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r2 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 2, row_val)) with Inline; --< @private --< This is a named accessor for a row of an instance of Vkm_GenMatrix. --< --< @param instance --< The instance of Vkm_GenMatrix for which to set a row. --< --< @param row_val --< The the value to set a row of the matrix to. --< --< @return --< A reference to the modified matrix. function r3 ( instance : in out Vkm_GenMatrix; row_val : in Base_Vector_Type) return Vkm_GenMatrix_Reference is (Row(instance, 3, row_val)) with Inline; ---------------------------------------------------------------------------- -- Operations ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | c0r0_val c1r0_val c2r0_val c3r0_val | --< r1 | c0r1_val c1r1_val c2r1_val c3r1_val | --< r2 | c0r2_val c1r2_val c2r2_val c3r2_val | --< r3 | c0r3_val c1r3_val c2r3_val c3r3_val | --< rN --< --< If no value is supplied for an element a default value of 0.0 is used. --< If the indices in the element name are not within matrix bounds, value --< specifiedis ignored. --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param c0r0_val --< The value to set for the element at column 0 and row 0. --< --< @param c0r1_val --< The value to set for the element at column 0 and row 1. --< --< @param c0r2_val --< The value to set for the element at column 0 and row 2. --< --< @param c0r3_val --< The value to set for the element at column 0 and row 3. --< --< @param c1r0_val --< The value to set for the element at column 1 and row 0. --< --< @param c1r1_val --< The value to set for the element at column 1 and row 1. --< --< @param c1r2_val --< The value to set for the element at column 1 and row 2. --< --< @param c1r3_val --< The value to set for the element at column 1 and row 3. --< --< @param c2r0_val --< The value to set for the element at column 2 and row 0. --< --< @param c2r1_val --< The value to set for the element at column 2 and row 1. --< --< @param c2r2_val --< The value to set for the element at column 2 and row 2. --< --< @param c2r3_val --< The value to set for the element at column 2 and row 3. --< --< @param c3r0_val --< The value to set for the element at column 3 and row 0. --< --< @param c3r1_val --< The value to set for the element at column 3 and row 1. --< --< @param c3r2_val --< The value to set for the element at column 3 and row 2. --< --< @param c3r3_val --< The value to set for the element at column 3 and row 3. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; c0r0_val, c0r1_val, c0r2_val, c0r3_val, c1r0_val, c1r1_val, c1r2_val, c1r3_val, c2r0_val, c2r1_val, c2r2_val, c2r3_val, c3r0_val, c3r1_val, c3r2_val, c3r3_val : in Base_Type := 0.0) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | diag 0.0 0.0 0.0 | --< r1 | 0.0 diag 0.0 0.0 | --< r2 | 0.0 0.0 diag 0.0 | --< r3 | 0.0 0.0 0.0 diag | --< rN --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param diag --< The value to set on the diagonal. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; diag : in Base_Type) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => diag, c1r1_val => diag, c2r2_val => diag, c3r3_val => diag)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | sub.c0r0 sub.c1r0 sub.c2r0 sub.c3r0 | --< r1 | sub.c0r1 sub.c1r1 sub.c2r1 sub.c3r1 | --< r2 | sub.c0r2 sub.c1r2 sub.c2r2 sub.c3r2 | --< r3 | sub.c0r3 sub.c1r3 sub.c2r3 sub.c3r3 | --< rN --< --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param sub --< The submatrix used to initialize elements of the new instance of matrix. --< If an element is out of bounds for the submatrix, the corresponding value --< of the identity matrix is used instead. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; sub : in Vkm_GenMatrix) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => sub.c0r0, c0r1_val => sub.c0r1, c0r2_val => sub.c0r2, c0r3_val => sub.c0r3, c1r0_val => sub.c1r0, c1r1_val => sub.c1r1, c1r2_val => sub.c1r2, c1r3_val => sub.c1r3, c2r0_val => sub.c2r0, c2r1_val => sub.c2r1, c2r2_val => sub.c2r2, c2r3_val => sub.c2r3, c3r0_val => sub.c3r0, c3r1_val => sub.c3r1, c3r2_val => sub.c3r2, c3r3_val => sub.c3r3)) with Inline; ---------------------------------------------------------------------------- --< @summary --< Constructor for Vkm_GenMatrix type. --< --< @description --< Creates a new instance of Vkm_GenMatrix with the indicated number of rows --< and columns. Each element is initialized as specified: --< --< \ c0 c1 c2 c3 cN --< r0 | diag.x 0.0 0.0 0.0 | --< r1 | 0.0 diag.y 0.0 0.0 | --< r2 | 0.0 0.0 diag.z 0.0 | --< r3 | 0.0 0.0 0.0 diag.w | --< rN --< --< @param cN --< The last index that can be used for accessing columns in the matrix. --< --< @param rN --< The last index that can be used for accessing rows in the matrix. --< --< @param diag --< The value to set on the diagonal. --< --< @return --< The new Vkm_GenMatrix instance. ---------------------------------------------------------------------------- function Make_GenMatrix( cN, rN : in Vkm_Indices; diag : in Base_Vector_Type) return Vkm_GenMatrix is (Make_GenMatrix( cN => cN, rN => rN, c0r0_val => x(diag), c1r1_val => y(diag), c2r2_val => z(diag), c3r3_val => w(diag))) with Inline; ---------------------------------------------------------------------------- --< @summary --< Determine whether two matrices are equal to each other. --< --< @description --< Determines whether every element of the two matrices are equal to each --< other. --< --< @param left --< The variable that is to the left of the equality operator. --< --< @param right --< The variable that is to the right of the equality operator. --< --< @return --< True if the matrices are equal to each other. Otherwise, false. ---------------------------------------------------------------------------- function Op_Is_Equal( left, right : in Vkm_GenMatrix) return Vkm_Bool; ---------------------------------------------------------------------------- --< @summary --< Linear algebraic matrix multiplication --< --< @description --< Perform linear algebraic matrix multiplication for the two matrices. --< --< @param left --< The left matrix in the computation. --< --< @param right --< The right matrix in the computation. --< --< The result of linear algebraic multiplication for the two matrices. ---------------------------------------------------------------------------- function Op_Matrix_Mult_Matrix ( left, right : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Multiplication operator for a Vkm_GenMatrix matrix and a Vkm_GenFType value. --< --< @description --< Perform Multiplication component-wise on the matrix and vector. --< --< @param left --< The matrix that is multiplied with the vector. --< --< @param right --< The vector that is multiplied by the matrix. --< --< @return --< The product of the matrix with the vector. ---------------------------------------------------------------------------- function Op_Matrix_Mult_Vector ( left : in Vkm_GenMatrix; right : in Base_Vector_Type ) return Base_Vector_Type; ---------------------------------------------------------------------------- --< @summary --< Multiplication operator for a Vkm_GenMatrix matrix and a Vkm_GenFType value. --< --< @description --< Perform Multiplication component-wise on the matrix and vector. --< --< @param left --< The vector that is multiplied with the matrix. --< --< @param right --< The matrix that is multiplied by the vector. --< --< @return --< The product of the vector with the matrix. ---------------------------------------------------------------------------- function Op_Vector_Mult_Matrix ( left : in Base_Vector_Type; right : in Vkm_GenMatrix) return Base_Vector_Type; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix --< --< @description --< Applies function component-wise on a matrix, yielding the following --< matrix: --< --< | Func(im1.c0r0) ... Func(im1.cNr0) | --< | ... ... | --< | Func(im1.c0rN) ... Func(im1.cNrN) | --< --< @param im1 --< The input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on a --< matrix. ---------------------------------------------------------------------------- generic with function Func (is1 : in Base_Type) return Base_Type; function Apply_Func_IM_RM (im1 : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on two matrices. --< --< @description --< Applies function component-wise on two matrices, yielding the following --< matrix: --< --< | Func(im1.c0r0, im2.c0r0) ... Func(im1.cNr0, im2.cNr0) | --< | ... ... | --< | Func(im1.c0rN, im2.c0rN) ... Func(im1.cNrN, im2.cNrN) | --< --< @param im1 --< The first input Vkm_GenMatrix parameter. --< --< @param im2 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IM_IM_RM (im1, im2 : in Vkm_GenMatrix) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix and a scalar. --< --< @description --< Applies function component-wise on a matrix and a scalar, yielding the --< following matrix: --< --< | Func(im1.c0r0, is1) ... Func(im1.cNr0, is1) | --< | ... ... | --< | Func(im1.c0rN, is1) ... Func(im1.cNrN, is1) | --< --< @param im1 --< The first input Vkm_GenMatrix parameter. --< --< @param is1 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IM_IS_RM ( im1 : in Vkm_GenMatrix; is1 : in Base_Type ) return Vkm_GenMatrix; ---------------------------------------------------------------------------- --< @summary --< Apply function component-wise on a matrix and a scalar. --< --< @description --< Applies function component-wise on a matrix and a scalar, yielding the --< following matrix: --< --< | Func(is1, im1.c0r0) ... Func(is1, im1.cNr0) | --< | ... ... | --< | Func(is1, im1.c0rN) ... Func(is1, im1.cNrN) | --< --< @param is1 --< The first input Vkm_GenMatrix parameter. --< --< @param im1 --< The second input Vkm_GenMatrix parameter. --< --< @return --< The result from applying the generic function Func component-wise on both --< matrices. ---------------------------------------------------------------------------- generic with function Func (is1, is2 : in Base_Type) return Base_Type; function Apply_Func_IS_IM_RM ( is1 : in Base_Type; im1 : in Vkm_GenMatrix) return Vkm_GenMatrix; end Vulkan.Math.GenMatrix;
oeis/245/A245020.asm
neoneye/loda-programs
11
179065
; A245020: Number of ordered n-tuples of positive integers, whose minimum is 0 and maximum is 5. ; Submitted by <NAME> ; 0,2,30,302,2550,19502,140070,963902,6433590,41983502,269335110,1705278302,10686396630,66425568302,410223570150,2520229093502,15417960407670,93999281613902,571487645261190,3466523088409502,20987674370482710,126870924446280302 add $0,1 lpb $0 sub $0,1 max $2,26 mul $2,5 div $3,2 mul $3,8 add $3,$1 mul $1,6 add $1,$2 lpe mov $0,$3 div $0,65
YouAnimate/src/parser/YouAnimateParser.g4
sassansh/Small-DSL
0
7119
<filename>YouAnimate/src/parser/YouAnimateParser.g4<gh_stars>0 parser grammar YouAnimateParser; options { tokenVocab=YouAnimateLexer; } program : canvasColour statement+ ; canvasColour: CANVAS_COLOUR COLOUR ; statement: shapeDec | textDec | groupDec | animationDef | loop | funcCall | animStatement; shapeDec: SHAPE_START TEXT COLON COLOUR SHAPE (RADIUS NUM | HEIGHT NUM | WIDTH NUM | BASE NUM | DEPTH NUM)+; textDec: TEXT_START TEXT COLON COLOUR FREE_TEXT FONT_SIZE NUM ; groupDec: GROUP_START TEXT IS TEXT (GROUP_ON TEXT)+ ; xyCord: NUM_PARAM_START NUM (PLUS TEXT)? NUM_PARAM_SEP NUM (PLUS TEXT)? NUM_PARAM_END ; move: MOVE_START TEXT FROM xyCord TO xyCord STARTING_AT TEXT FOR TEXT ; stay: STAY_START TEXT AT xyCord STARTING_AT TEXT FOR TEXT ; rotate: ROTATE_START TEXT AT xyCord STARTING_AT TEXT FOR TEXT ; animStatement: move | stay | rotate ; loop: LOOP_START TEXT FROM NUM_PARAM_START NUM NUM_PARAM_END TO NUM_PARAM_START NUM NUM_PARAM_END LOOP_INCREMENT NUM COLON loopStatement+ ; loopStatement: funcCall | animStatement ; input: TEXT_PARAM_START TEXT TEXT_PARAM_SEP TEXT (MULTIPLY TEXT|PLUS TEXT)? TEXT_PARAM_END ; funcCall: (FUNC_START | FUNC_REPEAT NUM FUNC_TIMES) TEXT input STARTING_AT TEXT ; animationDef: ANIMATION_DEF_START TEXT WITH_INPUT input COLON (animStatement)+ ;
AgdaCombinatoricsEverything.agda
rei1024/agda-combinatorics
3
5126
------------------------------------------------------------------------ -- agda-combinatorics -- All modules ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module AgdaCombinatoricsEverything where import Math.BinomialTheorem.Generic -- Proof of the binomial theorem import Math.BinomialTheorem.Nat -- Definitions of combinatorial functions import Math.Combinatorics.Function -- Properties of combinatorial functions import Math.Combinatorics.Function.Properties -- Definitions of combinatorial functions on integer import Math.Combinatorics.IntegerFunction -- Properties of combinatorial functions on integer import Math.Combinatorics.IntegerFunction.Properties import Math.Combinatorics.ListFunction import Math.Combinatorics.ListFunction.Properties import Math.Combinatorics.VecFunction
Validation/pyFrame3DD-master/gcc-master/gcc/ada/lib-load.adb
djamal2727/Main-Bearing-Analytical-Model
0
5801
<reponame>djamal2727/Main-Bearing-Analytical-Model ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- L I B . L O A D -- -- -- -- B o d y -- -- -- -- 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. -- -- -- ------------------------------------------------------------------------------ with Atree; use Atree; with Debug; use Debug; with Einfo; use Einfo; with Errout; use Errout; with Fname; use Fname; with Fname.UF; use Fname.UF; with Nlists; use Nlists; with Nmake; use Nmake; with Opt; use Opt; with Osint; use Osint; with Osint.C; use Osint.C; with Output; use Output; with Par; with Restrict; use Restrict; with Scn; use Scn; with Sinfo; use Sinfo; with Sinput; use Sinput; with Sinput.L; use Sinput.L; with Stand; use Stand; with Tbuild; use Tbuild; with Uname; use Uname; package body Lib.Load is ----------------------- -- Local Subprograms -- ----------------------- function From_Limited_With_Chain return Boolean; -- Check whether a possible circular dependence includes units that -- have been loaded through limited_with clauses, in which case there -- is no real circularity. function Spec_Is_Irrelevant (Spec_Unit : Unit_Number_Type; Body_Unit : Unit_Number_Type) return Boolean; -- The Spec_Unit and Body_Unit parameters are the unit numbers of the -- spec file that corresponds to the main unit which is a body. This -- function determines if the spec file is irrelevant and will be -- overridden by the body as described in RM 10.1.4(4). See description -- in "Special Handling of Subprogram Bodies" for further details. procedure Write_Dependency_Chain; -- This procedure is used to generate error message info lines that -- trace the current dependency chain when a load error occurs. ------------------------------ -- Change_Main_Unit_To_Spec -- ------------------------------ procedure Change_Main_Unit_To_Spec is U : Unit_Record renames Units.Table (Main_Unit); N : File_Name_Type; X : Source_File_Index; begin -- Get name of unit body Get_Name_String (U.Unit_File_Name); -- Note: for the following we should really generalize and consult the -- file name pattern data, but for now we just deal with the common -- naming cases, which is probably good enough in practice ??? -- Change .adb to .ads if Name_Len >= 5 and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".adb" then Name_Buffer (Name_Len) := 's'; -- Change .2.ada to .1.ada (Rational convention) elsif Name_Len >= 7 and then Name_Buffer (Name_Len - 5 .. Name_Len) = ".2.ada" then Name_Buffer (Name_Len - 4) := '1'; -- Change .ada to _.ada (DEC convention) elsif Name_Len >= 5 and then Name_Buffer (Name_Len - 3 .. Name_Len) = ".ada" then Name_Buffer (Name_Len - 3 .. Name_Len + 1) := "_.ada"; Name_Len := Name_Len + 1; -- No match, don't make the change else return; end if; -- Try loading the spec N := Name_Find; X := Load_Source_File (N); -- No change if we did not find the spec if X <= No_Source_File then return; end if; -- Otherwise modify Main_Unit entry to point to spec U.Unit_File_Name := N; U.Source_Index := X; end Change_Main_Unit_To_Spec; ------------------------------- -- Create_Dummy_Package_Unit -- ------------------------------- function Create_Dummy_Package_Unit (With_Node : Node_Id; Spec_Name : Unit_Name_Type) return Unit_Number_Type is Unum : Unit_Number_Type; Cunit_Entity : Entity_Id; Cunit : Node_Id; Du_Name : Node_Or_Entity_Id; End_Lab : Node_Id; Fname : constant File_Name_Type := Get_File_Name (Spec_Name, Subunit => False); Pre_Name : constant Boolean := Is_Predefined_File_Name (Fname, Renamings_Included => False); Ren_Name : constant Boolean := Is_Predefined_Renaming_File_Name (Fname); GNAT_Name : constant Boolean := Is_GNAT_File_Name (Fname); Save_CS : constant Boolean := Get_Comes_From_Source_Default; begin -- The created dummy package unit does not come from source Set_Comes_From_Source_Default (False); -- Normal package if Nkind (Name (With_Node)) = N_Identifier then Cunit_Entity := Make_Defining_Identifier (No_Location, Chars => Chars (Name (With_Node))); Du_Name := Cunit_Entity; End_Lab := New_Occurrence_Of (Cunit_Entity, No_Location); -- Child package else Cunit_Entity := Make_Defining_Identifier (No_Location, Chars => Chars (Selector_Name (Name (With_Node)))); Du_Name := Make_Defining_Program_Unit_Name (No_Location, Name => Copy_Separate_Tree (Prefix (Name (With_Node))), Defining_Identifier => Cunit_Entity); Set_Is_Child_Unit (Cunit_Entity); End_Lab := Make_Designator (No_Location, Name => Copy_Separate_Tree (Prefix (Name (With_Node))), Identifier => New_Occurrence_Of (Cunit_Entity, No_Location)); end if; Set_Scope (Cunit_Entity, Standard_Standard); Cunit := Make_Compilation_Unit (No_Location, Context_Items => Empty_List, Unit => Make_Package_Declaration (No_Location, Specification => Make_Package_Specification (No_Location, Defining_Unit_Name => Du_Name, Visible_Declarations => Empty_List, End_Label => End_Lab)), Aux_Decls_Node => Make_Compilation_Unit_Aux (No_Location)); -- Mark the dummy package as analyzed to prevent analysis of this -- (non-existent) unit in -gnatQ mode because at the moment the -- structure and attributes of this dummy package does not allow -- a normal analysis of this unit Set_Analyzed (Cunit); Units.Increment_Last; Unum := Units.Last; Units.Table (Unum) := (Cunit => Cunit, Cunit_Entity => Cunit_Entity, Dependency_Num => 0, Dynamic_Elab => False, Error_Location => Sloc (With_Node), Expected_Unit => Spec_Name, Fatal_Error => Error_Detected, Generate_Code => False, Has_RACW => False, Filler => False, Ident_String => Empty, Is_Predefined_Renaming => Ren_Name, Is_Predefined_Unit => Pre_Name or Ren_Name, Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, Filler2 => False, Loading => False, Main_Priority => Default_Main_Priority, Main_CPU => Default_Main_CPU, Primary_Stack_Count => 0, Sec_Stack_Count => 0, Munit_Index => 0, No_Elab_Code_All => False, Serial_Number => 0, Source_Index => No_Source_File, Unit_File_Name => Fname, Unit_Name => Spec_Name, Version => 0, OA_Setting => 'O'); Init_Unit_Name (Unum, Spec_Name); Set_Comes_From_Source_Default (Save_CS); Set_Error_Posted (Cunit_Entity); Set_Error_Posted (Cunit); return Unum; end Create_Dummy_Package_Unit; ----------------------------- -- From_Limited_With_Chain -- ----------------------------- function From_Limited_With_Chain return Boolean is Curr_Num : constant Unit_Number_Type := Load_Stack.Table (Load_Stack.Last).Unit_Number; begin -- True if the current load operation is through a limited_with clause -- and we are not within a loop of regular with_clauses. for U in reverse Load_Stack.First .. Load_Stack.Last - 1 loop if Load_Stack.Table (U).Unit_Number = Curr_Num then return False; elsif Present (Load_Stack.Table (U).With_Node) and then Limited_Present (Load_Stack.Table (U).With_Node) then return True; end if; end loop; return False; end From_Limited_With_Chain; ---------------- -- Initialize -- ---------------- procedure Initialize is begin Units.Init; Load_Stack.Init; end Initialize; ------------------------ -- Initialize_Version -- ------------------------ procedure Initialize_Version (U : Unit_Number_Type) is begin Units.Table (U).Version := Source_Checksum (Source_Index (U)); end Initialize_Version; ---------------------- -- Load_Main_Source -- ---------------------- procedure Load_Main_Source is Fname : constant File_Name_Type := Next_Main_Source; Pre_Name : constant Boolean := Is_Predefined_File_Name (Fname, Renamings_Included => False); Ren_Name : constant Boolean := Is_Predefined_Renaming_File_Name (Fname); GNAT_Name : constant Boolean := Is_GNAT_File_Name (Fname); Version : Word := 0; begin Load_Stack.Increment_Last; Load_Stack.Table (Load_Stack.Last) := (Main_Unit, Empty); -- Initialize unit table entry for Main_Unit. Note that we don't know -- the unit name yet, that gets filled in when the parser parses the -- main unit, at which time a check is made that it matches the main -- file name, and then the Unit_Name field is set. The Cunit and -- Cunit_Entity fields also get filled in later by the parser. Units.Increment_Last; Units.Table (Main_Unit).Unit_File_Name := Fname; if Fname /= No_File then Main_Source_File := Load_Source_File (Fname); Current_Error_Source_File := Main_Source_File; if Main_Source_File > No_Source_File then Version := Source_Checksum (Main_Source_File); else -- To avoid emitting a source location (since there is no file), -- we write a custom error message instead of using the machinery -- in errout.adb. Set_Standard_Error; if Main_Source_File = No_Access_To_Source_File then Write_Str ("no read access for file """ & Get_Name_String (Fname) & """"); else Write_Str ("file """ & Get_Name_String (Fname) & """ not found"); end if; Write_Eol; Set_Standard_Output; end if; Units.Table (Main_Unit) := (Cunit => Empty, Cunit_Entity => Empty, Dependency_Num => 0, Dynamic_Elab => False, Error_Location => No_Location, Expected_Unit => No_Unit_Name, Fatal_Error => None, Generate_Code => False, Has_RACW => False, Filler => False, Ident_String => Empty, Is_Predefined_Renaming => Ren_Name, Is_Predefined_Unit => Pre_Name or Ren_Name, Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, Filler2 => False, Loading => True, Main_Priority => Default_Main_Priority, Main_CPU => Default_Main_CPU, Primary_Stack_Count => 0, Sec_Stack_Count => 0, Munit_Index => 0, No_Elab_Code_All => False, Serial_Number => 0, Source_Index => Main_Source_File, Unit_File_Name => Fname, Unit_Name => No_Unit_Name, Version => Version, OA_Setting => 'O'); end if; end Load_Main_Source; --------------- -- Load_Unit -- --------------- function Load_Unit (Load_Name : Unit_Name_Type; Required : Boolean; Error_Node : Node_Id; Subunit : Boolean; Corr_Body : Unit_Number_Type := No_Unit; Renamings : Boolean := False; With_Node : Node_Id := Empty; PMES : Boolean := False) return Unit_Number_Type is Calling_Unit : Unit_Number_Type; Uname_Actual : Unit_Name_Type; Unum : Unit_Number_Type; Unump : Unit_Number_Type; Fname : File_Name_Type; Pre_Name : Boolean; Ren_Name : Boolean; GNAT_Name : Boolean; Src_Ind : Source_File_Index; Save_PMES : constant Boolean := Parsing_Main_Extended_Source; Save_Cunit_Restrictions : constant Save_Cunit_Boolean_Restrictions := Cunit_Boolean_Restrictions_Save; -- Save current restrictions for restore at end begin Parsing_Main_Extended_Source := PMES; -- Initialize restrictions to config restrictions for unit to load if -- it is part of the main extended source, otherwise reset them. -- Note: it's a bit odd but PMES is False for subunits, which is why -- we have the OR here. Should be investigated some time??? if PMES or Subunit then Restore_Config_Cunit_Boolean_Restrictions; else Reset_Cunit_Boolean_Restrictions; end if; -- If renamings are allowed and we have a child unit name, then we -- must first load the parent to deal with finding the real name. -- Retain the with_clause that names the child, so that if it is -- limited, the parent is loaded under the same condition. if Renamings and then Is_Child_Name (Load_Name) then Unump := Load_Unit (Load_Name => Get_Parent_Spec_Name (Load_Name), Required => Required, Subunit => False, Renamings => True, Error_Node => Error_Node, With_Node => With_Node); if Unump = No_Unit then Parsing_Main_Extended_Source := Save_PMES; return No_Unit; end if; -- If parent is a renaming, then we use the renamed package as -- the actual parent for the subsequent load operation. if Nkind (Unit (Cunit (Unump))) = N_Package_Renaming_Declaration then Uname_Actual := New_Child (Load_Name, Get_Unit_Name (Name (Unit (Cunit (Unump))))); -- If the load is for a with_clause, for visibility purposes both -- the renamed entity and renaming one must be available in the -- current unit: the renamed one in order to retrieve the child -- unit, and the original one because it may be used as a prefix -- in the body of the current unit. We add an explicit with_clause -- for the original parent so that the renaming declaration is -- properly loaded and analyzed. if Present (With_Node) then Insert_After (With_Node, Make_With_Clause (Sloc (With_Node), Name => Copy_Separate_Tree (Prefix (Name (With_Node))))); end if; -- Save the renaming entity, to establish its visibility when -- installing the context. The implicit with is on this entity, -- not on the package it renames. This is somewhat redundant given -- the with_clause just created, but it simplifies subsequent -- expansion of the current with_clause. Optimizable ??? if Nkind (Error_Node) = N_With_Clause and then Nkind (Name (Error_Node)) = N_Selected_Component then declare Par : Node_Id := Name (Error_Node); begin while Nkind (Par) = N_Selected_Component and then Chars (Selector_Name (Par)) /= Chars (Cunit_Entity (Unump)) loop Par := Prefix (Par); end loop; -- Case of some intermediate parent is a renaming if Nkind (Par) = N_Selected_Component then Set_Entity (Selector_Name (Par), Cunit_Entity (Unump)); -- Case where the ultimate parent is a renaming else Set_Entity (Par, Cunit_Entity (Unump)); end if; end; end if; -- If the parent is not a renaming, then get its name (this may -- be different from the parent spec name obtained above because -- of renamings higher up in the hierarchy). else Uname_Actual := New_Child (Load_Name, Unit_Name (Unump)); end if; -- Here if unit to be loaded is not a child unit else Uname_Actual := Load_Name; end if; Fname := Get_File_Name (Uname_Actual, Subunit); Pre_Name := Is_Predefined_File_Name (Fname, Renamings_Included => False); Ren_Name := Is_Predefined_Renaming_File_Name (Fname); GNAT_Name := Is_GNAT_File_Name (Fname); if Debug_Flag_L then Write_Eol; Write_Str ("*** Load request for unit: "); Write_Unit_Name (Load_Name); if Required then Write_Str (" (Required = True)"); else Write_Str (" (Required = False)"); end if; Write_Eol; if Uname_Actual /= Load_Name then Write_Str ("*** Actual unit loaded: "); Write_Unit_Name (Uname_Actual); end if; end if; -- Capture error location if it is for the main unit. The idea is to -- post errors on the main unit location, not the most recent unit. -- Note: Unit_Name (Main_Unit) is not set if we are parsing gnat.adc. if Present (Error_Node) and then Unit_Name (Main_Unit) /= No_Unit_Name then -- It seems like In_Extended_Main_Source_Unit (Error_Node) would -- do the trick here, but that's wrong, it is much too early to -- call this routine. We are still in the parser, and the required -- semantic information is not established yet. So we base the -- judgment on unit names. Get_External_Unit_Name_String (Unit_Name (Main_Unit)); declare Main_Unit_Name : constant String := Name_Buffer (1 .. Name_Len); begin Get_External_Unit_Name_String (Unit_Name (Get_Source_Unit (Error_Node))); -- If the two names are identical, then for sure we are part -- of the extended main unit if Main_Unit_Name = Name_Buffer (1 .. Name_Len) then Load_Msg_Sloc := Sloc (Error_Node); -- If the load is called from a with_type clause, the error -- node is correct. -- Otherwise, check for the subunit case, and if so, consider -- we have a match if one name is a prefix of the other name. else if Nkind (Unit (Cunit (Main_Unit))) = N_Subunit or else Nkind (Unit (Cunit (Get_Source_Unit (Error_Node)))) = N_Subunit then Name_Len := Integer'Min (Name_Len, Main_Unit_Name'Length); if Name_Buffer (1 .. Name_Len) = Main_Unit_Name (1 .. Name_Len) then Load_Msg_Sloc := Sloc (Error_Node); end if; end if; end if; end; end if; -- If we are generating error messages, then capture calling unit if Present (Error_Node) then Calling_Unit := Get_Source_Unit (Error_Node); else Calling_Unit := No_Unit; end if; -- See if we already have an entry for this unit Unum := Unit_Names.Get (Uname_Actual); if Unum = No_Unit then Unum := Units.Last + 1; end if; -- Whether or not the entry was found, Unum is now the right value, -- since it is one more than Units.Last (i.e. the index of the new -- entry we will create) in the not found case. -- A special check is necessary in the unit not found case. If the unit -- is not found, but the file in which it lives has already been loaded, -- then we have the problem that the file does not contain the unit that -- is needed. We simply treat this as a file not found condition. -- We skip this test in multiple unit per file mode since in this -- case we can have multiple units from the same source file. if Unum > Units.Last and then Get_Unit_Index (Uname_Actual) = 0 then for J in Units.First .. Units.Last loop if Fname = Units.Table (J).Unit_File_Name then if Debug_Flag_L then Write_Str (" file does not contain unit, Unit_Number = "); Write_Int (Int (Unum)); Write_Eol; Write_Eol; end if; if Present (Error_Node) then Get_Name_String (Fname); if Is_Predefined_File_Name (Fname) then Error_Msg_Unit_1 := Uname_Actual; Error_Msg ("$$ is not a language defined unit", Load_Msg_Sloc); else Error_Msg_File_1 := Fname; Error_Msg_Unit_1 := Uname_Actual; Error_Msg ("File{ does not contain unit$", Load_Msg_Sloc); end if; Write_Dependency_Chain; Unum := No_Unit; goto Done; else Unum := No_Unit; goto Done; end if; end if; end loop; end if; -- If we are proceeding with load, then make load stack entry, -- and indicate the kind of with_clause responsible for the load. Load_Stack.Increment_Last; Load_Stack.Table (Load_Stack.Last) := (Unum, With_Node); -- Case of entry already in table if Unum <= Units.Last then -- Here is where we check for a circular dependency, which is -- an attempt to load a unit which is currently in the process -- of being loaded. We do *not* care about a circular chain that -- leads back to a body, because this kind of circular dependence -- legitimately occurs (e.g. two package bodies that contain -- inlined subprogram referenced by the other). -- Ada 2005 (AI-50217): We also ignore limited_with clauses, because -- their purpose is precisely to create legal circular structures. if Loading (Unum) and then (Is_Spec_Name (Units.Table (Unum).Unit_Name) or else Acts_As_Spec (Units.Table (Unum).Cunit)) and then (Nkind (Error_Node) /= N_With_Clause or else not Limited_Present (Error_Node)) and then not From_Limited_With_Chain then if Debug_Flag_L then Write_Str (" circular dependency encountered"); Write_Eol; end if; if Present (Error_Node) then Error_Msg ("circular unit dependency", Load_Msg_Sloc); Write_Dependency_Chain; else Load_Stack.Decrement_Last; end if; Unum := No_Unit; goto Done; end if; if Debug_Flag_L then Write_Str (" unit already in file table, Unit_Number = "); Write_Int (Int (Unum)); Write_Eol; end if; Load_Stack.Decrement_Last; goto Done; -- Unit is not already in table, so try to open the file else if Debug_Flag_L then Write_Str (" attempt unit load, Unit_Number = "); Write_Int (Int (Unum)); Write_Eol; end if; Src_Ind := Load_Source_File (Fname); -- Make a partial entry in the file table, used even in the file not -- found case to print the dependency chain including the last entry Units.Increment_Last; Init_Unit_Name (Unum, Uname_Actual); -- File was found if Src_Ind > No_Source_File then Units.Table (Unum) := (Cunit => Empty, Cunit_Entity => Empty, Dependency_Num => 0, Dynamic_Elab => False, Error_Location => Sloc (Error_Node), Expected_Unit => Uname_Actual, Fatal_Error => None, Generate_Code => False, Has_RACW => False, Filler => False, Ident_String => Empty, Is_Predefined_Renaming => Ren_Name, Is_Predefined_Unit => Pre_Name or Ren_Name, Is_Internal_Unit => Pre_Name or Ren_Name or GNAT_Name, Filler2 => False, Loading => True, Main_Priority => Default_Main_Priority, Main_CPU => Default_Main_CPU, Primary_Stack_Count => 0, Sec_Stack_Count => 0, Munit_Index => 0, No_Elab_Code_All => False, Serial_Number => 0, Source_Index => Src_Ind, Unit_File_Name => Fname, Unit_Name => Uname_Actual, Version => Source_Checksum (Src_Ind), OA_Setting => 'O'); -- Parse the new unit declare Save_Index : constant Nat := Multiple_Unit_Index; Save_PMES : constant Boolean := Parsing_Main_Extended_Source; begin Multiple_Unit_Index := Get_Unit_Index (Uname_Actual); Units.Table (Unum).Munit_Index := Multiple_Unit_Index; Initialize_Scanner (Unum, Source_Index (Unum)); if Calling_Unit = Main_Unit and then Subunit then Parsing_Main_Extended_Source := True; end if; Discard_List (Par (Configuration_Pragmas => False)); Parsing_Main_Extended_Source := Save_PMES; Multiple_Unit_Index := Save_Index; Set_Loading (Unum, False); end; -- If spec is irrelevant, then post errors and quit if Corr_Body /= No_Unit and then Spec_Is_Irrelevant (Unum, Corr_Body) then Error_Msg_File_1 := Unit_File_Name (Corr_Body); Error_Msg ("cannot compile subprogram in file {!", Load_Msg_Sloc); Error_Msg_File_1 := Unit_File_Name (Unum); Error_Msg ("\incorrect spec in file { must be removed first!", Load_Msg_Sloc); Unum := No_Unit; goto Done; end if; -- If loaded unit had an error, then caller inherits setting if Present (Error_Node) then case Units.Table (Unum).Fatal_Error is -- Nothing to do if with'ed unit had no error when None => null; -- If with'ed unit had a detected fatal error, propagate it when Error_Detected => Units.Table (Calling_Unit).Fatal_Error := Error_Detected; -- If with'ed unit had an ignored error, then propagate it -- but do not overide an existring setting. when Error_Ignored => if Units.Table (Calling_Unit).Fatal_Error = None then Units.Table (Calling_Unit).Fatal_Error := Error_Ignored; end if; end case; end if; -- Remove load stack entry and return the entry in the file table Load_Stack.Decrement_Last; -- All done, return unit number goto Done; -- Case of file not found else if Debug_Flag_L then if Src_Ind = No_Access_To_Source_File then Write_Str (" no read access to file, load failed"); else Write_Str (" file was not found, load failed"); end if; Write_Eol; end if; -- Generate message if unit required if Required then Get_Name_String (Fname); if Is_Predefined_File_Name (Fname) then -- This is a predefined library unit which is not present -- in the run time. If a predefined unit is not available -- it may very likely be the case that there is also pragma -- Restriction forbidding its usage. This is typically the -- case when building a configurable run time, where the -- usage of certain run-time units is restricted by means -- of both the corresponding pragma Restriction (such as -- No_Calendar), and by not including the unit. Hence, we -- check whether this predefined unit is forbidden, so that -- the message about the restriction violation is generated, -- if needed. if Present (Error_Node) then Check_Restricted_Unit (Load_Name, Error_Node); end if; Error_Msg_Unit_1 := Uname_Actual; Error_Msg -- CODEFIX ("$$ is not a predefined library unit", Load_Msg_Sloc); else Error_Msg_File_1 := Fname; if Src_Ind = No_Access_To_Source_File then Error_Msg ("no read access to file{", Load_Msg_Sloc); else Error_Msg ("file{ not found", Load_Msg_Sloc); end if; end if; Write_Dependency_Chain; -- Remove unit from stack, to avoid cascaded errors on -- subsequent missing files. Load_Stack.Decrement_Last; Remove_Unit (Unum); -- If unit not required, remove load stack entry and the junk -- file table entry, and return No_Unit to indicate not found, else Load_Stack.Decrement_Last; Remove_Unit (Unum); end if; Unum := No_Unit; goto Done; end if; end if; -- Here to exit, with result in Unum <<Done>> Parsing_Main_Extended_Source := Save_PMES; Cunit_Boolean_Restrictions_Restore (Save_Cunit_Restrictions); return Unum; end Load_Unit; -------------------------- -- Make_Child_Decl_Unit -- -------------------------- procedure Make_Child_Decl_Unit (N : Node_Id) is Unit_Decl : constant Node_Id := Library_Unit (N); Unit_Num : constant Unit_Number_Type := Get_Cunit_Unit_Number (N); begin Units.Increment_Last; Units.Table (Units.Last) := Units.Table (Unit_Num); Units.Table (Units.Last).Cunit := Unit_Decl; Units.Table (Units.Last).Cunit_Entity := Defining_Identifier (Defining_Unit_Name (Specification (Unit (Unit_Decl)))); Init_Unit_Name (Units.Last, Get_Spec_Name (Unit_Name (Unit_Num))); -- The library unit created for of a child subprogram unit plays no -- role in code generation and binding, so label it accordingly. Units.Table (Units.Last).Generate_Code := False; Set_Has_No_Elaboration_Code (Unit_Decl); end Make_Child_Decl_Unit; ------------------------ -- Make_Instance_Unit -- ------------------------ -- If the unit is an instance, it appears as a package declaration, but -- contains both declaration and body of the instance. The body becomes -- the main unit of the compilation, and the declaration is inserted -- at the end of the unit table. The main unit now has the name of a -- body, which is constructed from the name of the original spec, -- and is attached to the compilation node of the original unit. The -- declaration has been attached to a new compilation unit node, and -- code will have to be generated for it. procedure Make_Instance_Unit (N : Node_Id; In_Main : Boolean) is Sind : constant Source_File_Index := Source_Index (Main_Unit); begin Units.Increment_Last; if In_Main then Units.Table (Units.Last) := Units.Table (Main_Unit); Units.Table (Units.Last).Cunit := Library_Unit (N); Units.Table (Units.Last).Generate_Code := True; Init_Unit_Name (Units.Last, Unit_Name (Main_Unit)); Units.Table (Main_Unit).Cunit := N; Units.Table (Main_Unit).Version := Source_Checksum (Sind); Init_Unit_Name (Main_Unit, Get_Body_Name (Unit_Name (Get_Cunit_Unit_Number (Library_Unit (N))))); else -- Duplicate information from instance unit, for the body. The unit -- node N has been rewritten as a body, but it was placed in the -- units table when first loaded as a declaration. Units.Table (Units.Last) := Units.Table (Get_Cunit_Unit_Number (N)); Units.Table (Units.Last).Cunit := Library_Unit (N); end if; end Make_Instance_Unit; ------------------------ -- Spec_Is_Irrelevant -- ------------------------ function Spec_Is_Irrelevant (Spec_Unit : Unit_Number_Type; Body_Unit : Unit_Number_Type) return Boolean is Sunit : constant Node_Id := Cunit (Spec_Unit); Bunit : constant Node_Id := Cunit (Body_Unit); begin -- The spec is irrelevant if the body is a subprogram body, and the spec -- is other than a subprogram spec or generic subprogram spec. Note that -- the names must be the same, we don't need to check that, because we -- already know that from the fact that the file names are the same. return Nkind (Unit (Bunit)) = N_Subprogram_Body and then Nkind (Unit (Sunit)) /= N_Subprogram_Declaration and then Nkind (Unit (Sunit)) /= N_Generic_Subprogram_Declaration; end Spec_Is_Irrelevant; -------------------- -- Version_Update -- -------------------- procedure Version_Update (U : Node_Id; From : Node_Id) is Unum : constant Unit_Number_Type := Get_Cunit_Unit_Number (U); Fnum : constant Unit_Number_Type := Get_Cunit_Unit_Number (From); begin if Source_Index (Fnum) > No_Source_File then Units.Table (Unum).Version := Units.Table (Unum).Version xor Source_Checksum (Source_Index (Fnum)); end if; end Version_Update; ---------------------------- -- Write_Dependency_Chain -- ---------------------------- procedure Write_Dependency_Chain is begin -- The dependency chain is only written if it is at least two entries -- deep, otherwise it is trivial (the main unit depending on a unit -- that it obviously directly depends on). if Load_Stack.Last - 1 > Load_Stack.First then for U in Load_Stack.First .. Load_Stack.Last - 1 loop Error_Msg_Unit_1 := Unit_Name (Load_Stack.Table (U).Unit_Number); Error_Msg_Unit_2 := Unit_Name (Load_Stack.Table (U + 1).Unit_Number); Error_Msg ("$ depends on $!", Load_Msg_Sloc); end loop; end if; end Write_Dependency_Chain; end Lib.Load;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/opt52.adb
best08618/asylo
7
3348
-- { dg-do compile } -- { dg-options "-O -fdump-tree-optimized" } procedure Opt52 (I : Integer) is begin if I + 1 < I then raise Program_Error; end if; end; -- { dg-final { scan-tree-dump-not "check_PE_Explicit_Raise" "optimized" } }
P6/data_P6_2/cal_R_same_test21.asm
alxzzhou/BUAA_CO_2020
1
160790
lui $1,44603 ori $1,$1,58940 lui $2,59911 ori $2,$2,63933 lui $3,580 ori $3,$3,25032 lui $4,54074 ori $4,$4,36937 lui $5,64205 ori $5,$5,29921 lui $6,3628 ori $6,$6,31264 mthi $1 mtlo $2 sec0: nop nop nop or $5,$6,$6 sec1: nop nop or $6,$1,$2 or $3,$6,$6 sec2: nop nop addiu $6,$5,21605 or $6,$6,$6 sec3: nop nop mfhi $6 or $4,$6,$6 sec4: nop nop lhu $6,6($0) or $3,$6,$6 sec5: nop sltu $6,$2,$1 nop or $0,$6,$6 sec6: nop addu $6,$0,$6 xor $6,$6,$4 or $4,$6,$6 sec7: nop nor $6,$3,$1 addiu $6,$2,12299 or $4,$6,$6 sec8: nop sltu $6,$4,$2 mflo $6 or $5,$6,$6 sec9: nop or $6,$3,$3 lhu $6,0($0) or $6,$6,$6 sec10: nop ori $6,$3,47347 nop or $0,$6,$6 sec11: nop ori $6,$4,43800 sltu $6,$1,$6 or $4,$6,$6 sec12: nop sltiu $6,$0,1259 andi $6,$3,50253 or $1,$6,$6 sec13: nop xori $6,$5,5641 mflo $6 or $5,$6,$6 sec14: nop slti $6,$1,-10609 lhu $6,10($0) or $3,$6,$6 sec15: nop mflo $6 nop or $4,$6,$6 sec16: nop mflo $6 nor $6,$2,$2 or $2,$6,$6 sec17: nop mflo $6 ori $6,$4,10698 or $6,$6,$6 sec18: nop mflo $6 mfhi $6 or $1,$6,$6 sec19: nop mfhi $6 lb $6,8($0) or $2,$6,$6 sec20: nop lh $6,14($0) nop or $5,$6,$6 sec21: nop lh $6,2($0) and $6,$2,$4 or $3,$6,$6 sec22: nop lhu $6,14($0) slti $6,$0,29511 or $2,$6,$6 sec23: nop lhu $6,12($0) mflo $6 or $6,$6,$6 sec24: nop lb $6,16($0) lw $6,8($0) or $4,$6,$6 sec25: sltu $6,$4,$5 nop nop or $1,$6,$6 sec26: nor $6,$4,$0 nop slt $6,$3,$4 or $2,$6,$6 sec27: or $6,$2,$4 nop ori $6,$1,25005 or $2,$6,$6 sec28: addu $6,$5,$5 nop mfhi $6 or $4,$6,$6 sec29: nor $6,$5,$2 nop lhu $6,16($0) or $3,$6,$6 sec30: xor $6,$5,$5 sltu $6,$4,$4 nop or $2,$6,$6 sec31: xor $6,$3,$4 and $6,$0,$3 sltu $6,$3,$5 or $0,$6,$6 sec32: nor $6,$6,$5 xor $6,$3,$3 addiu $6,$0,-30165 or $2,$6,$6 sec33: subu $6,$1,$6 xor $6,$2,$1 mfhi $6 or $4,$6,$6 sec34: nor $6,$5,$4 and $6,$3,$1 lb $6,15($0) or $3,$6,$6 sec35: and $6,$6,$6 addiu $6,$5,27271 nop or $4,$6,$6 sec36: subu $6,$1,$4 andi $6,$1,30668 sltu $6,$3,$4 or $5,$6,$6 sec37: slt $6,$4,$4 sltiu $6,$4,-26235 sltiu $6,$2,31652 or $2,$6,$6 sec38: subu $6,$2,$4 sltiu $6,$1,3265 mfhi $6 or $3,$6,$6 sec39: slt $6,$4,$5 addiu $6,$2,30156 lh $6,12($0) or $2,$6,$6 sec40: subu $6,$2,$4 mfhi $6 nop or $3,$6,$6 sec41: or $6,$2,$3 mfhi $6 sltu $6,$3,$4 or $1,$6,$6 sec42: nor $6,$0,$3 mfhi $6 sltiu $6,$5,-24089 or $3,$6,$6 sec43: subu $6,$1,$0 mfhi $6 mfhi $6 or $2,$6,$6 sec44: or $6,$6,$1 mflo $6 lb $6,7($0) or $2,$6,$6 sec45: addu $6,$1,$3 lw $6,12($0) nop or $2,$6,$6 sec46: sltu $6,$4,$2 lb $6,0($0) addu $6,$3,$2 or $2,$6,$6 sec47: sltu $6,$3,$4 lhu $6,12($0) xori $6,$3,26342 or $2,$6,$6 sec48: slt $6,$4,$3 lbu $6,14($0) mfhi $6 or $5,$6,$6 sec49: addu $6,$4,$0 lbu $6,4($0) lw $6,8($0) or $3,$6,$6 sec50: andi $6,$0,51943 nop nop or $4,$6,$6 sec51: lui $6,4209 nop slt $6,$3,$1 or $2,$6,$6 sec52: slti $6,$3,24943 nop addiu $6,$4,24239 or $2,$6,$6 sec53: andi $6,$2,10845 nop mfhi $6 or $6,$6,$6 sec54: addiu $6,$2,29407 nop lbu $6,8($0) or $4,$6,$6 sec55: addiu $6,$6,196 addu $6,$4,$1 nop or $4,$6,$6 sec56: sltiu $6,$1,4352 subu $6,$3,$3 slt $6,$2,$0 or $1,$6,$6 sec57: addiu $6,$2,-18764 and $6,$2,$4 ori $6,$2,13828 or $3,$6,$6 sec58: ori $6,$3,39632 nor $6,$1,$1 mfhi $6 or $5,$6,$6 sec59: ori $6,$5,5176 subu $6,$3,$5 lw $6,16($0) or $6,$6,$6 sec60: xori $6,$3,22599 sltiu $6,$3,-16314 nop or $2,$6,$6 sec61: sltiu $6,$5,-9785 slti $6,$3,-12994 addu $6,$1,$3 or $3,$6,$6 sec62: andi $6,$3,64264 slti $6,$2,-22843 sltiu $6,$3,11780 or $4,$6,$6 sec63: lui $6,27572 ori $6,$1,24179 mflo $6 or $1,$6,$6 sec64: lui $6,23377 andi $6,$0,44261 lhu $6,12($0) or $2,$6,$6 sec65: ori $6,$1,2473 mfhi $6 nop or $5,$6,$6 sec66: lui $6,46583 mfhi $6 and $6,$2,$2 or $3,$6,$6 sec67: andi $6,$2,31595 mflo $6 addiu $6,$2,-2425 or $2,$6,$6 sec68: lui $6,33681 mflo $6 mflo $6 or $2,$6,$6 sec69: lui $6,9368 mfhi $6 lh $6,8($0) or $3,$6,$6 sec70: addiu $6,$6,-17976 lbu $6,3($0) nop or $1,$6,$6 sec71: lui $6,48888 lw $6,12($0) and $6,$2,$2 or $3,$6,$6 sec72: lui $6,61291 lh $6,12($0) xori $6,$0,53199 or $1,$6,$6 sec73: sltiu $6,$4,-17243 lhu $6,12($0) mfhi $6 or $2,$6,$6 sec74: addiu $6,$1,-4534 lbu $6,8($0) lbu $6,5($0) or $1,$6,$6 sec75: mflo $6 nop nop or $4,$6,$6 sec76: mflo $6 nop nor $6,$2,$1 or $1,$6,$6 sec77: mflo $6 nop lui $6,61695 or $3,$6,$6 sec78: mfhi $6 nop mflo $6 or $4,$6,$6 sec79: mfhi $6 nop lhu $6,0($0) or $4,$6,$6 sec80: mfhi $6 nor $6,$2,$3 nop or $2,$6,$6 sec81: mfhi $6 nor $6,$1,$6 or $6,$3,$5 or $4,$6,$6 sec82: mfhi $6 and $6,$2,$2 xori $6,$5,29326 or $3,$6,$6 sec83: mflo $6 sltu $6,$4,$3 mfhi $6 or $2,$6,$6 sec84: mfhi $6 sltu $6,$4,$1 lb $6,16($0) or $3,$6,$6 sec85: mflo $6 xori $6,$4,12044 nop or $2,$6,$6 sec86: mfhi $6 andi $6,$2,47602 nor $6,$3,$6 or $4,$6,$6 sec87: mflo $6 andi $6,$0,51520 addiu $6,$2,-25715 or $3,$6,$6 sec88: mflo $6 ori $6,$0,22729 mfhi $6 or $2,$6,$6 sec89: mfhi $6 lui $6,61839 lbu $6,12($0) or $4,$6,$6 sec90: mflo $6 mfhi $6 nop or $6,$6,$6 sec91: mflo $6 mflo $6 nor $6,$5,$2 or $4,$6,$6 sec92: mfhi $6 mfhi $6 xori $6,$2,59818 or $4,$6,$6 sec93: mflo $6 mfhi $6 mflo $6 or $0,$6,$6 sec94: mfhi $6 mflo $6 lw $6,16($0) or $3,$6,$6 sec95: mfhi $6 lw $6,16($0) nop or $3,$6,$6 sec96: mflo $6 lbu $6,8($0) or $6,$3,$4 or $1,$6,$6 sec97: mfhi $6 lw $6,12($0) xori $6,$1,42442 or $4,$6,$6 sec98: mfhi $6 lh $6,2($0) mfhi $6 or $1,$6,$6 sec99: mfhi $6 lbu $6,4($0) lhu $6,2($0) or $3,$6,$6 sec100: lbu $6,16($0) nop nop or $3,$6,$6 sec101: lhu $6,2($0) nop sltu $6,$1,$1 or $2,$6,$6 sec102: lbu $6,10($0) nop xori $6,$3,6730 or $1,$6,$6 sec103: lbu $6,10($0) nop mflo $6 or $5,$6,$6 sec104: lhu $6,2($0) nop lhu $6,2($0) or $0,$6,$6 sec105: lb $6,15($0) slt $6,$1,$3 nop or $5,$6,$6 sec106: lh $6,6($0) or $6,$1,$5 subu $6,$5,$4 or $0,$6,$6 sec107: lh $6,6($0) sltu $6,$5,$2 ori $6,$0,28129 or $6,$6,$6 sec108: lb $6,15($0) slt $6,$3,$6 mfhi $6 or $1,$6,$6 sec109: lhu $6,4($0) and $6,$4,$5 lw $6,16($0) or $3,$6,$6 sec110: lbu $6,5($0) lui $6,40639 nop or $4,$6,$6 sec111: lw $6,12($0) addiu $6,$2,-11581 xor $6,$4,$6 or $2,$6,$6 sec112: lw $6,12($0) slti $6,$6,-13598 sltiu $6,$4,-24548 or $5,$6,$6 sec113: lw $6,12($0) xori $6,$1,56693 mfhi $6 or $1,$6,$6 sec114: lhu $6,6($0) sltiu $6,$3,-15992 lh $6,4($0) or $3,$6,$6 sec115: lw $6,16($0) mflo $6 nop or $4,$6,$6 sec116: lb $6,9($0) mfhi $6 addu $6,$2,$2 or $6,$6,$6 sec117: lw $6,4($0) mflo $6 addiu $6,$4,15059 or $4,$6,$6 sec118: lhu $6,12($0) mflo $6 mflo $6 or $0,$6,$6 sec119: lbu $6,5($0) mflo $6 lbu $6,15($0) or $4,$6,$6 sec120: lw $6,4($0) lb $6,13($0) nop or $2,$6,$6 sec121: lh $6,2($0) lhu $6,12($0) addu $6,$3,$0 or $3,$6,$6 sec122: lw $6,12($0) lh $6,2($0) ori $6,$5,15563 or $3,$6,$6 sec123: lw $6,8($0) lbu $6,12($0) mfhi $6 or $4,$6,$6 sec124: lh $6,14($0) lbu $6,11($0) lbu $6,3($0) or $2,$6,$6
Adjunctions/Adj2Mon.agda
jmchapman/Relative-Monads
21
10437
<gh_stars>10-100 module Adjunctions.Adj2Mon where open import Library open import Categories open import Functors open import Monads open import Adjunctions open Cat open Fun Adj2Mon : ∀{a b}{C D : Cat {a}{b}} → Adj C D → Monad C Adj2Mon {C = C}{D} A = record{ T = OMap R ∘ OMap L; η = left (iden D); bind = HMap R ∘ right; law1 = proof HMap R (right (left (iden D))) ≅⟨ cong (HMap R) (lawa (iden D)) ⟩ HMap R (iden D) ≅⟨ fid R ⟩ iden C ∎; law2 = λ{_}{_}{f} → proof comp C (HMap R (right f)) (left (iden D)) ≅⟨ cong (comp C (HMap R (right f))) (sym (idr C)) ⟩ comp C (HMap R (right f)) (comp C (left (iden D)) (iden C)) ≅⟨ natleft (iden C) (right f) (iden D) ⟩ left (comp D (right f) (comp D (iden D) (HMap L (iden C)))) ≅⟨ cong (left ∘ comp D (right f)) (idl D) ⟩ left (comp D (right f) (HMap L (iden C))) ≅⟨ cong (left ∘ comp D (right f)) (fid L) ⟩ left (comp D (right f) (iden D)) ≅⟨ cong (left) (idr D) ⟩ left (right f) ≅⟨ lawb f ⟩ f ∎; law3 = λ{_}{_}{_}{f}{g} → proof HMap R (right (comp C (HMap R (right g)) f)) ≅⟨ cong (HMap R ∘ right ∘ comp C (HMap R (right g))) (sym (idr C)) ⟩ HMap R (right (comp C (HMap R (right g)) (comp C f (iden C)))) ≅⟨ cong (HMap R) (natright (iden C) (right g) f) ⟩ HMap R (comp D (right g) (comp D (right f) (HMap L (iden C)))) ≅⟨ cong (HMap R ∘ comp D (right g) ∘ comp D (right f)) (fid L)⟩ HMap R (comp D (right g) (comp D (right f) (iden D))) ≅⟨ cong (HMap R ∘ comp D (right g)) (idr D) ⟩ HMap R (comp D (right g) (right f)) ≅⟨ fcomp R ⟩ comp C (HMap R (right g)) (HMap R (right f)) ∎} where open Adj A
programs/oeis/091/A091998.asm
jmorken/loda
1
247
; A091998: Numbers that are congruent to {1, 11} mod 12. ; 1,11,13,23,25,35,37,47,49,59,61,71,73,83,85,95,97,107,109,119,121,131,133,143,145,155,157,167,169,179,181,191,193,203,205,215,217,227,229,239,241,251,253,263,265,275,277,287,289,299,301,311,313,323,325,335,337,347,349,359,361,371,373,383,385,395,397,407,409,419,421,431,433,443,445,455,457,467,469,479,481,491,493,503,505,515,517,527,529,539,541,551,553,563,565,575,577,587,589,599,601,611,613,623,625,635,637,647,649,659,661,671,673,683,685,695,697,707,709,719,721,731,733,743,745,755,757,767,769,779,781,791,793,803,805,815,817,827,829,839,841,851,853,863,865,875,877,887,889,899,901,911,913,923,925,935,937,947,949,959,961,971,973,983,985,995,997,1007,1009,1019,1021,1031,1033,1043,1045,1055,1057,1067,1069,1079,1081,1091,1093,1103,1105,1115,1117,1127,1129,1139,1141,1151,1153,1163,1165,1175,1177,1187,1189,1199,1201,1211,1213,1223,1225,1235,1237,1247,1249,1259,1261,1271,1273,1283,1285,1295,1297,1307,1309,1319,1321,1331,1333,1343,1345,1355,1357,1367,1369,1379,1381,1391,1393,1403,1405,1415,1417,1427,1429,1439,1441,1451,1453,1463,1465,1475,1477,1487,1489,1499 mov $1,10 mul $1,$0 div $0,2 mul $0,8 add $1,1 sub $1,$0
library/fmGUI_Menus/fmGUI_SelectAll.applescript
NYHTC/applescript-fm-helper
1
410
-- fmGUI_SelectAll({}) -- <NAME>, NYHTC -- Copy the selected objects in the current window in FileMaker (* HISTORY: 1.4.1 - 2018-01-18 ( eshagdar ): get menu item directly instead of finding it using 'whose'. 1.4 - 2017-11-06 ( eshagdar ): inaccurate history - start a new version. 1.3 - 2016-10-18 ( eshagdar ): use fmGUI_clickMenuItem handler 1.2 - 2016-10-18 ( eshagdar ): make sure the menu item is available again 1.1 - 2016-10-14 ( eshagdar ): 1.0 was looking only for script steps. now looks at non-zero length REQUIRES: fmGUI_AppFrontMost fmGUI_ClickMenuItem *) on run fmGUI_SelectAll() end run -------------------- -- START OF CODE -------------------- on fmGUI_SelectAll() -- version 1.4.1, <NAME> try fmGUI_AppFrontMost() tell application "System Events" tell application process "FileMaker Pro Advanced" set SelectAllMenuItem to menu item "Select All" of menu 1 of menu bar item "Edit" of menu bar 1 end tell end tell return fmGUI_ClickMenuItem({menuItemRef:SelectAllMenuItem, waitForMenuAvailable:true}) on error errMsg number errNum error "Couldn't fmGUI_SelectAll - " & errMsg number errNum end try end fmGUI_SelectAll -------------------- -- END OF CODE -------------------- on fmGUI_AppFrontMost() tell application "htcLib" to fmGUI_AppFrontMost() end fmGUI_AppFrontMost on fmGUI_ClickMenuItem(prefs) set prefs to {menuItemRef:my coerceToString(menuItemRef of prefs)} & prefs tell application "htcLib" to fmGUI_ClickMenuItem(prefs) end fmGUI_ClickMenuItem on coerceToString(incomingObject) -- 2017-07-12 ( eshagdar ): bootstrap code to bring a coerceToString into this file for the sample to run ( instead of having a copy of the handler locally ). tell application "Finder" to set coercePath to (container of (container of (path to me)) as text) & "text parsing:coerceToString.applescript" set codeCoerce to read file coercePath as text tell application "htcLib" to set codeCoerce to "script codeCoerce " & return & getTextBetween({sourceText:codeCoerce, beforeText:"-- START OF CODE", afterText:"-- END OF CODE"}) & return & "end script" & return & "return codeCoerce" set codeCoerce to run script codeCoerce tell codeCoerce to coerceToString(incomingObject) end coerceToString
tools-src/gnu/gcc/gcc/ada/5oosinte.ads
enfoTek/tomato.linksys.e2000.nvram-mod
80
16786
------------------------------------------------------------------------------ -- -- -- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . O S _ I N T E R F A C E -- -- -- -- S p e c -- -- -- -- $Revision$ -- -- -- Copyright (C) 1991-2001 Florida State University -- -- -- -- GNARL is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNARL 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 GNARL; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- As a special exception, if other files instantiate generics from this -- -- unit, or you link this unit with other files to produce an executable, -- -- this unit does not by itself cause the resulting executable to be -- -- covered by the GNU General Public License. This exception does not -- -- however invalidate any other reasons why the executable file might be -- -- covered by the GNU Public License. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. It is -- -- now maintained by Ada Core Technologies Inc. in cooperation with Florida -- -- State University (http://www.gnat.com). -- -- -- ------------------------------------------------------------------------------ -- This is the OS/2 version of this package -- This package encapsulates all direct interfaces to OS services -- that are needed by children of System. -- PLEASE DO NOT add any with-clauses to this package -- or remove the pragma Preelaborate. -- It is designed to be a bottom-level (leaf) package. with Interfaces.C; package System.OS_Interface is pragma Preelaborate; package C renames Interfaces.C; subtype int is C.int; subtype unsigned_long is C.unsigned_long; type Duration_In_Millisec is new C.long; -- New type to prevent confusing time functions in this package -- with time functions returning seconds or other units. type Thread_Id is new unsigned_long; ----------- -- Errno -- ----------- function errno return int; pragma Import (C, errno, "__get_errno"); EAGAIN : constant := 5; EINTR : constant := 13; EINVAL : constant := 14; ENOMEM : constant := 25; ------------- -- Signals -- ------------- Max_Interrupt : constant := 15; type Signal is new int range 0 .. Max_Interrupt; -- Signals for OS/2, only SIGTERM used currently. The values are -- fake, since OS/2 uses 32 bit exception numbers that cannot be -- used to index arrays etc. The GNULLI maps these Unix-like signals -- to OS/2 exception numbers. -- SIGTERM is used for the abort interrupt. SIGHUP : constant := 1; -- hangup SIGINT : constant := 2; -- interrupt (rubout) SIGQUIT : constant := 3; -- quit (ASCD FS) SIGILL : constant := 4; -- illegal instruction (not reset) SIGTRAP : constant := 5; -- trace trap (not reset) SIGIOT : constant := 6; -- IOT instruction SIGEMT : constant := 0; -- EMT instruction SIGFPE : constant := 8; -- floating point exception SIGKILL : constant := 9; -- kill (cannot be caught or ignored) SIGBUS : constant := 10; -- bus error SIGSEGV : constant := 11; -- segmentation violation SIGSYS : constant := 12; -- bad argument to system call SIGPIPE : constant := 13; -- write on a pipe with no one to read it SIGALRM : constant := 14; -- alarm clock SIGTERM : constant := 15; -- software termination signal from kill subtype sigset_t is unsigned_long; ---------- -- Time -- ---------- function Clock return Duration; pragma Inline (Clock); -- Clock measuring time since the epoch, which is the boot-time. -- The clock resolution is approximately 838 ns. procedure Delay_For (Period : in Duration_In_Millisec); pragma Inline (Delay_For); -- Changed Sleep to Delay_For, for consistency with System.Time_Operations ---------------- -- Scheduling -- ---------------- -- Put the calling task at the end of the ready queue for its priority procedure Yield; pragma Inline (Yield); end System.OS_Interface;
Coalg/Core.agda
DDOtten/M-types
0
11843
<reponame>DDOtten/M-types {-# OPTIONS --without-K #-} open import M-types.Base module M-types.Coalg.Core (A : Ty ℓ) (B : A → Ty ℓ) where P : Ty ℓ → Ty ℓ P X = ∑[ a ∈ A ] (B a → X) P-Fun : {X Y : Ty ℓ} → (X → Y) → (P X → P Y) P-Fun f = λ (a , d) → (a , f ∘ d) P-SpanRel : {X : Ty ℓ} → SpanRel X → SpanRel (P X) P-SpanRel {X} ∼ = (P (ty ∼) , P-Fun (ρ₀ ∼) , P-Fun (ρ₁ ∼)) P-SpanRelMor : {X : Ty ℓ} {∼ ≈ : SpanRel X} → SpanRelMor ∼ ≈ → SpanRelMor (P-SpanRel ∼) (P-SpanRel ≈) P-SpanRelMor {X} {∼} {≈} f = ( P-Fun (fun f) , ap P-Fun (com₀ f) , ap P-Fun (com₁ f) ) P-DepRel : {X : Ty ℓ} → DepRel X → DepRel (P X) P-DepRel {X} ∼ = λ (a₀ , d₀) → λ (a₁ , d₁) → ∑[ p ∈ a₀ ≡ a₁ ] ∏[ b₀ ∈ B a₀ ] d₀ b₀ [ ∼ ] d₁ (tra B p b₀) P-DepRelMor : {X : Ty ℓ} {∼ ≈ : DepRel X} → DepRelMor ∼ ≈ → DepRelMor (P-DepRel ∼) (P-DepRel ≈) P-DepRelMor {X} {∼} {≈} f = λ (a₀ , d₀) → λ (a₁ , d₁) → λ (p , e) → ( p , λ b₀ → f (d₀ b₀) (d₁ (tra B p b₀)) (e b₀) ) Coalg : Ty (ℓ-suc ℓ) Coalg = ∑[ ty ∈ Ty ℓ ] (ty → P ty) obs = pr₁ P-Coalg : Coalg → Coalg P-Coalg X = (P (ty X) , P-Fun (obs X)) CoalgMor : Coalg → Coalg → Ty ℓ CoalgMor X Y = ∑[ fun ∈ (ty X → ty Y) ] obs Y ∘ fun ≡ P-Fun fun ∘ obs X com = pr₁ P-CoalgMor : {X Y : Coalg} → CoalgMor X Y → CoalgMor (P-Coalg X) (P-Coalg Y) P-CoalgMor {X} {Y} f = ( P-Fun (fun f) , ap P-Fun (com f) )
src/spread/wdef/main.asm
olifink/qspread
0
13951
<filename>src/spread/wdef/main.asm * Spreadsheet 29/11-91 * - main window layout * include win1_mac_menu_long include win1_keys_colour include win1_keys_wman include win1_keys_wwork include win1_keys_wstatus include win1_keys_wdef_long include win1_spread_keys xref.s met.flag white equ 7 red equ 2 green equ 4 black equ 0 ico.xsiz equ 23 ico.ysiz equ 23 ;16 section menu window main ; main window defintion size mw_mxs,mw_mys ; window size origin 66,78 ; pointer position wattr 3 \ shadow width 1,c.mbord \ border width and colour c.mback ; paper colour sprite 0 border 1,c.mhigh iattr c.mpunav,c.miunav,0,0 ; unavailable iattr c.mpavbl,c.miavbl,0,0 ; available iattr c.mpslct,c.mislct,0,0 ; selected help 0 ; no help window defintion size_opt a ; layout now internal size mw_mxs,mw_mys,4,4 ; minimum size, scalable info main loos main appn mawl s_end * * information window list i_wlst main ; start of info window list * information window #0 flag background i_windw ; Job flag window size 130,14,4,0 ; x-scalable origin mw_fxp,0 ; at fixed position wattr 0,0,0 \ no border c.mfill olst 0 ; no objects * information window #1 flag name i_windw ; Job flag name window size met.flag+met.flag+4,11 origin mw_fxp+130/2-met.flag,2,2,0 ; this is rel. to flag background wattr 0,0,0 \ no border c.tback olst flag * information window #2 filename i_windw ; filename window size 41*6+2,10 origin 200,2,4,0 wattr 0,0,0 \ no border c.iback olst file * information window #3 Zzz divider i_windw size 2,14 origin mw_mxs-6-(mw_lxs+4),1,4,0 ; just left of the Zzz wattr 0,0,0 \ no border c.iback olst 0 * information window #4 border for command items i_windw size mw_mxs-8,12,4,0 origin 4,14 wattr 0 \ no shadow 1,c.ibord \ border c.iback olst fkey * information window #5 border for data entry items * please don't change the number !! (main_setup_asm) i_windw size mw_mxs-8,12,4,0 origin 4,46 wattr 0 \ no shadow 1,c.ibord \ border c.iback olst data * information window #6 window for indices * please don't change the number !! (main_setup_asm) i_windw size mw_mxs-8,mw_mys-69,4,4 ;-62 completely scalable origin 4,66 ;59 wattr 0 \ no shadow 1,c.ibord \ border c.mipap ; we need white paper olst 0 * information window #7 window after again * please don't change the number !! (main_setup_asm) i_windw size 2,18,0,0 ; not scalable origin 6*24+4,27 wattr 0 \ no shadow 0,c.ibord \ border c.iback ; paper olst 0 * information window #8 window after scrap * please don't change the number !! (main_setup_asm) i_windw size 2,18,0,0 ; not scalable origin 12*24+8,27 wattr 0 \ no shadow 0,c.ibord \ border c.iback ; paper olst 0 * information window #9 window after optimal Column with * please don't change the number !! (main_setup_asm) i_windw size 2,18,0,0 ; not scalable origin 17*24+12,27 wattr 0 \ no shadow 0,c.ibord \ border c.iback ; paper olst 0 i_end ; end of info window list * * information object list * for information window #1 (flag) i_olst flag i_item size met.flag+met.flag,10 origin 1,1 type text ink c.tink csize 0,0 text flag i_end * for information window #2 (filename) i_olst file i_item size 41*6+2,10 origin 0,0 type text ink c.iink csize 0,0 text nona ; no name for a start i_end * for border around command items and fkeys i_olst fkey i_item size 12,10 origin 2,2 type sprite spare spare spare spare dc.w 0 sprite f2 i_item size 12,10 origin 2+(mw_cxs+16),2 type sprite spare spare spare spare dc.w 0 sprite f3 i_item size 12,10 origin 2+2*(mw_cxs+16),2 type sprite spare spare spare spare dc.w 0 sprite f4 i_item size 12,10 origin 2+3*(mw_cxs+16),2 type sprite spare spare spare spare dc.w 0 sprite f5 i_item size 12,10 origin 2+4*(mw_cxs+16)+4,2 type sprite spare spare spare spare dc.w 0 sprite f6 i_item size 12,10 origin 5*(mw_cxs+16)-4,2 type sprite spare spare spare spare dc.w 0 sprite f8 i_item size 14,10 origin mw_mxs-24-12*6,2,4,0 type sprite spare spare spare spare dc.w 0 sprite f10 i_end * for border around data entry item i_olst data i_item size 26,10 origin 2,2 type sprite spare spare spare spare dc.w 0 sprite tab i_end * * loose item list l_ilst main ; start of loose items l_item move,0 ; window move item size mw_lxs,mw_lys ; standard size origin 4,2 ; top left hand corner justify 0,0 ; centred both directions type sprite selkey move sprite move item mli.move action move ;------------------------------ l_item size,1 ; window resize item size mw_lxs,mw_lys origin 4+(mw_lxs+4),2 ; just right of move justify 0,0 type sprite selkey size sprite size item mli.size action size ;------------------------------ l_item slep,2 ; sleep job item size mw_lxs,mw_lys origin mw_mxs-4-mw_lxs,2,4,0 ; top right hand side justify 0,0 type sprite selkey slep sprite slep item mli.slep action slep ;------------------------------ l_item cfil,3 ; F2 = File size mw_cxs,mw_lys origin 16,15 justify 1,0 ; left centred type text selkey cfil text cfil item mli.cfil action cfil ;------------------------------ l_item cgrd,4 ; F3 = Grid size mw_cxs+2,mw_lys origin 16+1*(mw_cxs+16),15 justify 1,0 ; left centred type text selkey cgrd text cgrd item mli.cgrd action cgrd ;------------------------------ l_item ccel,5 ; F4 = Cell size mw_cxs,mw_lys origin 16+2*(mw_cxs+16),15 justify 1,0 ; left centred type text selkey ccel text ccel item mli.ccel action ccel ;------------------------------ l_item cstt,6 ; F5 = Status size mw_cxs+4,mw_lys ; it's a bit bigger origin 16+3*(mw_cxs+16),15 justify 1,0 ; left centred type text selkey cstt text cstt item mli.cstt action cstt l_item csmc,7 ; F6 = Macros size mw_cxs-10,mw_lys ; origin 16+4*(mw_cxs+16)+4,15 justify 1,0 ; left centred type text selkey csmc text csmc item mli.csmc action csmc ;------------------------------ * please don't change the number !! (main_setup_asm) l_item goto,8 ; F10 = Goto Cell/Select section size 12*6,10 origin mw_mxs-6-12*6,15,4,0 justify -1,0 type text selkey goto text 0 item mli.goto action goto ;------------------------------ * please don't change the number !! (main_setup_asm) l_item data,9 ; TAB = data/formular entry size mw_mxs-26-50,10,4,0 ; please don't change the number !! origin 24,53 ;47 justify 1,0 type text selkey data text 0 item mli.data action newd * please don't change the number !! (main_setup_asm) l_item ; SHIFT TAB = DO on data/formula entry size mw_mxs-26-50,10,4,0 ; please don't change the number !! origin 24,47 justify 1,0 type text selkey datado text 0 item mli.data action newddo ;------------------------------ * please don't change the number !! (main_setup_asm) l_item csim,11 ; # = immediate mode size 12,10 origin mw_mxs-18,47,4,0 justify 0,0 type text selkey csim text csim item mli.csim action csim l_item call,12 ; F8=all cells size 4*6,10 origin 4+5*(mw_cxs+16)+6,15 justify 0,0 type text selkey call text call item mli.call action 0 * please don't change the number !! (main_setup_asm) l_item csum,13 ; + = summarise mode size 12,10 origin mw_mxs-32,47,4,0 justify 0,0 type sprite selkey csum sprite csum item mli.csum action csum * please don't change the number !! (main_setup_asm) l_item date,14 ; Date size 16,10 origin mw_mxs-50,47,4,0 justify 0,0 type sprite selkey 0 sprite date item mli.date action csdt l_item quit,15 size 2,1 origin 0,0 justify 0,0 type text selkey norm text 0 item mli.quit action quit l_item chlp,16 size ico.xsiz,ico.ysiz ; Jochen's HELP origin 0*25+4,28 justify 0,0 type sprite selkey chlp sprite help item mli.chlp action toolhelp l_item toolload,17 size ico.xsiz,ico.ysiz ; Jochen's LOAD origin 1*25+4,28 justify 0,0 type sprite selkey ctll sprite load item mli.toolload action toolload l_item toolsave,18 size ico.xsiz,ico.ysiz ; Jochen's SAVE origin 2*25+4,28 justify 0,0 type sprite selkey ctlv sprite save item mli.toolsave action toolsave l_item toolprin,19 size ico.xsiz,ico.ysiz ; Jochen's PRINT origin 3*25+4,28 justify 0,0 type sprite selkey ctlp sprite print item mli.toolprin action toolprint l_item toolfind,20 size ico.xsiz,ico.ysiz ; Jochen's FIND origin 4*25+4,28 justify 0,0 type sprite selkey ctls sprite find item mli.toolfind action find l_item caga,21 size ico.xsiz,ico.ysiz ; Jochen's AGAIN origin 5*25+4,28 justify 0,0 type sprite selkey 0 sprite cfind item mli.caga action caga l_item toolcellecho,22 size ico.xsiz,ico.ysiz ; Jochen's CellEcho origin 6*25+4,28 justify 0,0 type sprite selkey ctlz sprite cellecho item mli.toolcellecho action toolcellecho l_item toolcellcopy,23 size ico.xsiz,ico.ysiz ; Jochen's CellCopy origin 7*25+4,28 justify 0,0 type sprite selkey ctly sprite cellcopy item mli.toolcellcopy action toolcellcopy l_item toolcellmove,24 size ico.xsiz,ico.ysiz ; Jochen's CellMove origin 8*25+4,28 justify 0,0 type sprite selkey 0 sprite cellmove item mli.toolcellmove action toolcellmove l_item toolcelldel,25 size ico.xsiz,ico.ysiz ; Jochen's CellDelete origin 9*25+4,28 justify 0,0 type sprite selkey 0 sprite celldel item mli.toolcelldel action toolcelldel l_item toolcellprot,26 size ico.xsiz,ico.ysiz ; Jochen's CellProtect origin 10*25+4,28 justify 0,0 type sprite selkey 0 sprite cellprot item mli.toolcellprot action toolcellprot l_item toolscrap,27 size ico.xsiz,ico.ysiz ; Jochen's Scrap origin 11*25+4,28 justify 0,0 type sprite selkey 0 sprite scrap item mli.toolscrap action toolscrap l_item tooldigit,28 size ico.xsiz,ico.ysiz ; Jochen's Digit origin 12*25+4,28 justify 0,0 type sprite selkey 0 sprite digit item mli.tooldigit action digit l_item toolmoney,29 size ico.xsiz,ico.ysiz ; Jochen's Money origin 13*25+4,28 justify 0,0 type sprite selkey 0 sprite money item mli.toolmoney action money l_item tooljustlf,30 size ico.xsiz,ico.ysiz ; Jochen's Justify Left origin 14*25+4,28 justify 0,1 type sprite selkey 0 sprite justlf item mli.tooljustlf action tooljustlf l_item tooljustrg,31 size ico.xsiz,ico.ysiz ; Jochen's Justify Right origin 15*25+4,28 justify 0,1 type sprite selkey 0 sprite justrg item mli.tooljustrg action tooljustrg l_item tooloptcol,32 size ico.xsiz,ico.ysiz ; Jochen's Optimal Column with origin 16*25+4,28 justify 0,1 type sprite selkey 0 sprite optcol item mli.tooloptcol action gwith l_item toolcalc,33 size ico.xsiz,ico.ysiz ; Jochen's Recalculation origin mw_mxs-4-23,28,4,0 ; right hand side justify 0,0 type sprite selkey ctlr sprite calc item mli.toolcalc action toolcalc l_item password,34 size mw_lxs,mw_lys ; standard size origin 180,2,4,0 justify 0,0 type sprite selkey 0 sprite padlock item mli.password action password l_end ; end of loose item list * * Application sub-window list a_wlst mawl a_windw grid ; just one subwindowl a_end * Application sub-window defintion for grid window a_wdef grid ; grid application sub-window size mw_mxs-8-ww.scbar-2 \ less the index offsets mw_mys-69-ww.pnbar-1 \ 4,4 ; completely scalable origin 4,66 wattr 0 \ no shadow 1,c.wbord \ c.wback sprite 0 setr grid ; setup routine draw grid ; no draw routine action grid ; no action routine at the moment ctrl grid ; control routine ctrlmax 3,3 ; x,y sections selkey grid spare a_ctrl x ; setup control block ibar 0,0 ; spacing setup during runtime border 0,0 iattr c.mipap \ index background c.miink,0,0 ; ..and ink arrow c.wrrow bar c.wbarb,c.wbars a_ctrl y ; setup control block ibar 0,0 ; spacing setup during runtime border 0,0 iattr c.mipap \ index background c.miink,0,0 ; ..and ink arrow c.wrrow bar c.wbarb,c.wbars a_menu border 1,c.whigh iattr c.wpunav,c.wiunav,0,0 ; unavailable iattr c.wpavbl,c.wiavbl,0,0 ; available iattr c.wpslct,c.wislct,0,0 ; selected mensiz 0,0 soffset 2*2+ww.pnarr,2+ww.scarr slst 0,0 ilst 0 ilst 0 rlst 0 a_obje last * * Define symbols and work area size in COMMON setwrk c end
3-mid/impact/source/2d/dynamics/contacts/impact-d2-contact-solver.ads
charlie5/lace
20
22479
with impact.d2.Solid, impact.d2.Types; package impact.d2.contact.Solver -- -- -- is use Impact.d2.Types; type Solid_view is access all Solid.b2Body'Class; type Manifold_view is access all collision.b2Manifold; type b2ContactPositionConstraint is record localPoints : b2Vec2_array (1 .. b2_maxManifoldPoints); localNormal : b2Vec2; localPoint : b2Vec2; indexA, indexB : int32; invMassA, invMassB : float32; localCenterA, localCenterB : b2Vec2; invIA, invIB : float32; Kind : collision.b2Manifold_Kind; radiusA, radiusB : float32; pointCount : int32; end record; type b2ContactPositionConstraints is array (int32 range <>) of aliased b2ContactPositionConstraint; type b2ContactPositionConstraints_view is access all b2ContactPositionConstraints; -- type b2ContactConstraintPoint is type b2VelocityConstraintPoint is record -- localPoint : b2Vec2; rA, rB : b2Vec2; normalImpulse, tangentImpulse, normalMass, tangentMass, velocityBias : float32; end record; type b2VelocityConstraintPoints is array (uint32 range 1 .. b2_maxManifoldPoints) of b2VelocityConstraintPoint; -- type b2ContactConstraint is type b2ContactVelocityConstraint is record points : b2VelocityConstraintPoints; normal : b2Vec2; normalMass : b2Mat22; K : b2Mat22; indexA, indexB : int32; invMassA, invMassB : float32; invIA, invIB : float32; friction, restitution, tangentSpeed : float32; pointCount, contactIndex : int32; end record; type b2ContactVelocityConstraints is array (int32 range <>) of aliased b2ContactVelocityConstraint; type b2ContactVelocityConstraints_view is access all b2ContactVelocityConstraints; type b2ContactSolverDef is record step : b2TimeStep; contacts : access Contact.views; count : int32; positions : access Position_views; velocities : access Velocity_views; end record; type b2ContactSolver is tagged record step : b2TimeStep; positions : access Position_views; velocities : access Velocity_views; positionConstraints : b2ContactPositionConstraints_view; velocityConstraints : b2ContactVelocityConstraints_view; contacts : access Contact.views; count : int32; end record; function to_b2ContactSolver (def : in b2ContactSolverDef) return b2ContactSolver; procedure destruct (Self : in out b2ContactSolver); procedure WarmStart (Self : in out b2ContactSolver); procedure SolveVelocityConstraints (Self : in out b2ContactSolver); procedure StoreImpulses (Self : in out b2ContactSolver); function SolvePositionConstraints (Self : in b2ContactSolver; baumgarte : float32) return Boolean; end impact.d2.contact.Solver;
Examples/ch13/Hello.asm
satadriver/LiunuxOS_t
0
84948
<gh_stars>0 TITLE Hello World Program (Hello.asm) ; This program displays "Hello, world!" .model small .stack 100h .386 .data message BYTE "Hello, world!",0dh,0ah .code main PROC mov ax,@data mov ds,ax mov ah,40h ; write to file/device mov bx,1 ; output handle mov cx,SIZEOF message ; number of bytes mov dx,OFFSET message ; addr of buffer int 21h .exit main ENDP END main
toggle_proxies_silly.scpt
Kaceykaso/AppleScripts
0
1371
<reponame>Kaceykaso/AppleScripts<filename>toggle_proxies_silly.scpt<gh_stars>0 --Silly script that uses AppleScripting GUI scripting to toggle Internet proxies --Save this script as an app and keep in your dock or desktop to easily toggle settings with one click --Watch the magic happen! --Author: <EMAIL> --Declare variables for status messages global outStr1, outStr2 --Toggle function on toggle_proxy() --Open System Preferences tell application "System Preferences" activate set current pane to pane "com.apple.preference.network" end tell --Tell OS to do stuff tell application "System Events" get properties --Make System Preferences active tell process "System Preferences" --Get Network pane tell window "Network" -- Selects the active network connection; IE Wi-Fi if you're on wifi --Table 1 is the list of connections on the left side of the window --Scroll Area 1 is the area on the left that Table 1 is inside of tell table 1 of scroll area 1 --Row 1 should be Wi-Fi click row 1 end tell --Select the Advanced button click button 8 --Once the Advance page slides down, select the Proxies tab --Tab group 1 is the row of tabs at the top --Sheet 1 is that entire Advanced page that slides in tell tab group 1 of sheet 1 --The tabs are aparently radio buttons, don't ask :P --Radio button 6 is the Proxies tab click radio button 6 --Group 1 is the first grouping on the Proxies tab (Select a protocol to configure) tell group 1 --Table 1 is the list of items in Group 1 --Scroll area 1 is that first window on the left that Table 1 is in --Example (Group 1(Scroll Area 1(Table 1(Row 1)))) tell table 1 of scroll area 1 --Toggle for Web Proxy (HTTP) --Row 3 should be Web Proxy set selected of row 3 to true click checkbox 1 of row 3 if value of (checkbox 1 of row 3) is 1 then set outStr1 to "1" else set outStr1 to "0" end if --Toggle for Secure Web Proxy (HTTPS) --Row 4 should be Secure Web Proxy set selected of row 4 to true click checkbox 1 of row 4 if value of (checkbox 1 of row 4) is 1 then set outStr2 to "1" else set outStr2 to "0" end if end tell end tell end tell --Select the Ok button on the Proxies tab to back out of Advanced tell sheet 1 click button "OK" end tell end tell --Select the Apply button on the Network window tell window "Network" click button "Apply" end tell end tell end tell --Quit System Preferences tell application "System Preferences" quit end tell end toggle_proxy --Now do the work! try toggle_proxy() --If the Web Proxy was toggled, tell us if (outStr1 = "1") then --If the Secure Web Proxy was toggled, tell us if (outStr2 = "1") then set statusStr to "The internets have been opened!" else set statusStr to "The internets have been closed!" end if else --Otherwise, tell us this instead set statusStr to "The internets have been closed!" end if --Display Notification Center notification if successful display notification statusStr with title "Proxy Toggle" --Open Safari tell application "Safari" activate --Opens a silly webpage to check for successful internet connection --This can be changed to any URL open location "http://www.omfgdogs.com/" end tell --Terminal will now speak! say statusStr end try
oeis/040/A040606.asm
neoneye/loda-programs
11
17267
<reponame>neoneye/loda-programs ; A040606: Continued fraction for sqrt(632). ; Submitted by <NAME> ; 25,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7,50,7,6,7 seq $0,40281 ; Continued fraction for sqrt(299). mov $1,$0 mov $0,8 mov $2,$1 div $2,7 sub $0,$2 div $0,3 add $0,7 mul $0,4 add $0,$1 pow $2,2 add $2,$0 mov $0,$2 sub $0,32
hmi_sdk/hmi_sdk/Tools/ffmpeg-2.6.2/libavcodec/x86/h264_weight_10bit.asm
APCVSRepo/android_packet
4
24882
<gh_stars>1-10 ;***************************************************************************** ;* MMX/SSE2/AVX-optimized 10-bit H.264 weighted prediction code ;***************************************************************************** ;* Copyright (C) 2005-2011 x264 project ;* ;* Authors: <NAME> <<EMAIL>> ;* ;* This file is part of FFmpeg. ;* ;* FFmpeg is free software; you can redistribute it and/or ;* modify it under the terms of the GNU Lesser General Public ;* License as published by the Free Software Foundation; either ;* version 2.1 of the License, or (at your option) any later version. ;* ;* FFmpeg 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 ;* Lesser General Public License for more details. ;* ;* You should have received a copy of the GNU Lesser General Public ;* License along with FFmpeg; if not, write to the Free Software ;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ;****************************************************************************** %include "libavutil/x86/x86util.asm" SECTION_RODATA 32 sq_1: dq 1 dq 0 cextern pw_1 cextern pw_1023 %define pw_pixel_max pw_1023 SECTION .text ;----------------------------------------------------------------------------- ; void ff_h264_weight_16_10(uint8_t *dst, int stride, int height, ; int log2_denom, int weight, int offset); ;----------------------------------------------------------------------------- %macro WEIGHT_PROLOGUE 0 .prologue: PROLOGUE 0,6,8 movifnidn r0, r0mp movifnidn r1d, r1m movifnidn r2d, r2m movifnidn r4d, r4m movifnidn r5d, r5m %endmacro %macro WEIGHT_SETUP 0 mova m0, [pw_1] movd m2, r3m pslld m0, m2 ; 1<<log2_denom SPLATW m0, m0 shl r5, 19 ; *8, move to upper half of dword lea r5, [r5+r4*2+0x10000] movd m3, r5d ; weight<<1 | 1+(offset<<(3)) pshufd m3, m3, 0 mova m4, [pw_pixel_max] paddw m2, [sq_1] ; log2_denom+1 %if notcpuflag(sse4) pxor m7, m7 %endif %endmacro %macro WEIGHT_OP 1-2 %if %0==1 mova m5, [r0+%1] punpckhwd m6, m5, m0 punpcklwd m5, m0 %else movq m5, [r0+%1] movq m6, [r0+%2] punpcklwd m5, m0 punpcklwd m6, m0 %endif pmaddwd m5, m3 pmaddwd m6, m3 psrad m5, m2 psrad m6, m2 %if cpuflag(sse4) packusdw m5, m6 pminsw m5, m4 %else packssdw m5, m6 CLIPW m5, m7, m4 %endif %endmacro %macro WEIGHT_FUNC_DBL 0 cglobal h264_weight_16_10 WEIGHT_PROLOGUE WEIGHT_SETUP .nextrow: WEIGHT_OP 0 mova [r0 ], m5 WEIGHT_OP 16 mova [r0+16], m5 add r0, r1 dec r2d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 WEIGHT_FUNC_DBL INIT_XMM sse4 WEIGHT_FUNC_DBL %macro WEIGHT_FUNC_MM 0 cglobal h264_weight_8_10 WEIGHT_PROLOGUE WEIGHT_SETUP .nextrow: WEIGHT_OP 0 mova [r0], m5 add r0, r1 dec r2d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 WEIGHT_FUNC_MM INIT_XMM sse4 WEIGHT_FUNC_MM %macro WEIGHT_FUNC_HALF_MM 0 cglobal h264_weight_4_10 WEIGHT_PROLOGUE sar r2d, 1 WEIGHT_SETUP lea r3, [r1*2] .nextrow: WEIGHT_OP 0, r1 movh [r0], m5 movhps [r0+r1], m5 add r0, r3 dec r2d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 WEIGHT_FUNC_HALF_MM INIT_XMM sse4 WEIGHT_FUNC_HALF_MM ;----------------------------------------------------------------------------- ; void ff_h264_biweight_16_10(uint8_t *dst, uint8_t *src, int stride, ; int height, int log2_denom, int weightd, ; int weights, int offset); ;----------------------------------------------------------------------------- %if ARCH_X86_32 DECLARE_REG_TMP 3 %else DECLARE_REG_TMP 7 %endif %macro BIWEIGHT_PROLOGUE 0 .prologue: PROLOGUE 0,8,8 movifnidn r0, r0mp movifnidn r1, r1mp movifnidn r2d, r2m movifnidn r5d, r5m movifnidn r6d, r6m movifnidn t0d, r7m %endmacro %macro BIWEIGHT_SETUP 0 lea t0, [t0*4+1] ; (offset<<2)+1 or t0, 1 shl r6, 16 or r5, r6 movd m4, r5d ; weightd | weights movd m5, t0d ; (offset+1)|1 movd m6, r4m ; log2_denom pslld m5, m6 ; (((offset<<2)+1)|1)<<log2_denom paddd m6, [sq_1] pshufd m4, m4, 0 pshufd m5, m5, 0 mova m3, [pw_pixel_max] movifnidn r3d, r3m %if notcpuflag(sse4) pxor m7, m7 %endif %endmacro %macro BIWEIGHT 1-2 %if %0==1 mova m0, [r0+%1] mova m1, [r1+%1] punpckhwd m2, m0, m1 punpcklwd m0, m1 %else movq m0, [r0+%1] movq m1, [r1+%1] punpcklwd m0, m1 movq m2, [r0+%2] movq m1, [r1+%2] punpcklwd m2, m1 %endif pmaddwd m0, m4 pmaddwd m2, m4 paddd m0, m5 paddd m2, m5 psrad m0, m6 psrad m2, m6 %if cpuflag(sse4) packusdw m0, m2 pminsw m0, m3 %else packssdw m0, m2 CLIPW m0, m7, m3 %endif %endmacro %macro BIWEIGHT_FUNC_DBL 0 cglobal h264_biweight_16_10 BIWEIGHT_PROLOGUE BIWEIGHT_SETUP .nextrow: BIWEIGHT 0 mova [r0 ], m0 BIWEIGHT 16 mova [r0+16], m0 add r0, r2 add r1, r2 dec r3d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 BIWEIGHT_FUNC_DBL INIT_XMM sse4 BIWEIGHT_FUNC_DBL %macro BIWEIGHT_FUNC 0 cglobal h264_biweight_8_10 BIWEIGHT_PROLOGUE BIWEIGHT_SETUP .nextrow: BIWEIGHT 0 mova [r0], m0 add r0, r2 add r1, r2 dec r3d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 BIWEIGHT_FUNC INIT_XMM sse4 BIWEIGHT_FUNC %macro BIWEIGHT_FUNC_HALF 0 cglobal h264_biweight_4_10 BIWEIGHT_PROLOGUE BIWEIGHT_SETUP sar r3d, 1 lea r4, [r2*2] .nextrow: BIWEIGHT 0, r2 movh [r0 ], m0 movhps [r0+r2], m0 add r0, r4 add r1, r4 dec r3d jnz .nextrow REP_RET %endmacro INIT_XMM sse2 BIWEIGHT_FUNC_HALF INIT_XMM sse4 BIWEIGHT_FUNC_HALF
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_1776.asm
ljhsiun2/medusa
9
14061
.global s_prepare_buffers s_prepare_buffers: push %r13 push %r14 push %r15 push %rax push %rcx push %rdx push %rsi lea addresses_A_ht+0x177ac, %r15 nop and %rsi, %rsi vmovups (%r15), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %rcx nop nop nop nop sub %r15, %r15 lea addresses_WC_ht+0x612c, %rdx nop cmp $27734, %rax and $0xffffffffffffffc0, %rdx vmovntdqa (%rdx), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $0, %xmm5, %r14 nop nop nop nop nop inc %rdx lea addresses_WC_ht+0xbd7c, %r14 nop add $1398, %r13 mov (%r14), %eax nop nop add $18246, %rcx lea addresses_normal_ht+0x1ef2c, %rdx nop nop nop nop sub %rcx, %rcx mov $0x6162636465666768, %rsi movq %rsi, (%rdx) nop nop nop nop add %rdx, %rdx pop %rsi pop %rdx pop %rcx pop %rax pop %r15 pop %r14 pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r14 push %rbx push %rcx push %rsi // Store lea addresses_RW+0xda84, %r11 nop nop nop nop sub $63937, %rcx movw $0x5152, (%r11) nop cmp $63956, %rcx // Faulty Load lea addresses_WT+0xe12c, %r11 nop nop sub $37959, %rbx mov (%r11), %ecx lea oracles, %r14 and $0xff, %rcx shlq $12, %rcx mov (%r14,%rcx,1), %rcx pop %rsi pop %rcx pop %rbx pop %r14 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_WT', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_RW', 'congruent': 1}, 'OP': 'STOR'} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WT', 'congruent': 0}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_A_ht', 'congruent': 1}} {'OP': 'LOAD', 'src': {'same': False, 'NT': True, 'AVXalign': False, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 7}} {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC_ht', 'congruent': 4}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 9}, 'OP': 'STOR'} {'39': 21829} 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 */
java-ch03/src/main/grammar/InputExpression.g4
tombaeyens/pwe
22
386
grammar InputExpression; booleanExpression : expression | not | expression and | expression or | expression lt | bracketBooleanExpression ; bracketBooleanExpression : '(' booleanExpression ')' ; lt : '<' expression ; not : '!' booleanExpression ; and : '&&' booleanExpression ; or : '||' booleanExpression ; expression : term | '(' expression ')' | term plus ; term : name | name dereference+ | list | number | string ; name : '$' ID ; dereference : '.' ID ; plus : '+' expression ; list : '[' ']' | '[' expression ( ',' expression )* ']' ; number : NUMBER ; string : STRING ; ID : [a-zA-Z_][a-zA-Z_0-9]* ; NUMBER : [0-9]+ ('.'[0-9]*)? ; STRING : '"' ( ESC | ~('"'|'\\'|'\n'|'\r') )* '"' ; fragment ESC : '\\' ( 'n' | 'r' | 't' | 'b' | 'f' | '"' | '\'' | '/' | '\\' | ('u')+ ) ; HEX_DIGIT : [a-fA-F0-9]+ ; WHITESPACE : [ \t\r\n]+ -> skip ;
oeis/176/A176332.asm
neoneye/loda-programs
11
103134
; A176332: Row sums of triangle A176331. ; Submitted by <NAME> ; 1,2,5,16,56,202,741,2752,10318,38972,148070,565280,2166646,8332378,32136205,124249856,481433286,1868972828,7267804550,28304698336,110383060776,431000853028,1684754608210,6592277745536,25818887839956,101206901953952,397031054526176,1558672906311232,6123205616794418,24069973737914362,94673173853392701,372577161143450624,1466994503296066630,5778965177765245356,22775534815539511726,89799239851533734752,354202738743060140576,1397644771930594540972,5516943606911197381718,21784572048498543445632 mov $2,$0 mov $4,$0 add $4,1 lpb $4 mov $0,$2 mul $3,-1 sub $4,1 sub $0,$4 mul $0,2 bin $0,$2 add $3,$0 lpe mov $0,$3
test/Fail/Issue1976-constraints.agda
pthariensflame/agda
3
4417
-- Andreas, 2016-12-31, re issue #1976 -- Allow projection pattern disambiguation by parameters {-# OPTIONS --allow-unsolved-metas #-} postulate A B : Set module M (_ : Set) where record R : Set₂ where field F : Set₁ open R public module Succeeds where open M _ open M B test : M.R B F test = Set module ShouldFail where open M A open M _ test : M.R B F test = Set -- should fail module Fails where open M _ open M A test : M.R B F test = Set
libsrc/_DEVELOPMENT/math/float/am9511/z80/am32_sigdig.asm
ahjelm/z88dk
640
12189
<filename>libsrc/_DEVELOPMENT/math/float/am9511/z80/am32_sigdig.asm<gh_stars>100-1000 ; ; Copyright (c) 2020 <NAME> ; ; This Source Code Form is subject to the terms of the Mozilla Public ; License, v. 2.0. If a copy of the MPL was not distributed with this ; file, You can obtain one at http://mozilla.org/MPL/2.0/. ; ; feilipu, August 2020 ; ;------------------------------------------------------------------------- SECTION code_clib SECTION code_fp_am9511 PUBLIC asm_am9511_sigdig asm_am9511_sigdig: ; exit : b = number of significant hex digits in double representation ; c = number of significant decimal digits in double representation ; ; uses : bc ld bc,$0607 ret
programs/oeis/051/A051192.asm
karttu/loda
1
177200
; A051192: T(n,7), array T as in A050186; a count of aperiodic binary words. ; 0,8,36,120,330,792,1716,3430,6435,11440,19448,31824,50388,77520,116277,170544,245157,346104,480700,657800,888030,1184036,1560780,2035800,2629575,3365856,4272048,5379616,6724515,8347680,10295472 mov $1,$0 add $1,7 bin $1,$0 add $0,7 div $1,$0 mul $1,$0
programs/oeis/063/A063144.asm
karttu/loda
1
10468
<gh_stars>1-10 ; A063144: Dimension of the space of weight 2n cusp forms for Gamma_0( 76 ). ; 8,27,47,67,87,107,127,147,167,187,207,227,247,267,287,307,327,347,367,387,407,427,447,467,487,507,527,547,567,587,607,627,647,667,687,707,727,747,767,787,807,827,847,867,887,907,927,947,967 mov $1,$0 mul $1,20 trn $1,1 add $1,8
test_4.asm
Anson-Doan/-CS537-Spring2021-P3b-xv6KernelThreads
0
174138
_test_4: file format elf32-i386 Disassembly of section .text: 00000000 <worker>: free(p); exit(); } void worker(void *arg1, void *arg2) { 0: f3 0f 1e fb endbr32 4: 55 push %ebp 5: 89 e5 mov %esp,%ebp 7: 83 ec 08 sub $0x8,%esp exit(); a: e8 1d 04 00 00 call 42c <exit> 0000000f <main>: { f: f3 0f 1e fb endbr32 13: 8d 4c 24 04 lea 0x4(%esp),%ecx 17: 83 e4 f0 and $0xfffffff0,%esp 1a: ff 71 fc pushl -0x4(%ecx) 1d: 55 push %ebp 1e: 89 e5 mov %esp,%ebp 20: 53 push %ebx 21: 51 push %ecx ppid = getpid(); 22: e8 8d 04 00 00 call 4b4 <getpid> 27: a3 2c 0c 00 00 mov %eax,0xc2c void *stack, *p = malloc(PGSIZE * 2); 2c: 83 ec 0c sub $0xc,%esp 2f: 68 00 20 00 00 push $0x2000 34: e8 6d 07 00 00 call 7a6 <malloc> assert(p != NULL); 39: 83 c4 10 add $0x10,%esp 3c: 85 c0 test %eax,%eax 3e: 74 70 je b0 <main+0xa1> 40: 89 c3 mov %eax,%ebx if((uint)p % PGSIZE == 0) 42: a9 ff 0f 00 00 test $0xfff,%eax 47: 75 03 jne 4c <main+0x3d> stack = p + 4; 49: 8d 40 04 lea 0x4(%eax),%eax assert(clone(worker, 0, 0, stack) == -1); 4c: 50 push %eax 4d: 6a 00 push $0x0 4f: 6a 00 push $0x0 51: 68 00 00 00 00 push $0x0 56: e8 c9 03 00 00 call 424 <clone> 5b: 83 c4 10 add $0x10,%esp 5e: 83 f8 ff cmp $0xffffffff,%eax 61: 0f 84 92 00 00 00 je f9 <main+0xea> 67: 6a 21 push $0x21 69: 68 34 08 00 00 push $0x834 6e: 68 3d 08 00 00 push $0x83d 73: 6a 01 push $0x1 75: e8 fb 04 00 00 call 575 <printf> 7a: 83 c4 0c add $0xc,%esp 7d: 68 80 08 00 00 push $0x880 82: 68 4f 08 00 00 push $0x84f 87: 6a 01 push $0x1 89: e8 e7 04 00 00 call 575 <printf> 8e: 83 c4 08 add $0x8,%esp 91: 68 63 08 00 00 push $0x863 96: 6a 01 push $0x1 98: e8 d8 04 00 00 call 575 <printf> 9d: 83 c4 04 add $0x4,%esp a0: ff 35 2c 0c 00 00 pushl 0xc2c a6: e8 b9 03 00 00 call 464 <kill> ab: e8 7c 03 00 00 call 42c <exit> assert(p != NULL); b0: 6a 1b push $0x1b b2: 68 34 08 00 00 push $0x834 b7: 68 3d 08 00 00 push $0x83d bc: 6a 01 push $0x1 be: e8 b2 04 00 00 call 575 <printf> c3: 83 c4 0c add $0xc,%esp c6: 68 45 08 00 00 push $0x845 cb: 68 4f 08 00 00 push $0x84f d0: 6a 01 push $0x1 d2: e8 9e 04 00 00 call 575 <printf> d7: 83 c4 08 add $0x8,%esp da: 68 63 08 00 00 push $0x863 df: 6a 01 push $0x1 e1: e8 8f 04 00 00 call 575 <printf> e6: 83 c4 04 add $0x4,%esp e9: ff 35 2c 0c 00 00 pushl 0xc2c ef: e8 70 03 00 00 call 464 <kill> f4: e8 33 03 00 00 call 42c <exit> printf(1, "TEST PASSED\n"); f9: 83 ec 08 sub $0x8,%esp fc: 68 70 08 00 00 push $0x870 101: 6a 01 push $0x1 103: e8 6d 04 00 00 call 575 <printf> free(p); 108: 89 1c 24 mov %ebx,(%esp) 10b: e8 d2 05 00 00 call 6e2 <free> exit(); 110: e8 17 03 00 00 call 42c <exit> 00000115 <strcpy>: ptr_storage ptr_pairs[NPROC]; int cell_full[NPROC]; char* strcpy(char *s, const char *t) { 115: f3 0f 1e fb endbr32 119: 55 push %ebp 11a: 89 e5 mov %esp,%ebp 11c: 56 push %esi 11d: 53 push %ebx 11e: 8b 75 08 mov 0x8(%ebp),%esi 121: 8b 55 0c mov 0xc(%ebp),%edx char *os; os = s; while((*s++ = *t++) != 0) 124: 89 f0 mov %esi,%eax 126: 89 d1 mov %edx,%ecx 128: 83 c2 01 add $0x1,%edx 12b: 89 c3 mov %eax,%ebx 12d: 83 c0 01 add $0x1,%eax 130: 0f b6 09 movzbl (%ecx),%ecx 133: 88 0b mov %cl,(%ebx) 135: 84 c9 test %cl,%cl 137: 75 ed jne 126 <strcpy+0x11> ; return os; } 139: 89 f0 mov %esi,%eax 13b: 5b pop %ebx 13c: 5e pop %esi 13d: 5d pop %ebp 13e: c3 ret 0000013f <strcmp>: int strcmp(const char *p, const char *q) { 13f: f3 0f 1e fb endbr32 143: 55 push %ebp 144: 89 e5 mov %esp,%ebp 146: 8b 4d 08 mov 0x8(%ebp),%ecx 149: 8b 55 0c mov 0xc(%ebp),%edx while(*p && *p == *q) 14c: 0f b6 01 movzbl (%ecx),%eax 14f: 84 c0 test %al,%al 151: 74 0c je 15f <strcmp+0x20> 153: 3a 02 cmp (%edx),%al 155: 75 08 jne 15f <strcmp+0x20> p++, q++; 157: 83 c1 01 add $0x1,%ecx 15a: 83 c2 01 add $0x1,%edx 15d: eb ed jmp 14c <strcmp+0xd> return (uchar)*p - (uchar)*q; 15f: 0f b6 c0 movzbl %al,%eax 162: 0f b6 12 movzbl (%edx),%edx 165: 29 d0 sub %edx,%eax } 167: 5d pop %ebp 168: c3 ret 00000169 <strlen>: uint strlen(const char *s) { 169: f3 0f 1e fb endbr32 16d: 55 push %ebp 16e: 89 e5 mov %esp,%ebp 170: 8b 4d 08 mov 0x8(%ebp),%ecx int n; for(n = 0; s[n]; n++) 173: b8 00 00 00 00 mov $0x0,%eax 178: 80 3c 01 00 cmpb $0x0,(%ecx,%eax,1) 17c: 74 05 je 183 <strlen+0x1a> 17e: 83 c0 01 add $0x1,%eax 181: eb f5 jmp 178 <strlen+0xf> ; return n; } 183: 5d pop %ebp 184: c3 ret 00000185 <memset>: void* memset(void *dst, int c, uint n) { 185: f3 0f 1e fb endbr32 189: 55 push %ebp 18a: 89 e5 mov %esp,%ebp 18c: 57 push %edi 18d: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : 190: 89 d7 mov %edx,%edi 192: 8b 4d 10 mov 0x10(%ebp),%ecx 195: 8b 45 0c mov 0xc(%ebp),%eax 198: fc cld 199: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } 19b: 89 d0 mov %edx,%eax 19d: 5f pop %edi 19e: 5d pop %ebp 19f: c3 ret 000001a0 <strchr>: char* strchr(const char *s, char c) { 1a0: f3 0f 1e fb endbr32 1a4: 55 push %ebp 1a5: 89 e5 mov %esp,%ebp 1a7: 8b 45 08 mov 0x8(%ebp),%eax 1aa: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for(; *s; s++) 1ae: 0f b6 10 movzbl (%eax),%edx 1b1: 84 d2 test %dl,%dl 1b3: 74 09 je 1be <strchr+0x1e> if(*s == c) 1b5: 38 ca cmp %cl,%dl 1b7: 74 0a je 1c3 <strchr+0x23> for(; *s; s++) 1b9: 83 c0 01 add $0x1,%eax 1bc: eb f0 jmp 1ae <strchr+0xe> return (char*)s; return 0; 1be: b8 00 00 00 00 mov $0x0,%eax } 1c3: 5d pop %ebp 1c4: c3 ret 000001c5 <gets>: char* gets(char *buf, int max) { 1c5: f3 0f 1e fb endbr32 1c9: 55 push %ebp 1ca: 89 e5 mov %esp,%ebp 1cc: 57 push %edi 1cd: 56 push %esi 1ce: 53 push %ebx 1cf: 83 ec 1c sub $0x1c,%esp 1d2: 8b 7d 08 mov 0x8(%ebp),%edi int i, cc; char c; for(i=0; i+1 < max; ){ 1d5: bb 00 00 00 00 mov $0x0,%ebx 1da: 89 de mov %ebx,%esi 1dc: 83 c3 01 add $0x1,%ebx 1df: 3b 5d 0c cmp 0xc(%ebp),%ebx 1e2: 7d 2e jge 212 <gets+0x4d> cc = read(0, &c, 1); 1e4: 83 ec 04 sub $0x4,%esp 1e7: 6a 01 push $0x1 1e9: 8d 45 e7 lea -0x19(%ebp),%eax 1ec: 50 push %eax 1ed: 6a 00 push $0x0 1ef: e8 58 02 00 00 call 44c <read> if(cc < 1) 1f4: 83 c4 10 add $0x10,%esp 1f7: 85 c0 test %eax,%eax 1f9: 7e 17 jle 212 <gets+0x4d> break; buf[i++] = c; 1fb: 0f b6 45 e7 movzbl -0x19(%ebp),%eax 1ff: 88 04 37 mov %al,(%edi,%esi,1) if(c == '\n' || c == '\r') 202: 3c 0a cmp $0xa,%al 204: 0f 94 c2 sete %dl 207: 3c 0d cmp $0xd,%al 209: 0f 94 c0 sete %al 20c: 08 c2 or %al,%dl 20e: 74 ca je 1da <gets+0x15> buf[i++] = c; 210: 89 de mov %ebx,%esi break; } buf[i] = '\0'; 212: c6 04 37 00 movb $0x0,(%edi,%esi,1) return buf; } 216: 89 f8 mov %edi,%eax 218: 8d 65 f4 lea -0xc(%ebp),%esp 21b: 5b pop %ebx 21c: 5e pop %esi 21d: 5f pop %edi 21e: 5d pop %ebp 21f: c3 ret 00000220 <stat>: int stat(const char *n, struct stat *st) { 220: f3 0f 1e fb endbr32 224: 55 push %ebp 225: 89 e5 mov %esp,%ebp 227: 56 push %esi 228: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); 229: 83 ec 08 sub $0x8,%esp 22c: 6a 00 push $0x0 22e: ff 75 08 pushl 0x8(%ebp) 231: e8 3e 02 00 00 call 474 <open> if(fd < 0) 236: 83 c4 10 add $0x10,%esp 239: 85 c0 test %eax,%eax 23b: 78 24 js 261 <stat+0x41> 23d: 89 c3 mov %eax,%ebx return -1; r = fstat(fd, st); 23f: 83 ec 08 sub $0x8,%esp 242: ff 75 0c pushl 0xc(%ebp) 245: 50 push %eax 246: e8 41 02 00 00 call 48c <fstat> 24b: 89 c6 mov %eax,%esi close(fd); 24d: 89 1c 24 mov %ebx,(%esp) 250: e8 07 02 00 00 call 45c <close> return r; 255: 83 c4 10 add $0x10,%esp } 258: 89 f0 mov %esi,%eax 25a: 8d 65 f8 lea -0x8(%ebp),%esp 25d: 5b pop %ebx 25e: 5e pop %esi 25f: 5d pop %ebp 260: c3 ret return -1; 261: be ff ff ff ff mov $0xffffffff,%esi 266: eb f0 jmp 258 <stat+0x38> 00000268 <atoi>: int atoi(const char *s) { 268: f3 0f 1e fb endbr32 26c: 55 push %ebp 26d: 89 e5 mov %esp,%ebp 26f: 53 push %ebx 270: 8b 4d 08 mov 0x8(%ebp),%ecx int n; n = 0; 273: ba 00 00 00 00 mov $0x0,%edx while('0' <= *s && *s <= '9') 278: 0f b6 01 movzbl (%ecx),%eax 27b: 8d 58 d0 lea -0x30(%eax),%ebx 27e: 80 fb 09 cmp $0x9,%bl 281: 77 12 ja 295 <atoi+0x2d> n = n*10 + *s++ - '0'; 283: 8d 1c 92 lea (%edx,%edx,4),%ebx 286: 8d 14 1b lea (%ebx,%ebx,1),%edx 289: 83 c1 01 add $0x1,%ecx 28c: 0f be c0 movsbl %al,%eax 28f: 8d 54 10 d0 lea -0x30(%eax,%edx,1),%edx 293: eb e3 jmp 278 <atoi+0x10> return n; } 295: 89 d0 mov %edx,%eax 297: 5b pop %ebx 298: 5d pop %ebp 299: c3 ret 0000029a <memmove>: void* memmove(void *vdst, const void *vsrc, int n) { 29a: f3 0f 1e fb endbr32 29e: 55 push %ebp 29f: 89 e5 mov %esp,%ebp 2a1: 56 push %esi 2a2: 53 push %ebx 2a3: 8b 75 08 mov 0x8(%ebp),%esi 2a6: 8b 4d 0c mov 0xc(%ebp),%ecx 2a9: 8b 45 10 mov 0x10(%ebp),%eax char *dst; const char *src; dst = vdst; 2ac: 89 f2 mov %esi,%edx src = vsrc; while(n-- > 0) 2ae: 8d 58 ff lea -0x1(%eax),%ebx 2b1: 85 c0 test %eax,%eax 2b3: 7e 0f jle 2c4 <memmove+0x2a> *dst++ = *src++; 2b5: 0f b6 01 movzbl (%ecx),%eax 2b8: 88 02 mov %al,(%edx) 2ba: 8d 49 01 lea 0x1(%ecx),%ecx 2bd: 8d 52 01 lea 0x1(%edx),%edx while(n-- > 0) 2c0: 89 d8 mov %ebx,%eax 2c2: eb ea jmp 2ae <memmove+0x14> return vdst; } 2c4: 89 f0 mov %esi,%eax 2c6: 5b pop %ebx 2c7: 5e pop %esi 2c8: 5d pop %ebp 2c9: c3 ret 000002ca <thread_create>: int thread_create(void (*start_routine)(void *, void *), void *arg1, void *arg2) { 2ca: f3 0f 1e fb endbr32 2ce: 55 push %ebp 2cf: 89 e5 mov %esp,%ebp 2d1: 53 push %ebx 2d2: 83 ec 10 sub $0x10,%esp void *curr_ptr = malloc(PGSIZE*2); 2d5: 68 00 20 00 00 push $0x2000 2da: e8 c7 04 00 00 call 7a6 <malloc> void *user_stack = curr_ptr; if ((uint)user_stack % PGSIZE != 0) { 2df: 83 c4 10 add $0x10,%esp 2e2: 89 c2 mov %eax,%edx 2e4: 81 e2 ff 0f 00 00 and $0xfff,%edx 2ea: 74 22 je 30e <thread_create+0x44> user_stack += (PGSIZE - ((uint)user_stack % PGSIZE)); 2ec: b9 00 10 00 00 mov $0x1000,%ecx 2f1: 29 d1 sub %edx,%ecx 2f3: 01 c1 add %eax,%ecx } int i; for (i = 0; i < NPROC; i++) { 2f5: ba 00 00 00 00 mov $0x0,%edx 2fa: 83 fa 3f cmp $0x3f,%edx 2fd: 7f 13 jg 312 <thread_create+0x48> if (cell_full[i] != 1) { break; } 2ff: 83 3c 95 40 0f 00 00 cmpl $0x1,0xf40(,%edx,4) 306: 01 307: 75 09 jne 312 <thread_create+0x48> for (i = 0; i < NPROC; i++) { 309: 83 c2 01 add $0x1,%edx 30c: eb ec jmp 2fa <thread_create+0x30> void *user_stack = curr_ptr; 30e: 89 c1 mov %eax,%ecx 310: eb e3 jmp 2f5 <thread_create+0x2b> } if (cell_full[i] == 1) { 312: 83 3c 95 40 0f 00 00 cmpl $0x1,0xf40(,%edx,4) 319: 01 31a: 74 34 je 350 <thread_create+0x86> return -1; } ptr_pairs[i].orig_ptr = curr_ptr; 31c: 8d 1c 52 lea (%edx,%edx,2),%ebx 31f: c1 e3 02 shl $0x2,%ebx 322: 89 83 40 0c 00 00 mov %eax,0xc40(%ebx) ptr_pairs[i].offset_ptr = user_stack; 328: 89 8b 44 0c 00 00 mov %ecx,0xc44(%ebx) cell_full[i] = 1; 32e: c7 04 95 40 0f 00 00 movl $0x1,0xf40(,%edx,4) 335: 01 00 00 00 // curr_ptrs->next->orig_ptr = curr_ptr; // curr_ptrs->next->offset_ptr = user_stack; // curr_ptrs->next->next = NULL; // } return clone(user_stack, start_routine, arg1, arg2); 339: ff 75 10 pushl 0x10(%ebp) 33c: ff 75 0c pushl 0xc(%ebp) 33f: ff 75 08 pushl 0x8(%ebp) 342: 51 push %ecx 343: e8 dc 00 00 00 call 424 <clone> 348: 83 c4 10 add $0x10,%esp } 34b: 8b 5d fc mov -0x4(%ebp),%ebx 34e: c9 leave 34f: c3 ret return -1; 350: b8 ff ff ff ff mov $0xffffffff,%eax 355: eb f4 jmp 34b <thread_create+0x81> 00000357 <thread_join>: int thread_join(){ 357: f3 0f 1e fb endbr32 35b: 55 push %ebp 35c: 89 e5 mov %esp,%ebp 35e: 56 push %esi 35f: 53 push %ebx 360: 83 ec 1c sub $0x1c,%esp void* diov; int out = join(&diov); 363: 8d 45 f4 lea -0xc(%ebp),%eax 366: 50 push %eax 367: e8 d0 00 00 00 call 43c <join> 36c: 89 c6 mov %eax,%esi // free(curr_ptrs->orig_ptr); // prev_ptrs->next = curr_ptrs->next; // free(curr_ptrs); int i; for (i = 0; i < NPROC; i++) { 36e: 83 c4 10 add $0x10,%esp 371: bb 00 00 00 00 mov $0x0,%ebx 376: 83 fb 3f cmp $0x3f,%ebx 379: 7f 14 jg 38f <thread_join+0x38> if (ptr_pairs[i].offset_ptr == diov) { break; } 37b: 8d 04 5b lea (%ebx,%ebx,2),%eax 37e: 8b 55 f4 mov -0xc(%ebp),%edx 381: 39 14 85 44 0c 00 00 cmp %edx,0xc44(,%eax,4) 388: 74 05 je 38f <thread_join+0x38> for (i = 0; i < NPROC; i++) { 38a: 83 c3 01 add $0x1,%ebx 38d: eb e7 jmp 376 <thread_join+0x1f> } if (ptr_pairs[i].offset_ptr != diov) { return -1; } 38f: 8d 04 5b lea (%ebx,%ebx,2),%eax 392: 8b 4d f4 mov -0xc(%ebp),%ecx 395: 39 0c 85 44 0c 00 00 cmp %ecx,0xc44(,%eax,4) 39c: 75 26 jne 3c4 <thread_join+0x6d> free(ptr_pairs[i].orig_ptr); 39e: 83 ec 0c sub $0xc,%esp 3a1: ff 34 85 40 0c 00 00 pushl 0xc40(,%eax,4) 3a8: e8 35 03 00 00 call 6e2 <free> cell_full[i] = 0; 3ad: c7 04 9d 40 0f 00 00 movl $0x0,0xf40(,%ebx,4) 3b4: 00 00 00 00 return out; 3b8: 83 c4 10 add $0x10,%esp } 3bb: 89 f0 mov %esi,%eax 3bd: 8d 65 f8 lea -0x8(%ebp),%esp 3c0: 5b pop %ebx 3c1: 5e pop %esi 3c2: 5d pop %ebp 3c3: c3 ret if (ptr_pairs[i].offset_ptr != diov) { return -1; } 3c4: be ff ff ff ff mov $0xffffffff,%esi 3c9: eb f0 jmp 3bb <thread_join+0x64> 000003cb <lock_init>: : "memory" ); return value; } void lock_init(lock_t *lock) { 3cb: f3 0f 1e fb endbr32 3cf: 55 push %ebp 3d0: 89 e5 mov %esp,%ebp 3d2: 8b 45 08 mov 0x8(%ebp),%eax lock->ticket = 0; 3d5: c7 00 00 00 00 00 movl $0x0,(%eax) lock->turn = 0; 3db: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) } 3e2: 5d pop %ebp 3e3: c3 ret 000003e4 <lock_acquire>: void lock_acquire(lock_t *lock) { 3e4: f3 0f 1e fb endbr32 3e8: 55 push %ebp 3e9: 89 e5 mov %esp,%ebp 3eb: 8b 55 08 mov 0x8(%ebp),%edx __asm__ volatile("lock; xaddl %0, %1" 3ee: b9 01 00 00 00 mov $0x1,%ecx 3f3: f0 0f c1 0a lock xadd %ecx,(%edx) 3f7: b8 00 00 00 00 mov $0x0,%eax 3fc: f0 0f c1 42 04 lock xadd %eax,0x4(%edx) int myturn = fetch_and_add(&lock->ticket, 1); while( fetch_and_add(&lock->turn, 0) != myturn ) { //changed 401: 39 c1 cmp %eax,%ecx 403: 75 f2 jne 3f7 <lock_acquire+0x13> ; // spin } } 405: 5d pop %ebp 406: c3 ret 00000407 <lock_release>: void lock_release(lock_t *lock) { 407: f3 0f 1e fb endbr32 40b: 55 push %ebp 40c: 89 e5 mov %esp,%ebp 40e: 8b 55 08 mov 0x8(%ebp),%edx lock->turn = lock->turn + 1; 411: 8b 42 04 mov 0x4(%edx),%eax 414: 83 c0 01 add $0x1,%eax 417: 89 42 04 mov %eax,0x4(%edx) } 41a: 5d pop %ebp 41b: c3 ret 0000041c <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 41c: b8 01 00 00 00 mov $0x1,%eax 421: cd 40 int $0x40 423: c3 ret 00000424 <clone>: SYSCALL(clone) 424: b8 16 00 00 00 mov $0x16,%eax 429: cd 40 int $0x40 42b: c3 ret 0000042c <exit>: SYSCALL(exit) 42c: b8 02 00 00 00 mov $0x2,%eax 431: cd 40 int $0x40 433: c3 ret 00000434 <wait>: SYSCALL(wait) 434: b8 03 00 00 00 mov $0x3,%eax 439: cd 40 int $0x40 43b: c3 ret 0000043c <join>: SYSCALL(join) 43c: b8 17 00 00 00 mov $0x17,%eax 441: cd 40 int $0x40 443: c3 ret 00000444 <pipe>: SYSCALL(pipe) 444: b8 04 00 00 00 mov $0x4,%eax 449: cd 40 int $0x40 44b: c3 ret 0000044c <read>: SYSCALL(read) 44c: b8 05 00 00 00 mov $0x5,%eax 451: cd 40 int $0x40 453: c3 ret 00000454 <write>: SYSCALL(write) 454: b8 10 00 00 00 mov $0x10,%eax 459: cd 40 int $0x40 45b: c3 ret 0000045c <close>: SYSCALL(close) 45c: b8 15 00 00 00 mov $0x15,%eax 461: cd 40 int $0x40 463: c3 ret 00000464 <kill>: SYSCALL(kill) 464: b8 06 00 00 00 mov $0x6,%eax 469: cd 40 int $0x40 46b: c3 ret 0000046c <exec>: SYSCALL(exec) 46c: b8 07 00 00 00 mov $0x7,%eax 471: cd 40 int $0x40 473: c3 ret 00000474 <open>: SYSCALL(open) 474: b8 0f 00 00 00 mov $0xf,%eax 479: cd 40 int $0x40 47b: c3 ret 0000047c <mknod>: SYSCALL(mknod) 47c: b8 11 00 00 00 mov $0x11,%eax 481: cd 40 int $0x40 483: c3 ret 00000484 <unlink>: SYSCALL(unlink) 484: b8 12 00 00 00 mov $0x12,%eax 489: cd 40 int $0x40 48b: c3 ret 0000048c <fstat>: SYSCALL(fstat) 48c: b8 08 00 00 00 mov $0x8,%eax 491: cd 40 int $0x40 493: c3 ret 00000494 <link>: SYSCALL(link) 494: b8 13 00 00 00 mov $0x13,%eax 499: cd 40 int $0x40 49b: c3 ret 0000049c <mkdir>: SYSCALL(mkdir) 49c: b8 14 00 00 00 mov $0x14,%eax 4a1: cd 40 int $0x40 4a3: c3 ret 000004a4 <chdir>: SYSCALL(chdir) 4a4: b8 09 00 00 00 mov $0x9,%eax 4a9: cd 40 int $0x40 4ab: c3 ret 000004ac <dup>: SYSCALL(dup) 4ac: b8 0a 00 00 00 mov $0xa,%eax 4b1: cd 40 int $0x40 4b3: c3 ret 000004b4 <getpid>: SYSCALL(getpid) 4b4: b8 0b 00 00 00 mov $0xb,%eax 4b9: cd 40 int $0x40 4bb: c3 ret 000004bc <sbrk>: SYSCALL(sbrk) 4bc: b8 0c 00 00 00 mov $0xc,%eax 4c1: cd 40 int $0x40 4c3: c3 ret 000004c4 <sleep>: SYSCALL(sleep) 4c4: b8 0d 00 00 00 mov $0xd,%eax 4c9: cd 40 int $0x40 4cb: c3 ret 000004cc <uptime>: SYSCALL(uptime) 4cc: b8 0e 00 00 00 mov $0xe,%eax 4d1: cd 40 int $0x40 4d3: c3 ret 000004d4 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 4d4: 55 push %ebp 4d5: 89 e5 mov %esp,%ebp 4d7: 83 ec 1c sub $0x1c,%esp 4da: 88 55 f4 mov %dl,-0xc(%ebp) write(fd, &c, 1); 4dd: 6a 01 push $0x1 4df: 8d 55 f4 lea -0xc(%ebp),%edx 4e2: 52 push %edx 4e3: 50 push %eax 4e4: e8 6b ff ff ff call 454 <write> } 4e9: 83 c4 10 add $0x10,%esp 4ec: c9 leave 4ed: c3 ret 000004ee <printint>: static void printint(int fd, int xx, int base, int sgn) { 4ee: 55 push %ebp 4ef: 89 e5 mov %esp,%ebp 4f1: 57 push %edi 4f2: 56 push %esi 4f3: 53 push %ebx 4f4: 83 ec 2c sub $0x2c,%esp 4f7: 89 45 d0 mov %eax,-0x30(%ebp) 4fa: 89 d6 mov %edx,%esi char buf[16]; int i, neg; uint x; neg = 0; if(sgn && xx < 0){ 4fc: 83 7d 08 00 cmpl $0x0,0x8(%ebp) 500: 0f 95 c2 setne %dl 503: 89 f0 mov %esi,%eax 505: c1 e8 1f shr $0x1f,%eax 508: 84 c2 test %al,%dl 50a: 74 42 je 54e <printint+0x60> neg = 1; x = -xx; 50c: f7 de neg %esi neg = 1; 50e: c7 45 d4 01 00 00 00 movl $0x1,-0x2c(%ebp) } else { x = xx; } i = 0; 515: bb 00 00 00 00 mov $0x0,%ebx do{ buf[i++] = digits[x % base]; 51a: 89 f0 mov %esi,%eax 51c: ba 00 00 00 00 mov $0x0,%edx 521: f7 f1 div %ecx 523: 89 df mov %ebx,%edi 525: 83 c3 01 add $0x1,%ebx 528: 0f b6 92 a8 08 00 00 movzbl 0x8a8(%edx),%edx 52f: 88 54 3d d8 mov %dl,-0x28(%ebp,%edi,1) }while((x /= base) != 0); 533: 89 f2 mov %esi,%edx 535: 89 c6 mov %eax,%esi 537: 39 d1 cmp %edx,%ecx 539: 76 df jbe 51a <printint+0x2c> if(neg) 53b: 83 7d d4 00 cmpl $0x0,-0x2c(%ebp) 53f: 74 2f je 570 <printint+0x82> buf[i++] = '-'; 541: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) 546: 8d 5f 02 lea 0x2(%edi),%ebx 549: 8b 75 d0 mov -0x30(%ebp),%esi 54c: eb 15 jmp 563 <printint+0x75> neg = 0; 54e: c7 45 d4 00 00 00 00 movl $0x0,-0x2c(%ebp) 555: eb be jmp 515 <printint+0x27> while(--i >= 0) putc(fd, buf[i]); 557: 0f be 54 1d d8 movsbl -0x28(%ebp,%ebx,1),%edx 55c: 89 f0 mov %esi,%eax 55e: e8 71 ff ff ff call 4d4 <putc> while(--i >= 0) 563: 83 eb 01 sub $0x1,%ebx 566: 79 ef jns 557 <printint+0x69> } 568: 83 c4 2c add $0x2c,%esp 56b: 5b pop %ebx 56c: 5e pop %esi 56d: 5f pop %edi 56e: 5d pop %ebp 56f: c3 ret 570: 8b 75 d0 mov -0x30(%ebp),%esi 573: eb ee jmp 563 <printint+0x75> 00000575 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { 575: f3 0f 1e fb endbr32 579: 55 push %ebp 57a: 89 e5 mov %esp,%ebp 57c: 57 push %edi 57d: 56 push %esi 57e: 53 push %ebx 57f: 83 ec 1c sub $0x1c,%esp char *s; int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; 582: 8d 45 10 lea 0x10(%ebp),%eax 585: 89 45 e4 mov %eax,-0x1c(%ebp) state = 0; 588: be 00 00 00 00 mov $0x0,%esi for(i = 0; fmt[i]; i++){ 58d: bb 00 00 00 00 mov $0x0,%ebx 592: eb 14 jmp 5a8 <printf+0x33> c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; } else { putc(fd, c); 594: 89 fa mov %edi,%edx 596: 8b 45 08 mov 0x8(%ebp),%eax 599: e8 36 ff ff ff call 4d4 <putc> 59e: eb 05 jmp 5a5 <printf+0x30> } } else if(state == '%'){ 5a0: 83 fe 25 cmp $0x25,%esi 5a3: 74 25 je 5ca <printf+0x55> for(i = 0; fmt[i]; i++){ 5a5: 83 c3 01 add $0x1,%ebx 5a8: 8b 45 0c mov 0xc(%ebp),%eax 5ab: 0f b6 04 18 movzbl (%eax,%ebx,1),%eax 5af: 84 c0 test %al,%al 5b1: 0f 84 23 01 00 00 je 6da <printf+0x165> c = fmt[i] & 0xff; 5b7: 0f be f8 movsbl %al,%edi 5ba: 0f b6 c0 movzbl %al,%eax if(state == 0){ 5bd: 85 f6 test %esi,%esi 5bf: 75 df jne 5a0 <printf+0x2b> if(c == '%'){ 5c1: 83 f8 25 cmp $0x25,%eax 5c4: 75 ce jne 594 <printf+0x1f> state = '%'; 5c6: 89 c6 mov %eax,%esi 5c8: eb db jmp 5a5 <printf+0x30> if(c == 'd'){ 5ca: 83 f8 64 cmp $0x64,%eax 5cd: 74 49 je 618 <printf+0xa3> printint(fd, *ap, 10, 1); ap++; } else if(c == 'x' || c == 'p'){ 5cf: 83 f8 78 cmp $0x78,%eax 5d2: 0f 94 c1 sete %cl 5d5: 83 f8 70 cmp $0x70,%eax 5d8: 0f 94 c2 sete %dl 5db: 08 d1 or %dl,%cl 5dd: 75 63 jne 642 <printf+0xcd> printint(fd, *ap, 16, 0); ap++; } else if(c == 's'){ 5df: 83 f8 73 cmp $0x73,%eax 5e2: 0f 84 84 00 00 00 je 66c <printf+0xf7> s = "(null)"; while(*s != 0){ putc(fd, *s); s++; } } else if(c == 'c'){ 5e8: 83 f8 63 cmp $0x63,%eax 5eb: 0f 84 b7 00 00 00 je 6a8 <printf+0x133> putc(fd, *ap); ap++; } else if(c == '%'){ 5f1: 83 f8 25 cmp $0x25,%eax 5f4: 0f 84 cc 00 00 00 je 6c6 <printf+0x151> putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 5fa: ba 25 00 00 00 mov $0x25,%edx 5ff: 8b 45 08 mov 0x8(%ebp),%eax 602: e8 cd fe ff ff call 4d4 <putc> putc(fd, c); 607: 89 fa mov %edi,%edx 609: 8b 45 08 mov 0x8(%ebp),%eax 60c: e8 c3 fe ff ff call 4d4 <putc> } state = 0; 611: be 00 00 00 00 mov $0x0,%esi 616: eb 8d jmp 5a5 <printf+0x30> printint(fd, *ap, 10, 1); 618: 8b 7d e4 mov -0x1c(%ebp),%edi 61b: 8b 17 mov (%edi),%edx 61d: 83 ec 0c sub $0xc,%esp 620: 6a 01 push $0x1 622: b9 0a 00 00 00 mov $0xa,%ecx 627: 8b 45 08 mov 0x8(%ebp),%eax 62a: e8 bf fe ff ff call 4ee <printint> ap++; 62f: 83 c7 04 add $0x4,%edi 632: 89 7d e4 mov %edi,-0x1c(%ebp) 635: 83 c4 10 add $0x10,%esp state = 0; 638: be 00 00 00 00 mov $0x0,%esi 63d: e9 63 ff ff ff jmp 5a5 <printf+0x30> printint(fd, *ap, 16, 0); 642: 8b 7d e4 mov -0x1c(%ebp),%edi 645: 8b 17 mov (%edi),%edx 647: 83 ec 0c sub $0xc,%esp 64a: 6a 00 push $0x0 64c: b9 10 00 00 00 mov $0x10,%ecx 651: 8b 45 08 mov 0x8(%ebp),%eax 654: e8 95 fe ff ff call 4ee <printint> ap++; 659: 83 c7 04 add $0x4,%edi 65c: 89 7d e4 mov %edi,-0x1c(%ebp) 65f: 83 c4 10 add $0x10,%esp state = 0; 662: be 00 00 00 00 mov $0x0,%esi 667: e9 39 ff ff ff jmp 5a5 <printf+0x30> s = (char*)*ap; 66c: 8b 45 e4 mov -0x1c(%ebp),%eax 66f: 8b 30 mov (%eax),%esi ap++; 671: 83 c0 04 add $0x4,%eax 674: 89 45 e4 mov %eax,-0x1c(%ebp) if(s == 0) 677: 85 f6 test %esi,%esi 679: 75 28 jne 6a3 <printf+0x12e> s = "(null)"; 67b: be a1 08 00 00 mov $0x8a1,%esi 680: 8b 7d 08 mov 0x8(%ebp),%edi 683: eb 0d jmp 692 <printf+0x11d> putc(fd, *s); 685: 0f be d2 movsbl %dl,%edx 688: 89 f8 mov %edi,%eax 68a: e8 45 fe ff ff call 4d4 <putc> s++; 68f: 83 c6 01 add $0x1,%esi while(*s != 0){ 692: 0f b6 16 movzbl (%esi),%edx 695: 84 d2 test %dl,%dl 697: 75 ec jne 685 <printf+0x110> state = 0; 699: be 00 00 00 00 mov $0x0,%esi 69e: e9 02 ff ff ff jmp 5a5 <printf+0x30> 6a3: 8b 7d 08 mov 0x8(%ebp),%edi 6a6: eb ea jmp 692 <printf+0x11d> putc(fd, *ap); 6a8: 8b 7d e4 mov -0x1c(%ebp),%edi 6ab: 0f be 17 movsbl (%edi),%edx 6ae: 8b 45 08 mov 0x8(%ebp),%eax 6b1: e8 1e fe ff ff call 4d4 <putc> ap++; 6b6: 83 c7 04 add $0x4,%edi 6b9: 89 7d e4 mov %edi,-0x1c(%ebp) state = 0; 6bc: be 00 00 00 00 mov $0x0,%esi 6c1: e9 df fe ff ff jmp 5a5 <printf+0x30> putc(fd, c); 6c6: 89 fa mov %edi,%edx 6c8: 8b 45 08 mov 0x8(%ebp),%eax 6cb: e8 04 fe ff ff call 4d4 <putc> state = 0; 6d0: be 00 00 00 00 mov $0x0,%esi 6d5: e9 cb fe ff ff jmp 5a5 <printf+0x30> } } } 6da: 8d 65 f4 lea -0xc(%ebp),%esp 6dd: 5b pop %ebx 6de: 5e pop %esi 6df: 5f pop %edi 6e0: 5d pop %ebp 6e1: c3 ret 000006e2 <free>: static Header base; static Header *freep; void free(void *ap) { 6e2: f3 0f 1e fb endbr32 6e6: 55 push %ebp 6e7: 89 e5 mov %esp,%ebp 6e9: 57 push %edi 6ea: 56 push %esi 6eb: 53 push %ebx 6ec: 8b 5d 08 mov 0x8(%ebp),%ebx Header *bp, *p; bp = (Header*)ap - 1; 6ef: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 6f2: a1 20 0c 00 00 mov 0xc20,%eax 6f7: eb 02 jmp 6fb <free+0x19> 6f9: 89 d0 mov %edx,%eax 6fb: 39 c8 cmp %ecx,%eax 6fd: 73 04 jae 703 <free+0x21> 6ff: 39 08 cmp %ecx,(%eax) 701: 77 12 ja 715 <free+0x33> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 703: 8b 10 mov (%eax),%edx 705: 39 c2 cmp %eax,%edx 707: 77 f0 ja 6f9 <free+0x17> 709: 39 c8 cmp %ecx,%eax 70b: 72 08 jb 715 <free+0x33> 70d: 39 ca cmp %ecx,%edx 70f: 77 04 ja 715 <free+0x33> 711: 89 d0 mov %edx,%eax 713: eb e6 jmp 6fb <free+0x19> break; if(bp + bp->s.size == p->s.ptr){ 715: 8b 73 fc mov -0x4(%ebx),%esi 718: 8d 3c f1 lea (%ecx,%esi,8),%edi 71b: 8b 10 mov (%eax),%edx 71d: 39 d7 cmp %edx,%edi 71f: 74 19 je 73a <free+0x58> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; } else bp->s.ptr = p->s.ptr; 721: 89 53 f8 mov %edx,-0x8(%ebx) if(p + p->s.size == bp){ 724: 8b 50 04 mov 0x4(%eax),%edx 727: 8d 34 d0 lea (%eax,%edx,8),%esi 72a: 39 ce cmp %ecx,%esi 72c: 74 1b je 749 <free+0x67> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; } else p->s.ptr = bp; 72e: 89 08 mov %ecx,(%eax) freep = p; 730: a3 20 0c 00 00 mov %eax,0xc20 } 735: 5b pop %ebx 736: 5e pop %esi 737: 5f pop %edi 738: 5d pop %ebp 739: c3 ret bp->s.size += p->s.ptr->s.size; 73a: 03 72 04 add 0x4(%edx),%esi 73d: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 740: 8b 10 mov (%eax),%edx 742: 8b 12 mov (%edx),%edx 744: 89 53 f8 mov %edx,-0x8(%ebx) 747: eb db jmp 724 <free+0x42> p->s.size += bp->s.size; 749: 03 53 fc add -0x4(%ebx),%edx 74c: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 74f: 8b 53 f8 mov -0x8(%ebx),%edx 752: 89 10 mov %edx,(%eax) 754: eb da jmp 730 <free+0x4e> 00000756 <morecore>: static Header* morecore(uint nu) { 756: 55 push %ebp 757: 89 e5 mov %esp,%ebp 759: 53 push %ebx 75a: 83 ec 04 sub $0x4,%esp 75d: 89 c3 mov %eax,%ebx char *p; Header *hp; if(nu < 4096) 75f: 3d ff 0f 00 00 cmp $0xfff,%eax 764: 77 05 ja 76b <morecore+0x15> nu = 4096; 766: bb 00 10 00 00 mov $0x1000,%ebx p = sbrk(nu * sizeof(Header)); 76b: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 772: 83 ec 0c sub $0xc,%esp 775: 50 push %eax 776: e8 41 fd ff ff call 4bc <sbrk> if(p == (char*)-1) 77b: 83 c4 10 add $0x10,%esp 77e: 83 f8 ff cmp $0xffffffff,%eax 781: 74 1c je 79f <morecore+0x49> return 0; hp = (Header*)p; hp->s.size = nu; 783: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 786: 83 c0 08 add $0x8,%eax 789: 83 ec 0c sub $0xc,%esp 78c: 50 push %eax 78d: e8 50 ff ff ff call 6e2 <free> return freep; 792: a1 20 0c 00 00 mov 0xc20,%eax 797: 83 c4 10 add $0x10,%esp } 79a: 8b 5d fc mov -0x4(%ebp),%ebx 79d: c9 leave 79e: c3 ret return 0; 79f: b8 00 00 00 00 mov $0x0,%eax 7a4: eb f4 jmp 79a <morecore+0x44> 000007a6 <malloc>: void* malloc(uint nbytes) { 7a6: f3 0f 1e fb endbr32 7aa: 55 push %ebp 7ab: 89 e5 mov %esp,%ebp 7ad: 53 push %ebx 7ae: 83 ec 04 sub $0x4,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 7b1: 8b 45 08 mov 0x8(%ebp),%eax 7b4: 8d 58 07 lea 0x7(%eax),%ebx 7b7: c1 eb 03 shr $0x3,%ebx 7ba: 83 c3 01 add $0x1,%ebx if((prevp = freep) == 0){ 7bd: 8b 0d 20 0c 00 00 mov 0xc20,%ecx 7c3: 85 c9 test %ecx,%ecx 7c5: 74 04 je 7cb <malloc+0x25> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 7c7: 8b 01 mov (%ecx),%eax 7c9: eb 4b jmp 816 <malloc+0x70> base.s.ptr = freep = prevp = &base; 7cb: c7 05 20 0c 00 00 24 movl $0xc24,0xc20 7d2: 0c 00 00 7d5: c7 05 24 0c 00 00 24 movl $0xc24,0xc24 7dc: 0c 00 00 base.s.size = 0; 7df: c7 05 28 0c 00 00 00 movl $0x0,0xc28 7e6: 00 00 00 base.s.ptr = freep = prevp = &base; 7e9: b9 24 0c 00 00 mov $0xc24,%ecx 7ee: eb d7 jmp 7c7 <malloc+0x21> if(p->s.size >= nunits){ if(p->s.size == nunits) 7f0: 74 1a je 80c <malloc+0x66> prevp->s.ptr = p->s.ptr; else { p->s.size -= nunits; 7f2: 29 da sub %ebx,%edx 7f4: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 7f7: 8d 04 d0 lea (%eax,%edx,8),%eax p->s.size = nunits; 7fa: 89 58 04 mov %ebx,0x4(%eax) } freep = prevp; 7fd: 89 0d 20 0c 00 00 mov %ecx,0xc20 return (void*)(p + 1); 803: 83 c0 08 add $0x8,%eax } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } } 806: 83 c4 04 add $0x4,%esp 809: 5b pop %ebx 80a: 5d pop %ebp 80b: c3 ret prevp->s.ptr = p->s.ptr; 80c: 8b 10 mov (%eax),%edx 80e: 89 11 mov %edx,(%ecx) 810: eb eb jmp 7fd <malloc+0x57> for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 812: 89 c1 mov %eax,%ecx 814: 8b 00 mov (%eax),%eax if(p->s.size >= nunits){ 816: 8b 50 04 mov 0x4(%eax),%edx 819: 39 da cmp %ebx,%edx 81b: 73 d3 jae 7f0 <malloc+0x4a> if(p == freep) 81d: 39 05 20 0c 00 00 cmp %eax,0xc20 823: 75 ed jne 812 <malloc+0x6c> if((p = morecore(nunits)) == 0) 825: 89 d8 mov %ebx,%eax 827: e8 2a ff ff ff call 756 <morecore> 82c: 85 c0 test %eax,%eax 82e: 75 e2 jne 812 <malloc+0x6c> 830: eb d4 jmp 806 <malloc+0x60>
menu.asm
randyrossi/c64-games-menu
5
94185
!to "menu",cbm ; A simple game browser for the C64 that works with ; pi1541 or sd2iec. The menu lets you page through a ; large index with game descriptions, directory names ; and .d64 image names. Games must be organized under ; directories ; named with a single char (0abcd...etc) ; Index file format ; Filename: letter-pagenum i.e. a-3 ; dirname + $0d + imagename + $0d + description + $0d ; if dirname starts with $00, no more entries ; if dirname starts with $ff, no more entries and last page ; TODO Use * key to load "*",8,1 instead of "$" + list *=$801 ;START ADDRESS IS $801 FILECODE = $100e ; 1 char we read from memory SCREENCODE = $100f ; 1 byte we poke to screen mem CURLETTER = $1010 ; 1 current selected letter CURROW = $1011 ; 1 current row within page CURPAGE = $1012 ; 1 current page SAVEX = $1013 ; 1 tmp for storing x SAVEA = $1014 ; 1 tmp for storing accum SAVEY = $1015 ; 1 tmp for storing y FNLEN = $1016 ; 1 filename length IMAGELEN = $1017 ; 1 length of image string DESCLEN = $1018 ; 1 length of description string DIRNAMELEN = $1019 ; 1 length of dirname string DIR_OR_RUN = $101a ; 1 flag for enter vs * DRIVENUM = $101b ; 1 device number to use DESCRIP = $1020 ; 40 description string IMAGENAME = $1048 ; 20 image string DIRNAME = $105c ; 10 directory string SAVEPSA1 = $1080 ; 1 tmp to save page start address SAVEPSA2 = $1081 ; 1 tmp to save page start address LINE = $1082 ; 1 tmp for iterating, holds max row for cur page LASTFLAG = $1083 ; 1 1=last entry in page, ff=last entry and last page FILENAME = $1084 ; 10 scratch space for filename ; Change the $38 after the $2c to the drive number (in petscii) ; you want this program to default to. BASIC: !BYTE $0B,$08,$01,$00,$9E,$32,$30,$36,$33,$2c,$38,$00,$00,$00 ;Adds BASIC line: 1 SYS 2063,8 MAIN: ; grab parameter from sys to change drive number we will use JSR $AEFD ; check for comma JSR $B79E ; get 8-bit parameter into X JSR SETDRIVE ; set screen colors LDA #$00 STA $D020 STA $D021 ; initialize variables LDA #$00 STA CURLETTER LDA #$02 STA CURROW LDA #0 STA CURPAGE BEGIN: ; construct filename from letter/page LDX #0 LDA CURLETTER TAY LDA LETTERS,y STA FILENAME,X INX LDA #$2D ; dash STA FILENAME,X INX LDA CURPAGE CMP #10 BCS TWODIG ; CURPAGE >= 10 ONEDIG: TAY LDA DIGITS,Y STA FILENAME,x INX STX FNLEN JMP LOADCURPAGE TWODIG: STX SAVEX LDX #0 TWODIG2: ; how many times can we subtract 10? INX CLD SBC #$0a CMP #$0a BCS TWODIG2 ; A >= 10 STA SAVEA LDA DIGITS,x LDX SAVEX STA FILENAME,x INX LDA SAVEA ; leave 2nd digit in A JMP ONEDIG LOADCURPAGE: ; load current page into memory LDA #147 ;CLR JSR $FFD2 ;CHAR OUT LDA #144 ;BLK (to hide the loading message) JSR $FFD2 ;CHAR OUT LDA #$0d ;set c800 to empty entry in case load fails STA $c800 LDA #$0d STA $c801 LDA #$0d STA $c802 LDA #$ff STA $c803 LDA FNLEN ;FILE NAME LENGTH LDX #<FILENAME LDY #>FILENAME JSR LOADPAGE ; clear screen and print top menu LDY #$00 TOPMENU: LDA MENUTEXT,Y JSR $FFD2 ;CHAR OUT INY CPY #29 BNE TOPMENU ; also print filename top right LDY #4 PRSPC: LDA #$20 ; space JSR $FFD2 DEY BNE PRSPC LDY FNLEN LDX #0 PRINTFN: LDA FILENAME,X JSR $FFD2 INX DEY BNE PRINTFN ; show drive num in upper right corner LDA DRVO STA $426 LDA DRVO2 STA $427 LDA #1 STA $d827 STA $d826 ; highlight current letter LDY CURLETTER LDA $400,y EOR #$80 STA $400,y ; set page data source address in $fb/$fc LDA #$00 STA $fb LDA #$c8 STA $fc ; always start at line 2 LDA #2 STA LINE ; print all descriptions for this page FULLPAGE: JSR GETNEXT LDA LINE JSR SHOWDESC INC LINE LDA LASTFLAG CMP #0 ; keep iterating until we get 0 or ff BEQ FULLPAGE ; show instructions at bottom LDY #0 SHOWINSTR: LDA INSTRUCT,Y EOR #$80 STA $7c0,y LDA #1 STA $dbc0,y INY CPY #40 BNE SHOWINSTR HANDLEKEY: ; hilite current row LDA CURROW JSR REVERSE ; wait for a key to be pressed WAITKEY: JSR $FFE4 ; get char CMP #0 BEQ WAITKEY ; un-hilite STA SAVEA LDA CURROW JSR REVERSE LDA SAVEA ; jump to key handler CMP #$11 BEQ KDOWN CMP #$91 BEQ KUP CMP #$1d BEQ KRIGHT CMP #$9d BEQ KLEFT CMP #$30 BEQ KZERO CMP #95 BEQ KBACK CMP #$20 BEQ KSPACE CMP #$0d BEQ KENTER CMP #$2a BEQ KASTERISK CMP #$2c BEQ KNEXTDRIVE CMP #$41 BCS KLET ; >=41 ? handle letter key JMP HANDLEKEY KUP: JMP UP KDOWN: JMP DOWN KLEFT: JMP LEFT KRIGHT: JMP RIGHT KSPACE: JMP SPACE KBACK: JMP BACK KZERO: JMP ZERO KLET: JMP LET KENTER: LDA #0 STA DIR_OR_RUN JMP ENTER KASTERISK: LDA #1 STA DIR_OR_RUN JMP ENTER KNEXTDRIVE: JMP NEXTDRIVE ; begin key handling routines ENTER: ; first fetch the row we selected LDA #$00 STA $fb LDA #$c8 STA $fc LDY #1 FETCHROW: INY STY SAVEY JSR GETNEXT LDY SAVEY CPY CURROW BNE FETCHROW ; clr and print commands to load the selection LDY #$00 ENTER1: LDA EXECUTE1,Y JSR $FFD2 ;CHAR OUT INY CPY #26 ; num chars BNE ENTER1 ; letter LDY CURLETTER LDA LETTERS,y JSR $FFD2 ;CHAR OUT LDA #47 ; / JSR $FFD2 ;CHAR OUT ; print dirname LDY #$00 DNOUT: LDA DIRNAME,Y JSR $FFD2 ;CHAR OUT INY CPY DIRNAMELEN BNE DNOUT LDA #47 ; / JSR $FFD2 ;CHAR OUT ; print imagename LDY #$00 IMOUT: LDA IMAGENAME,Y JSR $FFD2 ;CHAR OUT INY CPY IMAGELEN BNE IMOUT ; print rest of commands LDY #$00 ENTER2: LDA EXECUTE2,Y JSR $FFD2 ;CHAR OUT INY CPY #30 ; num chars BNE ENTER2 LDA DIR_OR_RUN CMP #1 BEQ DOLOAD DODIR: LDY #$00 ENTER3: LDA EXECUTE3,Y JSR $FFD2 ;CHAR OUT INY CPY #20 ; num chars BNE ENTER3 JMP DORETURNS DOLOAD: LDY #$00 ENTER4: LDA EXECUTE4,Y JSR $FFD2 ;CHAR OUT INY CPY #21 ; num chars BNE ENTER4 DORETURNS: ; returns to execute commands LDA #13 STA 631 STA 632 STA 633 STA 634 LDA #4 STA 198 RTS ; 0 key handler ZERO: LDA #0 STA CURLETTER STA CURPAGE LDA #2 STA CURROW JMP BEGIN ; letter key jump LET: CMP #$5b ; > z? ignore BCS LET2 CLD SBC #$3f STA CURLETTER LDA #2 STA CURROW LDA #0 STA CURPAGE JMP BEGIN LET2: JMP HANDLEKEY ; prev letter LEFT: LDA #0 STA CURPAGE LDA #2 STA CURROW LDA CURLETTER CMP #0 BEQ LEFT2 DEC CURLETTER JMP BEGIN LEFT2: LDA #26 STA CURLETTER JMP BEGIN ; next letter RIGHT: LDA #0 STA CURPAGE LDA #2 STA CURROW LDA CURLETTER CMP #26 BEQ RIGHT2 INC CURLETTER JMP BEGIN RIGHT2: ; wrap back to 0 LDA #0 STA CURLETTER JMP BEGIN ; next game DOWN: INC CURROW LDA CURROW CMP LINE BNE DOWNB LDA #2 ; always wrap around back to 2 STA CURROW DOWNB: JMP HANDLEKEY ; prev game UP: LDA CURROW CMP #2 ; 2 is always top entry BEQ UPWR DEC CURROW JMP HANDLEKEY UPWR: LDA LINE CLD SBC #1 STA CURROW JMP HANDLEKEY ; next page SPACE: LDA #2 STA CURROW LDA LASTFLAG CMP #$ff BEQ SPACE2 INC CURPAGE JMP BEGIN SPACE2: LDA #0 STA CURPAGE JMP BEGIN ; prev page BACK: LDA #2 STA CURROW LDA CURPAGE CMP #0 BEQ BACK2 DEC CURPAGE BACK2: JMP BEGIN NEXTDRIVE: INC DRIVENUM LDA DRIVENUM CMP #13 BCS DRIVEWRAP ; A >= 13? DODRIVE: STA DRIVENUM TAX JSR SETDRIVE JMP BEGIN DRIVEWRAP: LDA #8 JMP DODRIVE ; copy desc to destination line of screen ; accum has line num ; non destructive to fb/fc page data ptrs SHOWDESC: ASL ; accum x 2 TAX ; be non destructive to $fb/$fc pointer LDA $fb STA SAVEPSA1 LDA $fc STA SAVEPSA2 ; setup $fe/fd screen ptr and $2/$3 color mem ptr LDA SCREEN,X STA $fe LDA COLOR,X STA $3 INX LDA SCREEN,X STA $fd LDA COLOR,X STA $2 ; setup description src ptr in $fb/$fc LDA #<DESCRIP STA $fb LDA #>DESCRIP STA $fc LDY #0 SHOW1: LDA #1 ; white STA ($2),y ; set color mem LDA ($fb),y ; read src byte JSR TOSCREENCODE ; convert to screen code LDA FILECODE CMP #$0d BEQ SHOW2 ; don't poke the end marker LDA SCREENCODE STA ($fd),y ; poke screen code SHOW2: INY LDA FILECODE CMP #$0d BNE SHOW1 ; more? ; restore saved ptr LDA SAVEPSA1 STA $fb LDA SAVEPSA2 STA $fc RTS ; grab next entry from page into our vars ; will set LASTFLAG appropriately GETNEXT: LDA #<DIRNAME STA $fd LDA #>DIRNAME STA $fe LDX #0 LDY #0 DIR1: LDA ($fb,x) STA ($fd),y INC $fb BNE DIR2 INC $fc DIR2: INY CMP #$0d BNE DIR1 DEY STY DIRNAMELEN LDA #<IMAGENAME STA $fd LDA #>IMAGENAME STA $fe LDY #0 IMAGE1: LDA ($fb,x) STA ($fd),y INC $fb BNE IMAGE2 INC $fc IMAGE2: INY CMP #$0d BNE IMAGE1 DEY STY IMAGELEN LDA #<DESCRIP STA $fd LDA #>DESCRIP STA $fe LDY #0 DESC1: LDA ($fb,x) STA ($fd),y INC $fb BNE DESC2 INC $fc DESC2: INY CMP #$0d BNE DESC1 DEY STY DESCLEN LDY #0 LDA ($fb),y CMP #0 BNE NOTLAST ; this is the last entry but more pages follow LDA #1 STA LASTFLAG RTS NOTLAST: CMP #$ff BNE NOTLASTPAGE ; this is the entry and the last page LDA #$ff STA LASTFLAG RTS NOTLASTPAGE: ; neither last entry nor last page LDA #0 STA LASTFLAG RTS ; Reverse a line of text on screen at line Y ; A = linenum REVERSE: ASL ; accum x 2 TAX ; copy screen line addr to 0xfb LDA SCREEN,X STA $fc INX LDA SCREEN,X STA $fb LDY #39 REVLOOP: LDA ($fb),y EOR #$80 STA ($fb),y DEY BNE REVLOOP LDA ($fb),y EOR #$80 STA ($fb),y RTS ; accum = length of filename ; x = address low byte ; y = address high byte LOADPAGE: JSR $FFBD ; SETNAM LDA #4 ; logical num LDX DRIVENUM ; drive was set by sys LDY #1 ; secondary JSR $FFBA ; SETLFS LDA #0 ; LOAD = 0, VERIFY = 1 LDX #$00 LDY #$c0 JSR $FFD5 ; do LOAD RTS ; translate chars to screen code TOSCREENCODE: STA FILECODE STA SCREENCODE CMP #$41 BCS ISCHAR1 ; A >=0x41 RTS ISCHAR1: CMP #$5b ; A >=0x5b BCS IGNORE CLD SBC #$3f STA SCREENCODE IGNORE: RTS ; X expected to have drive number desired SETDRIVE: STX DRIVENUM ; also store drive num as petscii in memory for ; the load steps TXA CMP #10 BCS TWODIGDRIVE ; drive >= 10 ; single digit for drive ADC #$30 ; to petscii STA DRVO2 STA DRVLO2 STA DRVLI2 LDA #$20 ; space for first digit STA DRVO STA DRVLO STA DRVLI RTS TWODIGDRIVE LDX #0 TWODIGDRIVE2: ; how many times can we subtract 10? INX CLD SBC #$0a CMP #$0a BCS TWODIGDRIVE2 ; A >= 10 ADC #$30 STA DRVO2 STA DRVLO2 STA DRVLI2 LDA #$31 ; first digit becomes 1 (only support up to 19) STA DRVO STA DRVLO STA DRVLI RTS ; addresses for start of every screen line char cell SCREEN: !BYTE $04,$00,$04,$28,$04,$50,$04,$78,$04,$a0 !BYTE $04,$c8,$04,$f0,$05,$18,$05,$40,$05,$68 !BYTE $05,$90,$05,$b8,$05,$e0,$06,$08,$06,$30 !BYTE $06,$58,$06,$80,$06,$a8,$06,$d0,$06,$f8 !BYTE $07,$20,$07,$48,$07,$70,$07,$98,$07,$c0 ; addresses for stat of every screen line color cell COLOR: !BYTE $d8,$00,$d8,$28,$d8,$50,$d8,$78,$d8,$a0 !BYTE $d8,$c8,$d8,$f0,$d9,$18,$d9,$40,$d9,$68 !BYTE $d9,$90,$d9,$b8,$d9,$e0,$da,$08,$da,$30 !BYTE $da,$58,$da,$80,$da,$a8,$da,$d0,$da,$f8 !BYTE $db,$20,$db,$48,$db,$70,$db,$98,$db,$c0 MENUS: !PET "0abcdefghijklmnopqrstuvwxyz" MENUTEXT: !BYTE 147,5 ;CLEAR SCREEN AND WHITE LETTERS: !PET "0abcdefghijklmnopqrstuvwxyz" INSTRUCT: !BYTE $15,$2f,$04,$3d,$0d,$0f,$16,$05,$20,$0c,$2f,$12,$3d,$0c,$05,$14 !BYTE $14,$05,$12,$20,$13,$10,$03,$2f,$1f,$3d,$10,$01,$07,$05,$20,$05 !BYTE $0e,$14,$05,$12,$3d,$13,$05,$0c DIGITS: !pet "0123456789" EXECUTE1: ;26 !BYTE 147,17,17 !pet "new" !BYTE 13,13,13 !pet "open1," DRVO: ;becomes first digit of drive num !pet " " DRVO2: ;becomes second digit of drive num !pet "?" !pet ",15," !BYTE 34 !pet "cd://" ; need a delay after open to give pi1541 some time to ; mount the disk EXECUTE2: ;30 bytes !BYTE 34 !pet ":close1:for i=1to2200:next" !BYTE 13,13,13 EXECUTE3: ;20 bytes !pet "load" !BYTE 34 !pet "$" !BYTE 34 !pet "," DRVLI: ; becomes first digit of drive num !pet " " DRVLI2: ; becomes first digit of drive num !pet "?" !BYTE 13,13,13,13,13 !pet "list" !BYTE 19 EXECUTE4: ;21 bytes !pet "load" !BYTE 34 !pet "*" !BYTE 34 !pet "," DRVLO: ; becomes first digit of drive num !pet " " DRVLO2: ; becomes second digit of drive num !pet "?" !pet ",1" !BYTE 13,13,13,13,13 !pet "run" !BYTE 19
oeis/270/A270792.asm
neoneye/loda-programs
11
169808
<reponame>neoneye/loda-programs ; A270792: The prime/nonprime compound sequence ABA. ; Submitted by <NAME>(s2) ; 7,13,23,37,61,73,101,107,139,181,197,239,269,281,313,373,419,433,467,499,521,577,613,653,719,751,761,811,823,853,977,1013,1051,1069,1163,1187,1237,1289,1307,1373,1439,1453,1549,1559,1583 seq $0,78782 ; Nonprimes (A018252) with prime (A000040) subscripts. sub $0,1 seq $0,40 ; The prime numbers.
src/fltk-widgets-buttons-light-round-radio.adb
micahwelf/FLTK-Ada
1
13541
<filename>src/fltk-widgets-buttons-light-round-radio.adb with Interfaces.C, System; use type System.Address; package body FLTK.Widgets.Buttons.Light.Round.Radio is procedure radio_round_button_set_draw_hook (W, D : in System.Address); pragma Import (C, radio_round_button_set_draw_hook, "radio_round_button_set_draw_hook"); pragma Inline (radio_round_button_set_draw_hook); procedure radio_round_button_set_handle_hook (W, H : in System.Address); pragma Import (C, radio_round_button_set_handle_hook, "radio_round_button_set_handle_hook"); pragma Inline (radio_round_button_set_handle_hook); function new_fl_radio_round_button (X, Y, W, H : in Interfaces.C.int; Text : in Interfaces.C.char_array) return System.Address; pragma Import (C, new_fl_radio_round_button, "new_fl_radio_round_button"); pragma Inline (new_fl_radio_round_button); procedure free_fl_radio_round_button (B : in System.Address); pragma Import (C, free_fl_radio_round_button, "free_fl_radio_round_button"); pragma Inline (free_fl_radio_round_button); procedure fl_radio_round_button_draw (W : in System.Address); pragma Import (C, fl_radio_round_button_draw, "fl_radio_round_button_draw"); pragma Inline (fl_radio_round_button_draw); function fl_radio_round_button_handle (W : in System.Address; E : in Interfaces.C.int) return Interfaces.C.int; pragma Import (C, fl_radio_round_button_handle, "fl_radio_round_button_handle"); pragma Inline (fl_radio_round_button_handle); procedure Finalize (This : in out Radio_Round_Button) is begin if This.Void_Ptr /= System.Null_Address and then This in Radio_Round_Button'Class then free_fl_radio_round_button (This.Void_Ptr); This.Void_Ptr := System.Null_Address; end if; Finalize (Round_Button (This)); end Finalize; package body Forge is function Create (X, Y, W, H : in Integer; Text : in String) return Radio_Round_Button is begin return This : Radio_Round_Button do This.Void_Ptr := new_fl_radio_round_button (Interfaces.C.int (X), Interfaces.C.int (Y), Interfaces.C.int (W), Interfaces.C.int (H), Interfaces.C.To_C (Text)); fl_widget_set_user_data (This.Void_Ptr, Widget_Convert.To_Address (This'Unchecked_Access)); radio_round_button_set_draw_hook (This.Void_Ptr, Draw_Hook'Address); radio_round_button_set_handle_hook (This.Void_Ptr, Handle_Hook'Address); end return; end Create; end Forge; procedure Draw (This : in out Radio_Round_Button) is begin fl_radio_round_button_draw (This.Void_Ptr); end Draw; function Handle (This : in out Radio_Round_Button; Event : in Event_Kind) return Event_Outcome is begin return Event_Outcome'Val (fl_radio_round_button_handle (This.Void_Ptr, Event_Kind'Pos (Event))); end Handle; end FLTK.Widgets.Buttons.Light.Round.Radio;
programs/oeis/076/A076767.asm
neoneye/loda
22
25505
<filename>programs/oeis/076/A076767.asm<gh_stars>10-100 ; A076767: Triangular numbers with square pyramidal indices. ; 0,1,15,105,465,1540,4186,9870,20910,40755,74305,128271,211575,335790,515620,769420,1119756,1594005,2224995,3051685,4119885,5483016,7202910,9350650,12007450,15265575,19229301,24015915,29756755,36598290 seq $0,188475 ; a(n) = (2*n^3 + 3*n^2 + n + 3)/3. mul $0,2 pow $0,2 div $0,32