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 |
|---|---|---|---|---|
oeis/136/A136762.asm | neoneye/loda-programs | 11 | 164886 | <filename>oeis/136/A136762.asm
; A136762: Leading digit of n! in base 12.
; 1,1,2,6,2,10,5,2,1,1,1,1,1,1,1,1,2,3,4,7,1,1,3,6,1,2,5,11,2,5,1,2,7,1,4,1,3,11,2,9,2,9,2,9,2,10,3,1,4,1,6,2,9,3,1,6,2,11,4,1,9,4,1,9,4,1,10,4,2,1,6,3,1,9,4,2,1,8,4,2,1,9,5,3,1,1,7,4,2,1,1,8,5,3,2,1,11,7,5,3
seq $0,142 ; Factorial numbers: n! = 1*2*3*4*...*n (order of symmetric group S_n, number of permutations of n letters).
lpb $0
mov $2,$0
div $0,12
lpe
mov $0,$2
|
example/src/trendy_terminal-example-input.ads | pyjarrett/archaic_terminal | 3 | 30009 | package Trendy_Terminal.Example.Input is
procedure Run_Print_Input;
end Trendy_Terminal.Example.Input;
|
oeis/161/A161731.asm | neoneye/loda-programs | 11 | 243754 | ; A161731: Expansion of (1-3*x)/(1-8*x+14*x^2).
; Submitted by <NAME>
; 1,5,26,138,740,3988,21544,116520,630544,3413072,18476960,100032672,541583936,2932214080,15875537536,85953303168,465368899840,2519604954368,13641675037184,73858930936320,399887996969984,2165078942651392,11722199583631360,63466491471931392,343621137604612096,1860438220229857280,10072809835374288896,54536343599776309248,295271411102970429440,1598662478426895106048,8655500071973574836224,46862725877812067205120,253724806014866489933824,1373720285829562978598912,7437615002428372969717760
mov $1,1
mov $3,1
lpb $0
sub $0,1
mov $2,$3
mul $2,2
mul $3,4
add $3,$1
mul $1,4
add $1,$2
lpe
mov $0,$3
|
oeis/309/A309809.asm | neoneye/loda-programs | 11 | 168513 | <gh_stars>10-100
; A309809: a(n) is the concatenation of n and 2n+1.
; Submitted by <NAME>(s1.)
; 13,25,37,49,511,613,715,817,919,1021,1123,1225,1327,1429,1531,1633,1735,1837,1939,2041,2143,2245,2347,2449,2551,2653,2755,2857,2959,3061,3163,3265,3367,3469,3571,3673,3775,3877,3979,4081,4183,4285,4387,4489,4591,4693,4795,4897,4999,50101,51103,52105,53107,54109,55111,56113,57115,58117,59119,60121,61123,62125,63127,64129,65131,66133,67135,68137,69139,70141,71143,72145,73147,74149,75151,76153,77155,78157,79159,80161,81163,82165,83167,84169,85171,86173,87175,88177,89179,90181,91183,92185,93187
mov $2,$0
add $0,1
add $2,1
lpb $0
mul $0,2
mov $1,$0
lpb $0
div $0,10
mul $1,10
lpe
lpe
mov $3,$2
mul $3,4
add $1,$3
div $1,12
mul $1,6
mov $0,$1
add $0,1
|
src/svd/sam_svd-pm.ads | Fabien-Chouteau/samd51-hal | 1 | 29784 | <filename>src/svd/sam_svd-pm.ads
pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.PM is
pragma Preelaborate;
---------------
-- Registers --
---------------
-- Control A
type PM_CTRLA_Register is record
-- unspecified
Reserved_0_1 : HAL.UInt2 := 16#0#;
-- I/O Retention
IORET : Boolean := False;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_CTRLA_Register use record
Reserved_0_1 at 0 range 0 .. 1;
IORET at 0 range 2 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
end record;
-- Sleep Mode
type SLEEPCFG_SLEEPMODESelect is
(-- CPU, AHBx, and APBx clocks are OFF
IDLE,
-- All Clocks are OFF
STANDBY,
-- Backup domain is ON as well as some PDRAMs
HIBERNATE,
-- Only Backup domain is powered ON
BACKUP,
-- All power domains are powered OFF
OFF)
with Size => 3;
for SLEEPCFG_SLEEPMODESelect use
(IDLE => 2,
STANDBY => 4,
HIBERNATE => 5,
BACKUP => 6,
OFF => 7);
-- Sleep Configuration
type PM_SLEEPCFG_Register is record
-- Sleep Mode
SLEEPMODE : SLEEPCFG_SLEEPMODESelect := SAM_SVD.PM.IDLE;
-- unspecified
Reserved_3_7 : HAL.UInt5 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_SLEEPCFG_Register use record
SLEEPMODE at 0 range 0 .. 2;
Reserved_3_7 at 0 range 3 .. 7;
end record;
-- Interrupt Enable Clear
type PM_INTENCLR_Register is record
-- Sleep Mode Entry Ready Enable
SLEEPRDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_INTENCLR_Register use record
SLEEPRDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Enable Set
type PM_INTENSET_Register is record
-- Sleep Mode Entry Ready Enable
SLEEPRDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_INTENSET_Register use record
SLEEPRDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Interrupt Flag Status and Clear
type PM_INTFLAG_Register is record
-- Sleep Mode Entry Ready
SLEEPRDY : Boolean := False;
-- unspecified
Reserved_1_7 : HAL.UInt7 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_INTFLAG_Register use record
SLEEPRDY at 0 range 0 .. 0;
Reserved_1_7 at 0 range 1 .. 7;
end record;
-- Ram Configuration
type STDBYCFG_RAMCFGSelect is
(-- All the system RAM is retained
RET,
-- Only the first 32Kbytes of the system RAM is retained
PARTIAL,
-- All the system RAM is turned OFF
OFF)
with Size => 2;
for STDBYCFG_RAMCFGSelect use
(RET => 0,
PARTIAL => 1,
OFF => 2);
-- Fast Wakeup
type STDBYCFG_FASTWKUPSelect is
(-- Fast Wakeup is disabled
NO,
-- Fast Wakeup is enabled on NVM
NVM,
-- Fast Wakeup is enabled on the main voltage regulator (MAINVREG)
MAINVREG,
-- Fast Wakeup is enabled on both NVM and MAINVREG
BOTH)
with Size => 2;
for STDBYCFG_FASTWKUPSelect use
(NO => 0,
NVM => 1,
MAINVREG => 2,
BOTH => 3);
-- Standby Configuration
type PM_STDBYCFG_Register is record
-- Ram Configuration
RAMCFG : STDBYCFG_RAMCFGSelect := SAM_SVD.PM.RET;
-- unspecified
Reserved_2_3 : HAL.UInt2 := 16#0#;
-- Fast Wakeup
FASTWKUP : STDBYCFG_FASTWKUPSelect := SAM_SVD.PM.NO;
-- unspecified
Reserved_6_7 : HAL.UInt2 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_STDBYCFG_Register use record
RAMCFG at 0 range 0 .. 1;
Reserved_2_3 at 0 range 2 .. 3;
FASTWKUP at 0 range 4 .. 5;
Reserved_6_7 at 0 range 6 .. 7;
end record;
-- Ram Configuration
type HIBCFG_RAMCFGSelect is
(-- All the system RAM is retained
RET,
-- Only the first 32Kbytes of the system RAM is retained
PARTIAL,
-- All the system RAM is turned OFF
OFF)
with Size => 2;
for HIBCFG_RAMCFGSelect use
(RET => 0,
PARTIAL => 1,
OFF => 2);
-- Backup Ram Configuration
type HIBCFG_BRAMCFGSelect is
(-- All the backup RAM is retained
RET,
-- Only the first 4Kbytes of the backup RAM is retained
PARTIAL,
-- All the backup RAM is turned OFF
OFF)
with Size => 2;
for HIBCFG_BRAMCFGSelect use
(RET => 0,
PARTIAL => 1,
OFF => 2);
-- Hibernate Configuration
type PM_HIBCFG_Register is record
-- Ram Configuration
RAMCFG : HIBCFG_RAMCFGSelect := SAM_SVD.PM.RET;
-- Backup Ram Configuration
BRAMCFG : HIBCFG_BRAMCFGSelect := SAM_SVD.PM.RET;
-- unspecified
Reserved_4_7 : HAL.UInt4 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_HIBCFG_Register use record
RAMCFG at 0 range 0 .. 1;
BRAMCFG at 0 range 2 .. 3;
Reserved_4_7 at 0 range 4 .. 7;
end record;
-- Ram Configuration
type BKUPCFG_BRAMCFGSelect is
(-- All the backup RAM is retained
RET,
-- Only the first 4Kbytes of the backup RAM is retained
PARTIAL,
-- All the backup RAM is turned OFF
OFF)
with Size => 2;
for BKUPCFG_BRAMCFGSelect use
(RET => 0,
PARTIAL => 1,
OFF => 2);
-- Backup Configuration
type PM_BKUPCFG_Register is record
-- Ram Configuration
BRAMCFG : BKUPCFG_BRAMCFGSelect := SAM_SVD.PM.RET;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_BKUPCFG_Register use record
BRAMCFG at 0 range 0 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
end record;
subtype PM_PWSAKDLY_DLYVAL_Field is HAL.UInt7;
-- Power Switch Acknowledge Delay
type PM_PWSAKDLY_Register is record
-- Delay Value
DLYVAL : PM_PWSAKDLY_DLYVAL_Field := 16#0#;
-- Ignore Acknowledge
IGNACK : Boolean := False;
end record
with Volatile_Full_Access, Object_Size => 8,
Bit_Order => System.Low_Order_First;
for PM_PWSAKDLY_Register use record
DLYVAL at 0 range 0 .. 6;
IGNACK at 0 range 7 .. 7;
end record;
-----------------
-- Peripherals --
-----------------
-- Power Manager
type PM_Peripheral is record
-- Control A
CTRLA : aliased PM_CTRLA_Register;
-- Sleep Configuration
SLEEPCFG : aliased PM_SLEEPCFG_Register;
-- Interrupt Enable Clear
INTENCLR : aliased PM_INTENCLR_Register;
-- Interrupt Enable Set
INTENSET : aliased PM_INTENSET_Register;
-- Interrupt Flag Status and Clear
INTFLAG : aliased PM_INTFLAG_Register;
-- Standby Configuration
STDBYCFG : aliased PM_STDBYCFG_Register;
-- Hibernate Configuration
HIBCFG : aliased PM_HIBCFG_Register;
-- Backup Configuration
BKUPCFG : aliased PM_BKUPCFG_Register;
-- Power Switch Acknowledge Delay
PWSAKDLY : aliased PM_PWSAKDLY_Register;
end record
with Volatile;
for PM_Peripheral use record
CTRLA at 16#0# range 0 .. 7;
SLEEPCFG at 16#1# range 0 .. 7;
INTENCLR at 16#4# range 0 .. 7;
INTENSET at 16#5# range 0 .. 7;
INTFLAG at 16#6# range 0 .. 7;
STDBYCFG at 16#8# range 0 .. 7;
HIBCFG at 16#9# range 0 .. 7;
BKUPCFG at 16#A# range 0 .. 7;
PWSAKDLY at 16#12# range 0 .. 7;
end record;
-- Power Manager
PM_Periph : aliased PM_Peripheral
with Import, Address => PM_Base;
end SAM_SVD.PM;
|
src/test/ref/declared-memory-var-6.asm | jbrandwood/kickc | 2 | 280 | <filename>src/test/ref/declared-memory-var-6.asm
// Test declaring a variable as "memory", meaning it will be stored in memory and accessed through an implicit pointer (using load/store)
// Commodore 64 PRG executable file
.file [name="declared-memory-var-6.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
.label SCREEN = $400
.segment Code
main: {
.const reg_zp_flex = '.'
.const reg_mem_flex = '.'
.const default_default = '.'
.const reg_default = '.'
.const default_zp_flex = '.'
.const default_mem_flex = '.'
.label default_zp_abs = $11
.label default_mem_abs = $1001
.label reg_zp_abs = $10
.label reg_mem_abs = $1000
// char __ssa __address(0x10) reg_zp_abs = '.'
lda #'.'
sta.z reg_zp_abs
// char __ssa __address(0x1000) reg_mem_abs = '.'
sta reg_mem_abs
// char __address(0x11) default_zp_abs = '.'
sta.z default_zp_abs
// char __address(0x1001) default_mem_abs = '.'
sta default_mem_abs
// out(reg_zp_flex)
ldy #0
ldx #reg_zp_flex
jsr out
// out(reg_zp_abs)
ldx.z reg_zp_abs
jsr out
// out(reg_mem_flex)
ldx #reg_mem_flex
jsr out
// out(reg_mem_abs)
ldx reg_mem_abs
jsr out
// out(default_default)
ldx #default_default
jsr out
// out(reg_default)
ldx #reg_default
jsr out
// out(default_zp_flex)
ldx #default_zp_flex
jsr out
// out(default_zp_abs)
ldx.z default_zp_abs
jsr out
// out(default_mem_flex)
ldx #default_mem_flex
jsr out
// out(default_mem_abs)
ldx default_mem_abs
jsr out
// }
rts
}
// void out(__register(X) char c)
out: {
// SCREEN[i++] = c
txa
sta SCREEN,y
// SCREEN[i++] = c;
iny
// }
rts
}
|
a/Assembler Bootsect.asm | wenzzai/hello-world | 8,076 | 14992 | [ORG 0x7C00]
mov si,HelloWorld
call print_string
jmp $
HelloWorld db "Hello World",0xD,0xA,0
print_string:
mov ah,0xE
.repeat:
lodsb
cmp al,0
je .done
int 0x10
jmp .repeat
.done:
ret
times 510-($-$$) db 0
dw 0xAA55
|
oeis/288/A288668.asm | neoneye/loda-programs | 11 | 177128 | ; A288668: a(n) = a(n-2) + 2*a(n-3) for n >= 3, where a(0) = 2, a(2) = 4, a(3) = 5.
; Submitted by <NAME>
; 2,4,5,8,13,18,29,44,65,102,153,232,357,538,821,1252,1897,2894,4401,6688,10189,15490,23565,35868,54545,82998,126281,192088,292277,444650,676453,1029204,1565753,2382110,3624161,5513616,8388381,12761938,19415613,29538700,44939489,68369926,104016889,158248904,240756741,366282682,557254549,847796164,1289819913,1962305262,2985412241,4541945088,6910022765,10512769570,15993912941,24332815100,37019452081,56320640982,85685082281,130359545144,198326364245,301729709706,459045454533,698382438196
mov $2,1
mov $3,-1
lpb $0
sub $0,1
mov $1,$4
mov $4,$2
mov $2,$1
mul $1,2
add $3,6
add $2,$3
mov $3,$1
lpe
mov $0,$2
div $0,2
add $0,2
|
src/asf-components-widgets-panels.adb | jquorning/ada-asf | 12 | 30199 | <reponame>jquorning/ada-asf<filename>src/asf-components-widgets-panels.adb<gh_stars>10-100
-----------------------------------------------------------------------
-- components-widgets-panels -- Collapsible panels
-- Copyright (C) 2013, 2017 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Beans.Objects;
with ASF.Components.Base;
package body ASF.Components.Widgets.Panels is
procedure Render_Action_Icon (Writer : in out ASF.Contexts.Writer.Response_Writer'Class;
Name : in String);
procedure Render_Action_Icon (Writer : in out ASF.Contexts.Writer.Response_Writer'Class;
Name : in String) is
begin
Writer.Start_Element ("a");
Writer.Write_Attribute ("href", "#");
Writer.Write_Attribute ("class", "ui-panel-icon ui-corner-all ui-state-default");
Writer.Start_Element ("span");
Writer.Write_Attribute ("class", Name);
Writer.End_Element ("span");
Writer.End_Element ("a");
end Render_Action_Icon;
-- ------------------------------
-- Render the panel header.
-- ------------------------------
procedure Render_Header (UI : in UIPanel;
Writer : in out ASF.Contexts.Writer.Response_Writer'Class;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type ASF.Components.Base.UIComponent_Access;
Header : Util.Beans.Objects.Object;
Header_Facet : ASF.Components.Base.UIComponent_Access;
Closable : constant Boolean := UI.Get_Attribute (CLOSABLE_ATTR_NAME, Context);
Toggleable : constant Boolean := UI.Get_Attribute (TOGGLEABLE_ATTR_NAME, Context);
begin
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "ui-panel-header ui-widget-header");
Header := UI.Get_Attribute (Name => HEADER_ATTR_NAME, Context => Context);
if not Util.Beans.Objects.Is_Empty (Header) then
Writer.Start_Element ("span");
Writer.Write_Text (Header);
Writer.End_Element ("span");
end if;
-- If there is a header facet, render it now.
Header_Facet := UI.Get_Facet (HEADER_FACET_NAME);
if Header_Facet /= null then
Header_Facet.Encode_All (Context);
end if;
if Closable then
Render_Action_Icon (Writer, "ui-icon ui-icon-closethick");
end if;
if Toggleable then
Render_Action_Icon (Writer, "ui-icon ui-icon-minusthick");
end if;
Writer.End_Element ("div");
-- Write the javascript to support the close and toggle actions.
if Closable or Toggleable then
Writer.Queue_Script ("$(""#");
Writer.Queue_Script (UI.Get_Client_Id);
Writer.Queue_Script (""").panel();");
end if;
end Render_Header;
-- ------------------------------
-- Render the panel footer.
-- ------------------------------
procedure Render_Footer (UI : in UIPanel;
Writer : in out ASF.Contexts.Writer.Response_Writer'Class;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
use type ASF.Components.Base.UIComponent_Access;
Footer : Util.Beans.Objects.Object;
Footer_Facet : ASF.Components.Base.UIComponent_Access;
Has_Footer : Boolean;
begin
Footer_Facet := UI.Get_Facet (FOOTER_FACET_NAME);
Footer := UI.Get_Attribute (Name => FOOTER_ATTR_NAME, Context => Context);
Has_Footer := Footer_Facet /= null or else not Util.Beans.Objects.Is_Empty (Footer);
if Has_Footer then
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "ui-panel-footer ui-widget-footer");
end if;
if not Util.Beans.Objects.Is_Empty (Footer) then
Writer.Write_Text (Footer);
end if;
-- If there is a footer facet, render it now.
if Footer_Facet /= null then
Footer_Facet.Encode_All (Context);
end if;
if Has_Footer then
Writer.End_Element ("div");
end if;
end Render_Footer;
-- ------------------------------
-- Render the panel header and prepare for the panel content.
-- ------------------------------
overriding
procedure Encode_Begin (UI : in UIPanel;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
begin
if UI.Is_Rendered (Context) then
Writer.Start_Element ("div");
Writer.Write_Attribute ("id", UI.Get_Client_Id);
declare
use Util.Beans.Objects;
Style : constant Object := UI.Get_Attribute (Context, "style");
Class : constant Object := UI.Get_Attribute (Context, "styleClass");
begin
if not Util.Beans.Objects.Is_Null (Class) then
Writer.Write_Attribute ("class", To_String (Class)
& " ui-panel ui-widget ui-corner-all");
else
Writer.Write_Attribute ("class", "ui-panel ui-widget ui-corner-all");
end if;
if not Is_Null (Style) then
Writer.Write_Attribute ("style", Style);
end if;
end;
UIPanel'Class (UI).Render_Header (Writer.all, Context);
Writer.Start_Element ("div");
Writer.Write_Attribute ("class", "ui-panel-content ui-widget-content");
end if;
end Encode_Begin;
-- ------------------------------
-- Render the panel footer.
-- ------------------------------
overriding
procedure Encode_End (UI : in UIPanel;
Context : in out ASF.Contexts.Faces.Faces_Context'Class) is
Writer : constant Contexts.Writer.Response_Writer_Access := Context.Get_Response_Writer;
begin
if UI.Is_Rendered (Context) then
Writer.End_Element ("div");
UIPanel'Class (UI).Render_Footer (Writer.all, Context);
Writer.End_Element ("div");
end if;
end Encode_End;
end ASF.Components.Widgets.Panels;
|
programs/oeis/116/A116400.asm | neoneye/loda | 22 | 8696 | <filename>programs/oeis/116/A116400.asm<gh_stars>10-100
; A116400: E.g.f. Bessel_I(2,2x)+Bessel_I(3,2x)+Bessel_I(4,2x).
; 0,0,1,1,5,5,21,21,84,84,330,330,1287,1287,5005,5005,19448,19448,75582,75582,293930,293930,1144066,1144066,4457400,4457400,17383860,17383860,67863915,67863915,265182525
div $0,2
mov $1,$0
add $0,2
sub $1,1
add $1,$0
bin $1,$0
mov $0,$1
|
oeis/207/A207260.asm | neoneye/loda-programs | 11 | 22700 | <reponame>neoneye/loda-programs
; A207260: Triangle T(n,k) with T(n,k) = k^2 + (1-(-1)^(n-k))/2.
; Submitted by <NAME>
; 0,1,1,0,2,4,1,1,5,9,0,2,4,10,16,1,1,5,9,17,25,0,2,4,10,16,26,36,1,1,5,9,17,25,37,49,0,2,4,10,16,26,36,50,64,1,1,5,9,17,25,37,49,65,81,0,2,4,10,16,26,36
lpb $0
mov $2,$0
add $3,1
sub $0,$3
mod $2,2
lpe
pow $0,2
add $2,$0
mov $0,$2
|
Univalence/Obsolete/ConcretePermutation.agda | JacquesCarette/pi-dual | 14 | 14183 | <reponame>JacquesCarette/pi-dual
{-# OPTIONS --without-K #-}
module ConcretePermutation where
import Level using (zero)
open import Data.Nat using (ℕ; _+_; _*_)
open import Data.Fin using (Fin; zero; suc; inject+; raise)
open import Data.Sum
using (_⊎_; inj₁; inj₂; [_,_]′)
renaming (map to map⊎)
open import Data.Product using (_×_; proj₁; proj₂; _,′_)
open import Data.Vec
using (Vec; _∷_; []; tabulate; _>>=_; allFin)
renaming (_++_ to _++V_; map to mapV; concat to concatV)
open import Data.Vec.Properties
using (lookup-allFin; tabulate∘lookup; lookup∘tabulate; lookup-++-inject+;
tabulate-∘)
open import Function using (_∘_; id)
open import Algebra using (CommutativeSemiring)
open import Algebra.Structures using
(IsSemigroup; IsCommutativeMonoid; IsCommutativeSemiring)
open import Relation.Binary using (IsEquivalence)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; sym; trans;
cong; cong₂; module ≡-Reasoning; proof-irrelevance)
open import Proofs using (
-- FiniteFunctions
finext;
-- VectorLemmas
lookup-++-raise; lookupassoc; tabulate-split; _!!_; unSplit;
concat-map; map-map-map; lookup-map; map-∘;
left!!; right!!
)
open import FinVec -- using ()
open import FinVecProperties -- using ()
------------------------------------------------------------------------------
-- a concrete permutation has 4 components:
-- - the permutation
-- - its inverse
-- - and 2 proofs that it is indeed inverse
record CPerm (values : ℕ) (size : ℕ) : Set where
constructor cp
field
π : FinVec values size
πᵒ : FinVec size values
αp : π ∘̂ πᵒ ≡ 1C
βp : πᵒ ∘̂ π ≡ 1C
πᵒ≡ : ∀ {m n} → (π₁ π₂ : CPerm m n) → (CPerm.π π₁ ≡ CPerm.π π₂) →
(CPerm.πᵒ π₁ ≡ CPerm.πᵒ π₂)
πᵒ≡ {n} (cp π πᵒ αp βp) (cp .π πᵒ₁ αp₁ βp₁) refl =
begin (
πᵒ ≡⟨ sym (∘̂-rid πᵒ) ⟩
πᵒ ∘̂ 1C ≡⟨ cong (_∘̂_ πᵒ) (sym αp₁) ⟩
πᵒ ∘̂ (π ∘̂ πᵒ₁) ≡⟨ ∘̂-assoc πᵒ π πᵒ₁ ⟩
(πᵒ ∘̂ π) ∘̂ πᵒ₁ ≡⟨ cong (λ x → x ∘̂ πᵒ₁) βp ⟩
1C ∘̂ πᵒ₁ ≡⟨ ∘̂-lid πᵒ₁ ⟩
πᵒ₁ ∎)
where open ≡-Reasoning
p≡ : ∀ {m n} → {π₁ π₂ : CPerm m n} → (CPerm.π π₁ ≡ CPerm.π π₂) → π₁ ≡ π₂
p≡ {m} {n} {cp π πᵒ αp βp} {cp .π πᵒ₁ αp₁ βp₁} refl with
πᵒ≡ (cp π πᵒ αp βp) (cp π πᵒ₁ αp₁ βp₁) refl
p≡ {m} {n} {cp π πᵒ αp βp} {cp .π .πᵒ αp₁ βp₁} refl | refl
with proof-irrelevance αp αp₁ | proof-irrelevance βp βp₁
p≡ {m} {n} {cp π πᵒ αp βp} {cp .π .πᵒ .αp .βp} refl | refl | refl | refl = refl
idp : ∀ {n} → CPerm n n
idp {n} = cp 1C 1C (∘̂-rid _) (∘̂-lid _)
symp : ∀ {m n} → CPerm m n → CPerm n m
symp (cp p₁ p₂ α β) = cp p₂ p₁ β α
transp : ∀ {m₁ m₂ m₃} → CPerm m₂ m₁ → CPerm m₃ m₂ → CPerm m₃ m₁
transp {n} (cp π πᵒ αp βp) (cp π₁ πᵒ₁ αp₁ βp₁) = cp (π ∘̂ π₁) (πᵒ₁ ∘̂ πᵒ) pf₁ pf₂
where
open ≡-Reasoning
pf₁ : (π ∘̂ π₁) ∘̂ (πᵒ₁ ∘̂ πᵒ) ≡ 1C
pf₁ =
begin (
(π ∘̂ π₁) ∘̂ (πᵒ₁ ∘̂ πᵒ) ≡⟨ ∘̂-assoc _ _ _ ⟩
((π ∘̂ π₁) ∘̂ πᵒ₁) ∘̂ πᵒ ≡⟨ cong (λ x → x ∘̂ πᵒ) (sym (∘̂-assoc _ _ _)) ⟩
(π ∘̂ (π₁ ∘̂ πᵒ₁)) ∘̂ πᵒ ≡⟨ cong (λ x → (π ∘̂ x) ∘̂ πᵒ) (αp₁) ⟩
(π ∘̂ 1C) ∘̂ πᵒ ≡⟨ cong (λ x → x ∘̂ πᵒ) (∘̂-rid _) ⟩
π ∘̂ πᵒ ≡⟨ αp ⟩
1C ∎)
pf₂ : (πᵒ₁ ∘̂ πᵒ) ∘̂ (π ∘̂ π₁) ≡ 1C
pf₂ =
begin (
(πᵒ₁ ∘̂ πᵒ) ∘̂ (π ∘̂ π₁) ≡⟨ ∘̂-assoc _ _ _ ⟩
((πᵒ₁ ∘̂ πᵒ) ∘̂ π) ∘̂ π₁ ≡⟨ cong (λ x → x ∘̂ π₁) (sym (∘̂-assoc _ _ _)) ⟩
(πᵒ₁ ∘̂ (πᵒ ∘̂ π)) ∘̂ π₁ ≡⟨ cong (λ x → (πᵒ₁ ∘̂ x) ∘̂ π₁) βp ⟩
(πᵒ₁ ∘̂ 1C) ∘̂ π₁ ≡⟨ cong (λ x → x ∘̂ π₁) (∘̂-rid _) ⟩
πᵒ₁ ∘̂ π₁ ≡⟨ βp₁ ⟩
1C ∎)
-- zero permutation
0p : CPerm 0 0
0p = idp {0}
_⊎p_ : ∀ {m₁ m₂ n₁ n₂} → CPerm m₁ m₂ → CPerm n₁ n₂ → CPerm (m₁ + n₁) (m₂ + n₂)
_⊎p_ {m₁} {m₂} {n₁} {n₂} π₀ π₁ =
cp ((π π₀) ⊎c (π π₁)) ((πᵒ π₀) ⊎c (πᵒ π₁)) pf₁ pf₂
where
open CPerm
open ≡-Reasoning
pf₁ : (π π₀ ⊎c π π₁) ∘̂ (πᵒ π₀ ⊎c πᵒ π₁) ≡ 1C
pf₁ =
begin (
(π π₀ ⊎c π π₁) ∘̂ (πᵒ π₀ ⊎c πᵒ π₁)
≡⟨ ⊎c-distrib {p₁ = π π₀} ⟩
(π π₀ ∘̂ πᵒ π₀) ⊎c (π π₁ ∘̂ πᵒ π₁)
≡⟨ cong₂ _⊎c_ (αp π₀) (αp π₁) ⟩
1C {m₂} ⊎c 1C {n₂}
≡⟨ 1C⊎1C≡1C {m₂} ⟩
1C ∎)
pf₂ : (πᵒ π₀ ⊎c πᵒ π₁) ∘̂ (π π₀ ⊎c π π₁) ≡ 1C
pf₂ =
begin (
(πᵒ π₀ ⊎c πᵒ π₁) ∘̂ (π π₀ ⊎c π π₁)
≡⟨ ⊎c-distrib {p₁ = πᵒ π₀} ⟩
(πᵒ π₀ ∘̂ π π₀) ⊎c (πᵒ π₁ ∘̂ π π₁)
≡⟨ cong₂ _⊎c_ (βp π₀) (βp π₁) ⟩
1C {m₁} ⊎c 1C {n₁}
≡⟨ 1C⊎1C≡1C {m₁} ⟩
1C ∎ )
-- For the rest of the permutations, it is convenient to lift things from
-- FinVec in one go; but don't use it yet, it makes other things fall apart
{--
mkPerm : {m n : ℕ} (eq : Fin m ≃ Fin n) → CPerm m n
mkPerm {m} {n} eq = cp p q p∘̂q≡1 q∘̂p≡1
where
f = proj₁ eq
g = proj₁ (sym≃ eq)
p = tabulate g -- note the flip!
q = tabulate f
q∘̂p≡1 = ~⇒≡ {f = g} {g = f} (p∘!p≡id {p = eq})
p∘̂q≡1 = ~⇒≡ {f = f} {g = g} (p∘!p≡id {p = sym≃ eq})
--}
unite+p : {m : ℕ} → CPerm m (0 + m)
unite+p {m} =
cp (unite+ {m}) (uniti+ {m}) (unite+∘̂uniti+~id {m}) (uniti+∘̂unite+~id {m})
uniti+p : {m : ℕ} → CPerm (0 + m) m
uniti+p {m} = symp (unite+p {m})
unite+rp : {m : ℕ} → CPerm m (m + 0)
unite+rp {m} =
cp (unite+r {m}) (uniti+r) (unite+r∘̂uniti+r~id) (uniti+r∘̂unite+r~id)
uniti+rp : {m : ℕ} → CPerm (m + 0) m
uniti+rp {m} = symp (unite+rp {m})
assocl+p : {m n o : ℕ} → CPerm ((m + n) + o) (m + (n + o))
assocl+p {m} =
cp
(assocl+ {m}) (assocr+ {m})
(assocl+∘̂assocr+~id {m}) (assocr+∘̂assocl+~id {m})
assocr+p : {m n o : ℕ} → CPerm (m + (n + o)) ((m + n) + o)
assocr+p {m} = symp (assocl+p {m})
swap+p : {m n : ℕ} → CPerm (n + m) (m + n)
swap+p {m} {n} =
cp (swap+cauchy m n) (swap+cauchy n m) (swap+-inv {m}) (swap+-inv {n})
unite*p : {m : ℕ} → CPerm m (1 * m)
unite*p {m} =
cp (unite* {m}) (uniti* {m}) (unite*∘̂uniti*~id {m}) (uniti*∘̂unite*~id {m})
uniti*p : {m : ℕ} → CPerm (1 * m) m
uniti*p {m} = symp (unite*p {m})
unite*rp : {m : ℕ} → CPerm m (m * 1)
unite*rp {m} =
cp
(unite*r {m}) (uniti*r {m})
(unite*r∘̂uniti*r~id {m}) (uniti*r∘̂unite*r~id {m})
uniti*rp : {m : ℕ} → CPerm (m * 1) m
uniti*rp {m} = symp (unite*rp {m})
swap*p : {m n : ℕ} → CPerm (n * m) (m * n)
swap*p {m} {n} =
cp (swap⋆cauchy m n) (swap⋆cauchy n m) (swap*-inv {m}) (swap*-inv {n})
assocl*p : {m n o : ℕ} → CPerm ((m * n) * o) (m * (n * o))
assocl*p {m} =
cp
(assocl* {m}) (assocr* {m})
(assocl*∘̂assocr*~id {m}) (assocr*∘̂assocl*~id {m})
assocr*p : {m n o : ℕ} → CPerm (m * (n * o)) ((m * n) * o)
assocr*p {m} = symp (assocl*p {m})
_×p_ : ∀ {m₁ m₂ n₁ n₂} → CPerm m₁ m₂ → CPerm n₁ n₂ → CPerm (m₁ * n₁) (m₂ * n₂)
_×p_ {m₁} {m₂} {n₁} {n₂} π₀ π₁ =
cp ((π π₀) ×c (π π₁)) ((πᵒ π₀) ×c (πᵒ π₁)) pf₁ pf₂
where
open CPerm
open ≡-Reasoning
pf₁ : (π π₀ ×c π π₁) ∘̂ (πᵒ π₀ ×c πᵒ π₁) ≡ 1C
pf₁ =
begin (
(π π₀ ×c π π₁) ∘̂ (πᵒ π₀ ×c πᵒ π₁) ≡⟨ ×c-distrib {p₁ = π π₀} ⟩
(π π₀ ∘̂ πᵒ π₀) ×c (π π₁ ∘̂ πᵒ π₁) ≡⟨ cong₂ _×c_ (αp π₀) (αp π₁) ⟩
1C ×c 1C ≡⟨ 1C×1C≡1C ⟩
1C ∎)
pf₂ : (πᵒ π₀ ×c πᵒ π₁) ∘̂ (π π₀ ×c π π₁) ≡ 1C
pf₂ =
begin (
(πᵒ π₀ ×c πᵒ π₁) ∘̂ (π π₀ ×c π π₁) ≡⟨ ×c-distrib {p₁ = πᵒ π₀} ⟩
(πᵒ π₀ ∘̂ π π₀) ×c (πᵒ π₁ ∘̂ π π₁) ≡⟨ cong₂ _×c_ (βp π₀) (βp π₁) ⟩
1C ×c 1C ≡⟨ 1C×1C≡1C ⟩
1C ∎)
distp : {m n o : ℕ} → CPerm (m * o + n * o) ((m + n) * o)
distp {m} {n} {o} =
cp
(dist*+ {m}) (factor*+ {m})
(dist*+∘̂factor*+~id {m}) (factor*+∘̂dist*+~id {m})
factorp : {m n o : ℕ} → CPerm ((m + n) * o) (m * o + n * o)
factorp {m} = symp (distp {m})
distlp : {m n o : ℕ} → CPerm (m * n + m * o) (m * (n + o))
distlp {m} {n} {o} =
cp
(distl*+ {m}) (factorl*+ {m})
(distl*+∘̂factorl*+~id {m}) (factorl*+∘̂distl*+~id {m})
factorlp : {m n o : ℕ} → CPerm (m * (n + o)) (m * n + m * o)
factorlp {m} = symp (distlp {m})
-- right-zero absorbing permutation
0pr : ∀ {n} → CPerm 0 (n * 0)
0pr {n} =
cp
(right-zero*l {n}) (right-zero*r {n})
(right-zero*l∘̂right-zero*r~id {n}) (right-zero*r∘̂right-zero*l~id {n})
-- and its symmetric version
0pl : ∀ {n} → CPerm (n * 0) 0
0pl {n} = symp (0pr {n})
--
ridp : ∀ {m₁ m₂} {p : CPerm m₂ m₁} → transp p idp ≡ p
ridp {p = p} = p≡ (∘̂-rid (CPerm.π p))
lidp : ∀ {m₁ m₂} {p : CPerm m₂ m₁} → transp idp p ≡ p
lidp {p = p} = p≡ (∘̂-lid (CPerm.π p))
assocp : ∀ {m₁ m₂ m₃ n₁} → {p₁ : CPerm m₁ n₁} → {p₂ : CPerm m₂ m₁} →
{p₃ : CPerm m₃ m₂} →
transp p₁ (transp p₂ p₃) ≡ transp (transp p₁ p₂) p₃
assocp {p₁ = p₁} {p₂} {p₃} =
p≡ (∘̂-assoc (CPerm.π p₁) (CPerm.π p₂) (CPerm.π p₃))
linv : ∀ {m₁ m₂} (p : CPerm m₂ m₁) → transp p (symp p) ≡ idp
linv p = p≡ (CPerm.αp p)
rinv : ∀ {m₁ m₂} (p : CPerm m₂ m₁) → transp (symp p) p ≡ idp
rinv p = p≡ (CPerm.βp p)
transp-resp-≡ : ∀ {m₁ m₂ m₃} {f h : CPerm m₂ m₃} {g i : CPerm m₁ m₂} →
f ≡ h → g ≡ i → transp f g ≡ transp h i
transp-resp-≡ refl refl = refl
1p⊎1p≡1p : ∀ {m n} → idp {m} ⊎p idp {n} ≡ idp
1p⊎1p≡1p {m} = p≡ (1C⊎1C≡1C {m})
1p×1p≡1p : ∀ {m n} → idp {m} ×p idp {n} ≡ idp
1p×1p≡1p {m} = p≡ (1C×1C≡1C {m})
⊎p-distrib : ∀ {m₁ m₂ m₃ m₄ n₁ n₂} → {p₁ : CPerm m₁ n₁} → {p₂ : CPerm m₂ n₂}
→ {p₃ : CPerm m₃ m₁} → {p₄ : CPerm m₄ m₂} →
transp (p₁ ⊎p p₂) (p₃ ⊎p p₄) ≡ (transp p₁ p₃) ⊎p (transp p₂ p₄)
⊎p-distrib {p₁ = p₁} = p≡ (⊎c-distrib {p₁ = CPerm.π p₁})
×p-distrib : ∀ {m₁ m₂ m₃ m₄ n₁ n₂} → {p₁ : CPerm m₁ n₁} → {p₂ : CPerm m₂ n₂}
→ {p₃ : CPerm m₃ m₁} → {p₄ : CPerm m₄ m₂} →
(transp p₁ p₃) ×p (transp p₂ p₄) ≡ transp (p₁ ×p p₂) (p₃ ×p p₄)
×p-distrib {p₁ = p₁} = p≡ (sym (×c-distrib {p₁ = CPerm.π p₁}))
0p⊎x≡x : ∀ {m n} {p : CPerm m n} → idp {0} ⊎p p ≡ p
0p⊎x≡x {p = p} = p≡ 1C₀⊎x≡x
-- this comes from looking at things categorically:
unite+p∘[0⊎x]≡x∘unite+p : ∀ {m n} (p : CPerm m n) →
transp unite+p (0p ⊎p p) ≡ transp p unite+p
unite+p∘[0⊎x]≡x∘unite+p p = p≡ unite+∘[0⊎x]≡x∘unite+
uniti+p∘x≡[0⊎x]∘uniti+p : ∀ {m n} (p : CPerm m n) →
transp uniti+p p ≡ transp (0p ⊎p p) uniti+p
uniti+p∘x≡[0⊎x]∘uniti+p p = p≡ (uniti+∘x≡[0⊎x]∘uniti+ {x = CPerm.π p})
-- and the right version
{-
unite+rp∘[x⊎0]≡x∘unite+rp : ∀ {m n} (p : CPerm m n) →
transp unite+rp (p ⊎p 0p) ≡ transp p unite+rp
unite+rp∘[x⊎0]≡x∘unite+rp p = p≡ ?
uniti+rp∘[x⊎0]≡x∘uniti+rp : ∀ {m n} (p : CPerm m n) →
transp uniti+rp (p ⊎p 0p) ≡ transp p uniti+rp
uniti+rp∘[x⊎0]≡x∘uniti+rp p = p≡ {!!}
-}
-- SCPerm : ℕ → ℕ → Setoid zero zero
-- SCPerm m n = setoid (CPerm m n)
------------------------------------------------------------------------------
|
libsrc/_DEVELOPMENT/arch/hbios/c/sccz80/hbios_a_dehl.asm | Frodevan/z88dk | 640 | 240040 | <reponame>Frodevan/z88dk
; uint8_t hbios_a_dehl(uint16_t func_device, uint32_t arg) __smallc
SECTION code_clib
SECTION code_arch
PUBLIC hbios_a_dehl
EXTERN asm_hbios_a
.hbios_a_dehl
pop af
pop hl
pop de
pop bc
push bc
push de
push hl
push af
jp asm_hbios_a
|
awa/src/awa-wikis-writers.ads | Letractively/ada-awa | 0 | 28316 | -----------------------------------------------------------------------
-- awa-wikis-writers -- Wiki writers
-- Copyright (C) 2011, 2012, 2013 <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 AWA.Wikis.Parsers;
package AWA.Wikis.Writers is
-- Render the wiki text according to the wiki syntax in an HTML string.
function To_Html (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String;
-- Render the wiki text according to the wiki syntax in a text string.
-- Wiki formatting and decoration are removed.
function To_Text (Text : in Wide_Wide_String;
Syntax : in AWA.Wikis.Parsers.Wiki_Syntax_Type) return String;
end AWA.Wikis.Writers;
|
adaProjects/first/program.ads | ryanroth79/stm32general | 0 | 15492 | <reponame>ryanroth79/stm32general
package Program is
procedure Run;
pragma Export (C, Run, "run");
end Program;
|
test/Fail/TypeConstructorsWhichPreserveGuardedness2.agda | hborum/agda | 3 | 6418 | {-# OPTIONS --guardedness-preserving-type-constructors #-}
module TypeConstructorsWhichPreserveGuardedness2 where
record ⊤ : Set where
data _⊎_ (A B : Set) : Set where
inj₁ : A → A ⊎ B
inj₂ : B → A ⊎ B
-- This should not be allowed.
ℕ : Set
ℕ = ⊤ ⊎ ℕ
|
utility.asm | unlink2/nesrpg | 5 | 243997 |
; sub routine that converts the sprite's
; tile position to an actual
; location on the screen
convert_tile_location:
ldx player_y
lda tile_convert_table, x
sec
sbc #$01
cmp #$FF ; if y location is FF we set it to 0
bne @not_ff
lda #$00
@not_ff:
sta sprite_data
ldx player_x
lda tile_convert_table, x
clc
adc #$00
sta sprite_data+3
; check game mode
lda game_mode
cmp #GAME_MODE_EDITOR
bne @done
; if editor mode also update sprites 1-5
ldx player_y
lda attr_convert_table, x
tax
lda tile_convert_table, x
sec
sbc #$01
cmp #$FF
bne @not_ff_editor
lda #$00
@not_ff_editor:
sta sprite_data_1
sta sprite_data_2
clc
adc #$8*3
sta sprite_data_3
sta sprite_data_4
ldx player_x
lda attr_convert_table, x
tax
lda tile_convert_table, x
sta sprite_data_1+3
sta sprite_data_3+3
clc
adc #$8*3
sta sprite_data_2+3
sta sprite_data_4+3
@done:
rts
; this sub routine applies smooth scrolling
; to sprite 0
; inputs:
; smooth_up,_down,_left,_right
; side effects:
; changes position of sprite 0
; overwirtes a and carry flag
apply_smooth:
lda sprite_data
sec
sbc smooth_down
clc
adc smooth_up
sta sprite_data
lda sprite_data+3
sec
sbc smooth_right
clc
adc smooth_left
sta sprite_data+3
rts
; this sub routine decrements all
; smooth movement values if they are greater than 0
; inputs:
; smooth up, down, left, right
; side effects:
; a register and carry flag are modified
; smooth_x values may be decremented
adjust_smooth:
; dec smooht values
lda #$00
cmp smooth_left
beq @no_dec_left
dec smooth_left
@no_dec_left:
cmp smooth_right
beq @no_dec_right
dec smooth_right
@no_dec_right:
cmp smooth_up
beq @no_dec_up
dec smooth_up
@no_dec_up:
cmp smooth_down
beq @no_dec_down
dec smooth_down
@no_dec_down:
rts
; this sub routine copies memory from one
; location to another
; inputs:
; y -> size
; src_ptr -> original data
; dest_ptr -> destination
; side effects:
; y is changed, data is written at dest_ptr
memcpy:
dey
@loop:
lda (src_ptr), y
sta (dest_ptr), y
dey
cpy #$FF ; if underflow stop
bne @loop
rts
; this sub routine sets memory of size
; to a certain value
; inputs:
; y -> size
; dest_ptr -> destination
; side effects:
; y is changed
memset:
dey
@loop:
sta (dest_ptr), y
dey
cpy #$FF ; if underflow stop
bne @loop
rts
; this sub routine converts a number to hex values
; that are ready to be pritned to the screen
; inputs:
; a -> the number
; side effects:
; hex_buffer if overwritten
; a is changed
convert_hex:
pha ; save value of a
and #$0F ; first nibble
sta hex_buffer
pla
and #$F0 ; second nibble
lsr
lsr
lsr
lsr ; shift to get right value
sta hex_buffer+1
rts
; this sub routine
; makes an indirect jsr
; based on src_ptr
; inputs
; src_ptr -> the rotuine to jump to
; side effects:
; depends on indirect routine called
jsr_indirect:
jmp (src_ptr)
; this sub routine is a no-op update routine
update_none:
jmp update_done
; no critical update
update_crit_none:
jmp update_crit_done
; this is an empty sub routine
; useful for function pointers that
; require an input
empty_sub:
rts
; this sub routine hides objects
; at 0/0
; side effects:
; moves obejcts
hide_objs:
lda #$00
ldx #$00
@loop:
lda #$24
sta sprite_data+1, x
lda #$00
sta sprite_data, x
sta sprite_data+2, x
sta sprite_data+3, x
inx
inx
inx
inx
cpx #$00
bne @loop
rts
; this sub routine generates
; a simple 8-bit pseudo
; random number
; inputs:
; rand8 -> nonzero value
; side effects:
; a register and flags are used
; rand8 changes
random:
lda rand8
jsr random_reg
sta rand8
rts
; this sub routine generates
; an 8 bit random number
; inputs:
; a -> nonzero value
; returns:
; new random number in a
random_reg:
lsr
bcc @noeor
eor #$B4
@noeor:
rts
; 8 bit xorshift random number
; used only for seed
; slow but more random
; inputs:
; a -> seed
; returns:
; new random number in a
; side effects:
; uses y and a registers
random_xor:
pha ; push seed
and #$B8
ldx #$05
ldy #$00
@loop:
asl
bcc @bit_clear ; branch until bit = 0
iny ; count amount of bits shifted off
@bit_clear:
dex
bne @loop
tya ; feedback count
lsr ; bit 0 is in carry
pla ; get seed
rol ; rotate carry in
rts
; 16 bit rng routine LFSR (Galois)
; used only for seed
; pretty random
; inputs:
; seed
; returns:
; new values in seed and seed+1, 8 bit value is also returned in a
; side effects:
; uses y and a register
; Note: based on bbbradsmith / prng_6502
random_seed:
ldy #8
lda seed
@begin:
asl ; shift the register
rol seed+1
bcc @carry_clear
eor #$39 ; apply XOR feedback whenever a 1 bit is shifted out
@carry_clear:
dey
bne @begin
sta seed
cmp #0 ; reload flags
rts
; this sub routine reloads a room
; inputs:
; level_data_ptr_bac
; level_ptr_bac
; attr_ptr_bac
; palette_ptr_bac (src_ptr)
; seed_bac for random map
reload_room:
; reload the pointers
lda level_data_ptr_bac
sta level_data_ptr
lda level_data_ptr_bac+1
sta level_data_ptr+1
lda attr_ptr_bac
sta attr_ptr
lda attr_ptr_bac+1
sta attr_ptr+1
lda palette_ptr_bac
sta src_ptr
lda palette_ptr_bac+1
sta src_ptr+1
lda seed_bac
sta seed
lda seed_bac+1
sta seed+1
ldx #$00
stx $2001 ; disable rendering
; load an empty map first
lda #<empty_map
sta level_data_ptr
lda #>empty_map
sta level_data_ptr+1
lda #<level_data
sta level_ptr
lda #>level_data
sta level_ptr+1
; disable NMI until load is complete
set_nmi_flag
jsr decompress_level
ldx #$00 ; nt 0
jsr load_level
; load actual map
lda level_data_ptr_bac
sta level_data_ptr
lda level_data_ptr_bac+1
sta level_data_ptr+1
lda #<level_data
sta level_ptr
lda #>level_data
sta level_ptr+1
; load sram values before generating map
lda load_flags
and #%00100000
beq @no_load
jsr load_save
@no_load:
; if level select is #$00 we generate a map, otherwise decompress
lda load_flags
and #%10000000
beq @decompress
lda level ; test if shop is supposed to be loaded
and #SHOP_MASK ; every F levels
cmp #SHOP_MASK
bne @no_shop
; clear sram attributes
jsr clear_sram_attr
lda #<shop_gfx
sta level_data_ptr
lda #>shop_gfx
sta level_data_ptr+1
jmp @decompress
@no_shop:
jsr generate_map
jmp @map_in_buffer
@decompress:
jsr decompress_level
@map_in_buffer:
jsr load_attr
; copy palette
lda #<level_palette
sta dest_ptr
lda #>level_palette
sta dest_ptr+1
ldy #PALETTE_SIZE
jsr memcpy
lda #$00
sta nametable
vblank_wait
; lda #$00
; sta $2005
; sta $2005 ; no scrolling
jsr init_game
; test if partial load is needed now
; if so we have start location and can go ahead
lda load_flags
and #%01000000 ; flag for partial load
beq @no_part_load
lda player_x
sta get_tile_x
lda player_y
sta get_tile_y
ldx #$00 ; nametable 0
jsr load_level_part
jmp @done
@no_part_load:
ldx #$00 ; nametable 0
jsr load_level
@done:
vblank_wait
rts
; this sub routine should be called at the start of the
; program
; first it checks the magic number sequence
; if it is not present it sets up default values
; for all sram functionality
init_sram:
ldx #$00
@magic_check:
lda magic_bytes, x
cmp magic, x
bne @init
inx
cpx #16
bne @magic_check
rts
@init:
; if check was not OK start
; init
; first set up magic values correctly
ldx #$00
@magic_init:
lda magic_bytes, x
sta magic, x
inx
cpx #16
bne @magic_init
; lastly make the custom code
; an rts
lda #$60 ; rts opcode
sta save_sub_1
sta save_sub_2
sta save_sub_3
; then set up a completely empty
; tileset for all maps
ldx #00
@empty_map_init:
lda empty_map, x
sta save_1, x
sta save_2, x
sta save_3, x
inx
cpx #$14
bne @empty_map_init
rts
; 16 random values
magic_bytes:
.db $0e ,$94 ,$3f ,$76 ,$9c ,$dd ,$f0 ,$ba ,$5c ,$ba ,$72 ,$36 ,$f8 ,$2d ,$d3, $46
; this sub routine calculates the
; absolute distance between 2 numbers
; inputs:
; a -> x1
; x -> x2
; returns:
; absolute distance between x1 and x2
; side effects:
; uses temp for subtraction
calc_distance:
stx temp
sec
sbc temp
; if overflow flag is set we got a negative result
bpl @no_negative
; to convert, invert all bits and add 1
eor #%11111111
clc
adc #$01
@no_negative:
rts
; this sub routine is called when
; a brk occurs
; or any other IRQ is called
; since IRQ should never be activated
; it prints out all register values
; and the stack
; abandon all hope ye who calls this
crash_handler:
pha ; store A value for output later on
txa
pha ; store X value
tya
pha ; store Y value
vblank_wait
; disable sprites and rendering
; disable NMI
lda #$00
sta $2000
sta $2001
bit $2002 ; reset latch
lda #$20
sta $2006
lda #$00
sta $2006 ; write address
lda #$22 ; 'Y'
sta $2007
pla ; y value
; this macro outputs
; prints value in A to the screen
.macro output_value_crash
pha
lsr
lsr
lsr
lsr
sta $2007
pla
and #$0F
sta $2007
.endm
; y value
output_value_crash
lda #$24 ; space
sta $2007
lda #$21 ; 'X'
sta $2007
pla ; x value
output_value_crash
lda #$24 ; space
sta $2007
lda #$0A ; 'A'
sta $2007
pla
output_value_crash
lda #$24 ; space
sta $2007
lda #$1C ; 'S'
sta $2007
tsx
txa
output_value_crash
; output error message
lda #$20
sta $2006
lda #$80
sta $2006
ldy #$00
@message_loop:
lda @error_str, y
beq @message_done
sta $2007
iny
bne @message_loop
@message_done:
; loop all of stack
lda #$20
sta $2006
lda #$C0
sta $2006
ldy #$00
ldx #$24
@stack_loop:
lda $0100, y
output_value_crash
; stx $2007
iny
bne @stack_loop
@crash_loop:
vblank_wait
; enable rendering
lda #%00000000 ; enable NMI, sprites from Pattern Table 0
sta $2000
lda #%00001111 ; enable sprites, bg, grayscale mode
sta $2001
lda #$00
sta $2005
sta $2005
jmp @crash_loop
; strings for crash handler
@error_str:
.db "OH NO THE GAME CRASHED", $00
@error_str_end:
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c9/c9a003a.ada | best08618/asylo | 7 | 28735 | -- C9A003A.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- CHECK THAT ABORTING A TERMINATED TASK DOES NOT CAUSE EXCEPTIONS.
-- RM 5/21/82
-- SPS 11/21/82
-- PWN 09/11/94 REMOVED PRAGMA PRIORITY FOR ADA 9X
with Impdef;
WITH REPORT; USE REPORT;
WITH SYSTEM; USE SYSTEM;
PROCEDURE C9A003A IS
-- THE TASK WILL HAVE HIGHER PRIORITY ( PRIORITY'LAST )
BEGIN
-------------------------------------------------------------------
TEST ("C9A003A", "CHECK THAT ABORTING A TERMINATED TASK" &
" DOES NOT CAUSE EXCEPTIONS" );
DECLARE
TASK TYPE T_TYPE IS
ENTRY E ;
END T_TYPE ;
T_OBJECT1 : T_TYPE ;
TASK BODY T_TYPE IS
BUSY : BOOLEAN := FALSE ;
BEGIN
NULL;
END T_TYPE ;
BEGIN
IF NOT T_OBJECT1'TERMINATED THEN
DELAY 20.0 * Impdef.One_Second;
END IF;
IF NOT T_OBJECT1'TERMINATED THEN
COMMENT( "TASK NOT YET TERMINATED (AFTER 20 S.)" );
END IF;
BEGIN
ABORT T_OBJECT1 ;
EXCEPTION
WHEN OTHERS =>
FAILED( "EXCEPTION RAISED (WHEN ABORTING A" &
" TERMINATED TASK)" );
END ;
END ;
-------------------------------------------------------------------
RESULT;
END C9A003A ;
|
legacy/Data/Num/Bij/Convert.agda | banacorn/numeral | 1 | 9256 | module Data.Num.Bij.Convert where
open import Data.Num.Bij
open import Data.Num.Bij.Properties
open import Data.List hiding ([_])
open import Relation.Binary
open import Data.Nat using (ℕ; zero; suc; _+_; _*_)
open import Data.Product
open import Data.Nat.Properties
open import Data.Nat.Properties.Simple
open import Data.Nat.Etc
open import Relation.Nullary.Negation using (contradiction; contraposition)
open import Relation.Binary.PropositionalEquality as PropEq
using (_≡_; _≢_; refl; sym; cong; trans)
open PropEq.≡-Reasoning
import Level
{-
-- to ℕ, instance of Conversion
instance convNat : Conversion ℕ
convNat = conversion [_]' !_!'
where [_]' : ℕ → Bij
[ zero ]' = []
[ suc n ]' = incrB [ n ]'
!_!' : Bij → ℕ
! [] !' = 0
! one ∷ xs !' = 1 + 2 * ! xs !'
! two ∷ xs !' = 2 + 2 * ! xs !'
-}
-- Digit ⇒ ℕ
D[_]ℕ : DigitB → ℕ
D[ one ]ℕ = 1
D[ two ]ℕ = 2
-- ℕ ⇔ Bij
[_]B : ℕ → Bij
[ zero ]B = []
[ suc n ]B = incrB [ n ]B
[_]ℕ : Bij → ℕ
[ [] ]ℕ = 0
[ one ∷ xs ]ℕ = 1 + 2 * [ xs ]ℕ
[ two ∷ xs ]ℕ = 2 + 2 * [ xs ]ℕ
-- properties
[]ℕ-∷-hom : ∀ x xs → [ x ∷ xs ]ℕ ≡ D[ x ]ℕ + 2 * [ xs ]ℕ
[]ℕ-∷-hom one _ = refl
[]ℕ-∷-hom two _ = refl
[]ℕ-incrB-hom : ∀ xs → [ incrB xs ]ℕ ≡ suc [ xs ]ℕ
[]ℕ-incrB-hom [] = refl
[]ℕ-incrB-hom (one ∷ xs) = refl
[]ℕ-incrB-hom (two ∷ xs) =
begin
suc (2 * [ incrB xs ]ℕ)
≡⟨ cong (λ x → suc (2 * x)) ([]ℕ-incrB-hom xs) ⟩
suc (suc ([ xs ]ℕ + suc ([ xs ]ℕ + 0)))
≡⟨ cong (λ x → suc (suc x)) (+-suc [ xs ]ℕ ([ xs ]ℕ + 0)) ⟩
suc (suc (suc (2 * [ xs ]ℕ)))
∎
[]ℕ-+B-hom : ∀ xs ys → [ xs +B ys ]ℕ ≡ [ xs ]ℕ + [ ys ]ℕ
[]ℕ-+B-hom [] ys = refl
[]ℕ-+B-hom (x ∷ xs) [] = sym (+-right-identity [ x ∷ xs ]ℕ)
[]ℕ-+B-hom (one ∷ xs) (one ∷ ys) =
begin
2 + 2 * [ xs +B ys ]ℕ
≡⟨ cong (λ x → 2 + 2 * x) ([]ℕ-+B-hom xs ys) ⟩
2 + 2 * ([ xs ]ℕ + [ ys ]ℕ)
≡⟨ cong (λ x → 2 + x) (distrib-left-*-+ 2 [ xs ]ℕ [ ys ]ℕ) ⟩
2 + (2 * [ xs ]ℕ + 2 * [ ys ]ℕ)
≡⟨ cong suc (sym (+-suc (2 * [ xs ]ℕ) (2 * [ ys ]ℕ))) ⟩
suc (2 * [ xs ]ℕ + suc (2 * [ ys ]ℕ))
∎
[]ℕ-+B-hom (one ∷ xs) (two ∷ ys) =
begin
1 + 2 * [ incrB (xs +B ys) ]ℕ
≡⟨ cong (λ x → 1 + 2 * x) ([]ℕ-incrB-hom (xs +B ys)) ⟩
1 + 2 * (1 + [ xs +B ys ]ℕ)
≡⟨ cong (λ x → 1 + 2 * (1 + x)) ([]ℕ-+B-hom xs ys) ⟩
1 + 2 * suc ([ xs ]ℕ + [ ys ]ℕ)
≡⟨ cong suc (+-*-suc 2 ([ xs ]ℕ + [ ys ]ℕ)) ⟩
1 + (2 + 2 * ([ xs ]ℕ + [ ys ]ℕ))
≡⟨ cong (λ x → 1 + (2 + x)) (distrib-left-*-+ 2 [ xs ]ℕ [ ys ]ℕ) ⟩
1 + (2 + 2 * [ xs ]ℕ + 2 * [ ys ]ℕ)
≡⟨ cong (λ x → 1 + (x + 2 * [ ys ]ℕ)) (+-comm 2 (2 * [ xs ]ℕ)) ⟩
1 + (2 * [ xs ]ℕ + 2 + 2 * [ ys ]ℕ)
≡⟨ cong suc (+-assoc (2 * [ xs ]ℕ) 2 (2 * [ ys ]ℕ)) ⟩
1 + (2 * [ xs ]ℕ + (2 + (2 * [ ys ]ℕ)))
∎
[]ℕ-+B-hom (two ∷ xs) (one ∷ ys) =
begin
suc (2 * [ incrB (xs +B ys) ]ℕ)
≡⟨ cong (λ x → suc (2 * x)) ([]ℕ-incrB-hom (xs +B ys)) ⟩
suc (2 * suc [ xs +B ys ]ℕ)
≡⟨ cong (λ x → suc (2 * suc x)) ([]ℕ-+B-hom xs ys) ⟩
suc (2 * suc ([ xs ]ℕ + [ ys ]ℕ))
≡⟨ cong suc (+-*-suc 2 ([ xs ]ℕ + [ ys ]ℕ)) ⟩
suc (2 + 2 * ([ xs ]ℕ + [ ys ]ℕ))
≡⟨ cong (λ x → suc (2 + x)) (distrib-left-*-+ 2 [ xs ]ℕ [ ys ]ℕ) ⟩
suc (2 + 2 * [ xs ]ℕ + 2 * [ ys ]ℕ)
≡⟨ cong (λ x → suc (suc x)) (sym (+-suc (2 * [ xs ]ℕ) (2 * [ ys ]ℕ))) ⟩
suc (suc (2 * [ xs ]ℕ + suc (2 * [ ys ]ℕ)))
∎
[]ℕ-+B-hom (two ∷ xs) (two ∷ ys) =
begin
2 + (2 * [ incrB (xs +B ys) ]ℕ)
≡⟨ cong (λ x → 2 + (2 * x)) ([]ℕ-incrB-hom (xs +B ys)) ⟩
2 + (2 * suc [ xs +B ys ]ℕ)
≡⟨ cong (λ x → 2 + 2 * suc x) ([]ℕ-+B-hom xs ys) ⟩
2 + (2 * suc ([ xs ]ℕ + [ ys ]ℕ))
≡⟨ cong (λ x → 2 + x) (+-*-suc 2 ([ xs ]ℕ + [ ys ]ℕ)) ⟩
2 + (2 + 2 * ([ xs ]ℕ + [ ys ]ℕ))
≡⟨ cong (λ x → 2 + (2 + x)) (distrib-left-*-+ 2 [ xs ]ℕ [ ys ]ℕ) ⟩
2 + (2 + 2 * [ xs ]ℕ + 2 * [ ys ]ℕ)
≡⟨ cong (λ x → 2 + (x + 2 * [ ys ]ℕ)) (+-comm 2 (2 * [ xs ]ℕ)) ⟩
2 + (2 * [ xs ]ℕ + 2 + 2 * [ ys ]ℕ)
≡⟨ cong (λ x → 2 + x) (+-assoc (2 * [ xs ]ℕ) 2 (2 * [ ys ]ℕ)) ⟩
2 + (2 * [ xs ]ℕ + (2 + 2 * [ ys ]ℕ))
∎
[]ℕ-*2-hom : ∀ xs → [ *2 xs ]ℕ ≡ 2 * [ xs ]ℕ
[]ℕ-*2-hom [] = refl
[]ℕ-*2-hom (one ∷ xs) =
begin
2 + 2 * [ *2 xs ]ℕ
≡⟨ cong (λ x → 2 + 2 * x) ([]ℕ-*2-hom xs) ⟩
2 + 2 * (2 * [ xs ]ℕ)
≡⟨ cong suc (sym (+-suc (2 * [ xs ]ℕ) (2 * [ xs ]ℕ + zero))) ⟩
suc (2 * [ xs ]ℕ + suc (2 * [ xs ]ℕ + zero))
∎
[]ℕ-*2-hom (two ∷ xs) =
begin
2 + 2 * [ incrB (*2 xs) ]ℕ
≡⟨ cong (λ x → 2 + 2 * x) ([]ℕ-incrB-hom (*2 xs)) ⟩
2 + 2 * suc [ *2 xs ]ℕ
≡⟨ cong (λ x → 2 + 2 * suc x) ([]ℕ-*2-hom xs) ⟩
2 + 2 * suc (2 * [ xs ]ℕ)
≡⟨ cong (λ x → 2 + x) (sym (+-suc (2 * [ xs ]ℕ) (suc (2 * [ xs ]ℕ + zero)))) ⟩
2 + (2 * [ xs ]ℕ + suc (suc (2 * [ xs ]ℕ + zero)))
∎
[[]B]ℕ-id : ∀ n → [ [ n ]B ]ℕ ≡ n
[[]B]ℕ-id zero = refl
[[]B]ℕ-id (suc n) =
begin
[ incrB [ n ]B ]ℕ
≡⟨ []ℕ-incrB-hom [ n ]B ⟩
suc [ [ n ]B ]ℕ
≡⟨ cong suc ([[]B]ℕ-id n) ⟩
suc n
∎
[]ℕ-kernal : ∀ xs → [ xs ]ℕ ≡ 0 → xs ≡ []
[]ℕ-kernal [] pf = refl
[]ℕ-kernal (one ∷ xs) pf = contradiction pf (λ ())
[]ℕ-kernal (two ∷ xs) pf = contradiction pf (λ ())
[]ℕ-surjective : ∀ (x : ℕ) → ∃ (λ y → [ y ]ℕ ≡ x)
[]ℕ-surjective n = [ n ]B , [[]B]ℕ-id n
{-
[]ℕ-injective : ∀ x y → [ x ]ℕ ≡ [ y ]ℕ → x ≡ y
[]ℕ-injective [] [] pf = refl
[]ℕ-injective [] (y ∷ ys) pf = sym ([]ℕ-kernal (y ∷ ys) (sym pf))
[]ℕ-injective (x ∷ xs) [] pf = []ℕ-kernal (x ∷ xs) pf
[]ℕ-injective (one ∷ xs) (one ∷ ys) pf =
begin
one ∷ xs
≡⟨ cong (λ x → one ∷ x) ([]ℕ-injective xs ys {! !}) ⟩
one ∷ ys
∎
--let pf0 = trans pf (cong (λ x → 1 + 2 * x) {! !})
--in {! !}
[]ℕ-injective (one ∷ xs) (two ∷ ys) pf = {! !}
[]ℕ-injective (two ∷ xs) (y ∷ ys) pf = {! !}
-}
{-
begin
{! !}
≡⟨ {! !} ⟩
{! !}
≡⟨ {! !} ⟩
{! !}
≡⟨ {! !} ⟩
{! !}
≡⟨ {! !} ⟩
{! !}
∎
-}
|
Palmtree.Math.Core.Implements/vs_build/x86_Debug/TEST_op_ModPow.asm | rougemeilland/Palmtree.Math.Core.Implements | 0 | 176682 | <gh_stars>0
; Listing generated by Microsoft (R) Optimizing Compiler Version 19.16.27026.1
TITLE Z:\Sources\Lunor\Repos\rougemeilland\Palmtree.Math.Core.Implements\Palmtree.Math.Core.Implements\TEST_op_ModPow.c
.686P
.XMM
include listing.inc
.model flat
INCLUDELIB MSVCRTD
INCLUDELIB OLDNAMES
msvcjmc SEGMENT
__7B7A869E_ctype@h DB 01H
__457DD326_basetsd@h DB 01H
__4384A2D9_corecrt_memcpy_s@h DB 01H
__4E51A221_corecrt_wstring@h DB 01H
__2140C079_string@h DB 01H
__1887E595_winnt@h DB 01H
__9FC7C64B_processthreadsapi@h DB 01H
__FA470AEC_memoryapi@h DB 01H
__F37DAFF1_winerror@h DB 01H
__7A450CCC_winbase@h DB 01H
__B4B40122_winioctl@h DB 01H
__86261D59_stralign@h DB 01H
__1C66ECB2_pmc_debug@h DB 01H
__D6457698_test_op_modpow@c DB 01H
msvcjmc ENDS
PUBLIC _TEST_PMC_ModPow_X_X_X
PUBLIC __JustMyCode_Default
EXTRN _TEST_Assert:PROC
EXTRN _FormatTestLabel:PROC
EXTRN _FormatTestMesssage:PROC
EXTRN @_RTC_CheckStackVars@8:PROC
EXTRN @__CheckForDebuggerJustMyCode@4:PROC
EXTRN @__security_check_cookie@4:PROC
EXTRN __RTC_CheckEsp:PROC
EXTRN __RTC_InitBase:PROC
EXTRN __RTC_Shutdown:PROC
EXTRN ___security_cookie:DWORD
; COMDAT rtc$TMZ
rtc$TMZ SEGMENT
__RTC_Shutdown.rtc$TMZ DD FLAT:__RTC_Shutdown
rtc$TMZ ENDS
; COMDAT rtc$IMZ
rtc$IMZ SEGMENT
__RTC_InitBase.rtc$IMZ DD FLAT:__RTC_InitBase
rtc$IMZ ENDS
_DATA SEGMENT
$SG94562 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'F', 00H, 'r', 00H
DB 'o', 00H, 'm', 00H, 'B', 00H, 'y', 00H, 't', 00H, 'e', 00H, 'A'
DB 00H, 'r', 00H, 'r', 00H, 'a', 00H, 'y', 00H, 'n0', 0a9H, '_0^', 0b3H
DB '0', 0fcH, '0', 0c9H, '0L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH
DB '0g0o0j0D0(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94563 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94564 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'F', 00H, 'r', 00H
DB 'o', 00H, 'm', 00H, 'B', 00H, 'y', 00H, 't', 00H, 'e', 00H, 'A'
DB 00H, 'r', 00H, 'r', 00H, 'a', 00H, 'y', 00H, 'n0', 0a9H, '_0^', 0b3H
DB '0', 0fcH, '0', 0c9H, '0L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH
DB '0g0o0j0D0(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94565 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94566 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'F', 00H, 'r', 00H
DB 'o', 00H, 'm', 00H, 'B', 00H, 'y', 00H, 't', 00H, 'e', 00H, 'A'
DB 00H, 'r', 00H, 'r', 00H, 'a', 00H, 'y', 00H, 'n0', 0a9H, '_0^', 0b3H
DB '0', 0fcH, '0', 0c9H, '0L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH
DB '0g0o0j0D0(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94567 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94568 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, 'n0', 0a9H, '_0^', 0b3H, '0'
DB 0fcH, '0', 0c9H, '0L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH
DB '0g0o0j0D0(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
$SG94569 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+6
$SG94571 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'T', 00H, 'o', 00H
DB 'B', 00H, 'y', 00H, 't', 00H, 'e', 00H, 'A', 00H, 'r', 00H, 'r'
DB 00H, 'a', 00H, 'y', 00H, 'n0', 0a9H, '_0^', 0b3H, '0', 0fcH, '0'
DB 0c9H, '0L0', 01fH, 'g', 085H, '_', 01aH, 090H, 08aH, '0g0o0j0D'
DB '0(', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94572 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
ORG $+2
$SG94573 DB 0c7H, '0', 0fcH, '0', 0bfH, '0n0', 085H, 'Q', 0b9H, '[L0', 00H
DB 'N', 0f4H, 081H, 'W0j0D0', 00H, 00H
ORG $+2
$SG94574 DB 'P', 00H, 'M', 00H, 'C', 00H, '_', 00H, 'M', 00H, 'o', 00H
DB 'd', 00H, 'P', 00H, 'o', 00H, 'w', 00H, '_', 00H, 'X', 00H, '_'
DB 00H, 'X', 00H, '_', 00H, 'X', 00H, ' ', 00H, '(', 00H, '%', 00H
DB 'd', 00H, '.', 00H, '%', 00H, 'd', 00H, ')', 00H, 00H, 00H
_DATA ENDS
; Function compile flags: /Odt
; COMDAT __JustMyCode_Default
_TEXT SEGMENT
__JustMyCode_Default PROC ; COMDAT
push ebp
mov ebp, esp
pop ebp
ret 0
__JustMyCode_Default ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\pmc_debug.h
_TEXT SEGMENT
_buffer1$ = 8 ; size = 4
_count1$ = 12 ; size = 4
_buffer2$ = 16 ; size = 4
_count2$ = 20 ; size = 4
__EQUALS_MEMORY PROC
; 155 : {
push ebp
mov ebp, esp
mov ecx, OFFSET __1C66ECB2_pmc_debug@h
call @__CheckForDebuggerJustMyCode@4
; 156 : if (count1 != count2)
mov eax, DWORD PTR _count1$[ebp]
cmp eax, DWORD PTR _count2$[ebp]
je SHORT $LN2@EQUALS_MEM
; 157 : return (-1);
or eax, -1
jmp SHORT $LN1@EQUALS_MEM
$LN2@EQUALS_MEM:
; 158 : while (count1 > 0)
cmp DWORD PTR _count1$[ebp], 0
jbe SHORT $LN3@EQUALS_MEM
; 159 : {
; 160 : if (*buffer1 != *buffer2)
mov ecx, DWORD PTR _buffer1$[ebp]
movzx edx, BYTE PTR [ecx]
mov eax, DWORD PTR _buffer2$[ebp]
movzx ecx, BYTE PTR [eax]
cmp edx, ecx
je SHORT $LN5@EQUALS_MEM
; 161 : return (-1);
or eax, -1
jmp SHORT $LN1@EQUALS_MEM
$LN5@EQUALS_MEM:
; 162 : ++buffer1;
mov edx, DWORD PTR _buffer1$[ebp]
add edx, 1
mov DWORD PTR _buffer1$[ebp], edx
; 163 : ++buffer2;
mov eax, DWORD PTR _buffer2$[ebp]
add eax, 1
mov DWORD PTR _buffer2$[ebp], eax
; 164 : --count1;
mov ecx, DWORD PTR _count1$[ebp]
sub ecx, 1
mov DWORD PTR _count1$[ebp], ecx
; 165 : }
jmp SHORT $LN2@EQUALS_MEM
$LN3@EQUALS_MEM:
; 166 : return (0);
xor eax, eax
$LN1@EQUALS_MEM:
; 167 : }
cmp ebp, esp
call __RTC_CheckEsp
pop ebp
ret 0
__EQUALS_MEMORY ENDP
_TEXT ENDS
; Function compile flags: /Odtp /RTCsu
; File z:\sources\lunor\repos\rougemeilland\palmtree.math.core.implements\palmtree.math.core.implements\test_op_modpow.c
_TEXT SEGMENT
tv196 = -372 ; size = 4
tv181 = -368 ; size = 4
tv161 = -364 ; size = 4
tv142 = -360 ; size = 4
tv92 = -356 ; size = 4
tv74 = -352 ; size = 4
_r_result$ = -348 ; size = 4
_m_result$ = -344 ; size = 4
_e_result$ = -340 ; size = 4
_v_result$ = -336 ; size = 4
_result$ = -332 ; size = 4
_actual_r_buf_size$ = -324 ; size = 4
_actual_r_buf$ = -312 ; size = 256
_r$ = -48 ; size = 4
_m$ = -36 ; size = 4
_e$ = -24 ; size = 4
_v$ = -12 ; size = 4
__$ArrayPad$ = -4 ; size = 4
_env$ = 8 ; size = 4
_ep$ = 12 ; size = 4
_no$ = 16 ; size = 4
_v_buf$ = 20 ; size = 4
_v_buf_size$ = 24 ; size = 4
_e_buf$ = 28 ; size = 4
_e_buf_size$ = 32 ; size = 4
_m_buf$ = 36 ; size = 4
_m_buf_size$ = 40 ; size = 4
_desired_result_code$ = 44 ; size = 4
_desired_r_buf$ = 48 ; size = 4
_desired_r_buf_size$ = 52 ; size = 4
_TEST_PMC_ModPow_X_X_X PROC
; 40 : {
push ebp
mov ebp, esp
sub esp, 372 ; 00000174H
push esi
push edi
lea edi, DWORD PTR [ebp-372]
mov ecx, 93 ; 0000005dH
mov eax, -858993460 ; ccccccccH
rep stosd
mov eax, DWORD PTR ___security_cookie
xor eax, ebp
mov DWORD PTR __$ArrayPad$[ebp], eax
mov ecx, OFFSET __D6457698_test_op_modpow@c
call @__CheckForDebuggerJustMyCode@4
; 41 : HANDLE v;
; 42 : HANDLE e;
; 43 : HANDLE m;
; 44 : HANDLE r;
; 45 : unsigned char actual_r_buf[256];
; 46 : size_t actual_r_buf_size;
; 47 : PMC_STATUS_CODE result;
; 48 : PMC_STATUS_CODE v_result;
; 49 : PMC_STATUS_CODE e_result;
; 50 : PMC_STATUS_CODE m_result;
; 51 : PMC_STATUS_CODE r_result;
; 52 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 1), (v_result = ep->PMC_FromByteArray(v_buf, v_buf_size, &v)) == PMC_STATUS_OK, FormatTestMesssage(L"PMC_FromByteArrayの復帰コードが期待通りではない(%d)", v_result));
mov esi, esp
lea eax, DWORD PTR _v$[ebp]
push eax
mov ecx, DWORD PTR _v_buf_size$[ebp]
push ecx
mov edx, DWORD PTR _v_buf$[ebp]
push edx
mov eax, DWORD PTR _ep$[ebp]
mov ecx, DWORD PTR [eax+24]
call ecx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _v_result$[ebp], eax
cmp DWORD PTR _v_result$[ebp], 0
jne SHORT $LN8@TEST_PMC_M
mov DWORD PTR tv74[ebp], 1
jmp SHORT $LN9@TEST_PMC_M
$LN8@TEST_PMC_M:
mov DWORD PTR tv74[ebp], 0
$LN9@TEST_PMC_M:
mov edx, DWORD PTR _v_result$[ebp]
push edx
push OFFSET $SG94562
call _FormatTestMesssage
add esp, 8
push eax
mov eax, DWORD PTR tv74[ebp]
push eax
push 1
mov ecx, DWORD PTR _no$[ebp]
push ecx
push OFFSET $SG94563
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov edx, DWORD PTR _env$[ebp]
push edx
call _TEST_Assert
add esp, 16 ; 00000010H
; 53 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 2), (e_result = ep->PMC_FromByteArray(e_buf, e_buf_size, &e)) == PMC_STATUS_OK, FormatTestMesssage(L"PMC_FromByteArrayの復帰コードが期待通りではない(%d)", e_result));
mov esi, esp
lea eax, DWORD PTR _e$[ebp]
push eax
mov ecx, DWORD PTR _e_buf_size$[ebp]
push ecx
mov edx, DWORD PTR _e_buf$[ebp]
push edx
mov eax, DWORD PTR _ep$[ebp]
mov ecx, DWORD PTR [eax+24]
call ecx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _e_result$[ebp], eax
cmp DWORD PTR _e_result$[ebp], 0
jne SHORT $LN10@TEST_PMC_M
mov DWORD PTR tv92[ebp], 1
jmp SHORT $LN11@TEST_PMC_M
$LN10@TEST_PMC_M:
mov DWORD PTR tv92[ebp], 0
$LN11@TEST_PMC_M:
mov edx, DWORD PTR _e_result$[ebp]
push edx
push OFFSET $SG94564
call _FormatTestMesssage
add esp, 8
push eax
mov eax, DWORD PTR tv92[ebp]
push eax
push 2
mov ecx, DWORD PTR _no$[ebp]
push ecx
push OFFSET $SG94565
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov edx, DWORD PTR _env$[ebp]
push edx
call _TEST_Assert
add esp, 16 ; 00000010H
; 54 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 3), (m_result = ep->PMC_FromByteArray(m_buf, m_buf_size, &m)) == PMC_STATUS_OK, FormatTestMesssage(L"PMC_FromByteArrayの復帰コードが期待通りではない(%d)", m_result));
mov esi, esp
lea eax, DWORD PTR _m$[ebp]
push eax
mov ecx, DWORD PTR _m_buf_size$[ebp]
push ecx
mov edx, DWORD PTR _m_buf$[ebp]
push edx
mov eax, DWORD PTR _ep$[ebp]
mov ecx, DWORD PTR [eax+24]
call ecx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _m_result$[ebp], eax
cmp DWORD PTR _m_result$[ebp], 0
jne SHORT $LN12@TEST_PMC_M
mov DWORD PTR tv142[ebp], 1
jmp SHORT $LN13@TEST_PMC_M
$LN12@TEST_PMC_M:
mov DWORD PTR tv142[ebp], 0
$LN13@TEST_PMC_M:
mov edx, DWORD PTR _m_result$[ebp]
push edx
push OFFSET $SG94566
call _FormatTestMesssage
add esp, 8
push eax
mov eax, DWORD PTR tv142[ebp]
push eax
push 3
mov ecx, DWORD PTR _no$[ebp]
push ecx
push OFFSET $SG94567
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov edx, DWORD PTR _env$[ebp]
push edx
call _TEST_Assert
add esp, 16 ; 00000010H
; 55 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 4), (r_result = ep->PMC_ModPow_X_X_X(v, e, m, &r)) == desired_result_code, FormatTestMesssage(L"PMC_ModPow_X_X_Xの復帰コードが期待通りではない(%d)", r_result));
mov esi, esp
lea eax, DWORD PTR _r$[ebp]
push eax
mov ecx, DWORD PTR _m$[ebp]
push ecx
mov edx, DWORD PTR _e$[ebp]
push edx
mov eax, DWORD PTR _v$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+272]
call edx
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _r_result$[ebp], eax
mov eax, DWORD PTR _r_result$[ebp]
cmp eax, DWORD PTR _desired_result_code$[ebp]
jne SHORT $LN14@TEST_PMC_M
mov DWORD PTR tv161[ebp], 1
jmp SHORT $LN15@TEST_PMC_M
$LN14@TEST_PMC_M:
mov DWORD PTR tv161[ebp], 0
$LN15@TEST_PMC_M:
mov ecx, DWORD PTR _r_result$[ebp]
push ecx
push OFFSET $SG94568
call _FormatTestMesssage
add esp, 8
push eax
mov edx, DWORD PTR tv161[ebp]
push edx
push 4
mov eax, DWORD PTR _no$[ebp]
push eax
push OFFSET $SG94569
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov ecx, DWORD PTR _env$[ebp]
push ecx
call _TEST_Assert
add esp, 16 ; 00000010H
; 56 : if (desired_result_code == PMC_STATUS_OK)
cmp DWORD PTR _desired_result_code$[ebp], 0
jne $LN2@TEST_PMC_M
; 57 : {
; 58 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 5), (result = ep->PMC_ToByteArray(r, actual_r_buf, sizeof(actual_r_buf), &actual_r_buf_size)) == PMC_STATUS_OK, FormatTestMesssage(L"PMC_ToByteArrayの復帰コードが期待通りではない(%d)", result));
mov esi, esp
lea edx, DWORD PTR _actual_r_buf_size$[ebp]
push edx
push 256 ; 00000100H
lea eax, DWORD PTR _actual_r_buf$[ebp]
push eax
mov ecx, DWORD PTR _r$[ebp]
push ecx
mov edx, DWORD PTR _ep$[ebp]
mov eax, DWORD PTR [edx+28]
call eax
cmp esi, esp
call __RTC_CheckEsp
mov DWORD PTR _result$[ebp], eax
cmp DWORD PTR _result$[ebp], 0
jne SHORT $LN16@TEST_PMC_M
mov DWORD PTR tv181[ebp], 1
jmp SHORT $LN17@TEST_PMC_M
$LN16@TEST_PMC_M:
mov DWORD PTR tv181[ebp], 0
$LN17@TEST_PMC_M:
mov ecx, DWORD PTR _result$[ebp]
push ecx
push OFFSET $SG94571
call _FormatTestMesssage
add esp, 8
push eax
mov edx, DWORD PTR tv181[ebp]
push edx
push 5
mov eax, DWORD PTR _no$[ebp]
push eax
push OFFSET $SG94572
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov ecx, DWORD PTR _env$[ebp]
push ecx
call _TEST_Assert
add esp, 16 ; 00000010H
; 59 : TEST_Assert(env, FormatTestLabel(L"PMC_ModPow_X_X_X (%d.%d)", no, 6), _EQUALS_MEMORY(actual_r_buf, actual_r_buf_size, desired_r_buf, desired_r_buf_size) == 0, L"データの内容が一致しない");
mov edx, DWORD PTR _desired_r_buf_size$[ebp]
push edx
mov eax, DWORD PTR _desired_r_buf$[ebp]
push eax
mov ecx, DWORD PTR _actual_r_buf_size$[ebp]
push ecx
lea edx, DWORD PTR _actual_r_buf$[ebp]
push edx
call __EQUALS_MEMORY
add esp, 16 ; 00000010H
test eax, eax
jne SHORT $LN18@TEST_PMC_M
mov DWORD PTR tv196[ebp], 1
jmp SHORT $LN19@TEST_PMC_M
$LN18@TEST_PMC_M:
mov DWORD PTR tv196[ebp], 0
$LN19@TEST_PMC_M:
push OFFSET $SG94573
mov eax, DWORD PTR tv196[ebp]
push eax
push 6
mov ecx, DWORD PTR _no$[ebp]
push ecx
push OFFSET $SG94574
call _FormatTestLabel
add esp, 12 ; 0000000cH
push eax
mov edx, DWORD PTR _env$[ebp]
push edx
call _TEST_Assert
add esp, 16 ; 00000010H
$LN2@TEST_PMC_M:
; 60 : }
; 61 : if (r_result == PMC_STATUS_OK)
cmp DWORD PTR _r_result$[ebp], 0
jne SHORT $LN3@TEST_PMC_M
; 62 : ep->PMC_Dispose(r);
mov esi, esp
mov eax, DWORD PTR _r$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+16]
call edx
cmp esi, esp
call __RTC_CheckEsp
$LN3@TEST_PMC_M:
; 63 : if (m_result == PMC_STATUS_OK)
cmp DWORD PTR _m_result$[ebp], 0
jne SHORT $LN4@TEST_PMC_M
; 64 : ep->PMC_Dispose(m);
mov esi, esp
mov eax, DWORD PTR _m$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+16]
call edx
cmp esi, esp
call __RTC_CheckEsp
$LN4@TEST_PMC_M:
; 65 : if (e_result == PMC_STATUS_OK)
cmp DWORD PTR _e_result$[ebp], 0
jne SHORT $LN5@TEST_PMC_M
; 66 : ep->PMC_Dispose(e);
mov esi, esp
mov eax, DWORD PTR _e$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+16]
call edx
cmp esi, esp
call __RTC_CheckEsp
$LN5@TEST_PMC_M:
; 67 : if (v_result == PMC_STATUS_OK)
cmp DWORD PTR _v_result$[ebp], 0
jne SHORT $LN1@TEST_PMC_M
; 68 : ep->PMC_Dispose(v);
mov esi, esp
mov eax, DWORD PTR _v$[ebp]
push eax
mov ecx, DWORD PTR _ep$[ebp]
mov edx, DWORD PTR [ecx+16]
call edx
cmp esi, esp
call __RTC_CheckEsp
$LN1@TEST_PMC_M:
; 69 : }
push edx
mov ecx, ebp
push eax
lea edx, DWORD PTR $LN27@TEST_PMC_M
call @_RTC_CheckStackVars@8
pop eax
pop edx
pop edi
pop esi
mov ecx, DWORD PTR __$ArrayPad$[ebp]
xor ecx, ebp
call @__security_check_cookie@4
add esp, 372 ; 00000174H
cmp ebp, esp
call __RTC_CheckEsp
mov esp, ebp
pop ebp
ret 0
npad 1
$LN27@TEST_PMC_M:
DD 6
DD $LN26@TEST_PMC_M
$LN26@TEST_PMC_M:
DD -12 ; fffffff4H
DD 4
DD $LN20@TEST_PMC_M
DD -24 ; ffffffe8H
DD 4
DD $LN21@TEST_PMC_M
DD -36 ; ffffffdcH
DD 4
DD $LN22@TEST_PMC_M
DD -48 ; ffffffd0H
DD 4
DD $LN23@TEST_PMC_M
DD -312 ; fffffec8H
DD 256 ; 00000100H
DD $LN24@TEST_PMC_M
DD -324 ; fffffebcH
DD 4
DD $LN25@TEST_PMC_M
$LN25@TEST_PMC_M:
DB 97 ; 00000061H
DB 99 ; 00000063H
DB 116 ; 00000074H
DB 117 ; 00000075H
DB 97 ; 00000061H
DB 108 ; 0000006cH
DB 95 ; 0000005fH
DB 114 ; 00000072H
DB 95 ; 0000005fH
DB 98 ; 00000062H
DB 117 ; 00000075H
DB 102 ; 00000066H
DB 95 ; 0000005fH
DB 115 ; 00000073H
DB 105 ; 00000069H
DB 122 ; 0000007aH
DB 101 ; 00000065H
DB 0
$LN24@TEST_PMC_M:
DB 97 ; 00000061H
DB 99 ; 00000063H
DB 116 ; 00000074H
DB 117 ; 00000075H
DB 97 ; 00000061H
DB 108 ; 0000006cH
DB 95 ; 0000005fH
DB 114 ; 00000072H
DB 95 ; 0000005fH
DB 98 ; 00000062H
DB 117 ; 00000075H
DB 102 ; 00000066H
DB 0
$LN23@TEST_PMC_M:
DB 114 ; 00000072H
DB 0
$LN22@TEST_PMC_M:
DB 109 ; 0000006dH
DB 0
$LN21@TEST_PMC_M:
DB 101 ; 00000065H
DB 0
$LN20@TEST_PMC_M:
DB 118 ; 00000076H
DB 0
_TEST_PMC_ModPow_X_X_X ENDP
_TEXT ENDS
END
|
regtests/are-generator-go-tests.adb | stcarrez/resource-embedder | 7 | 460 | <filename>regtests/are-generator-go-tests.adb<gh_stars>1-10
-----------------------------------------------------------------------
-- are-generator-go-tests -- Tests for Go generator
-- Copyright (C) 2021 <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.Directories;
with Util.Files;
with Util.Test_Caller;
package body Are.Generator.Go.Tests is
Expect_Dir : constant String := "regtests/expect/go/";
function Tool return String;
package Caller is new Util.Test_Caller (Test, "Are.Generator.Go");
function Tool return String is
begin
return "bin/are" & Are.Testsuite.EXE;
end Tool;
procedure Add_Tests (Suite : in Util.Tests.Access_Test_Suite) is
begin
Caller.Add_Test (Suite, "Test Are.Generate_Go1",
Test_Generate_Go1'Access);
Caller.Add_Test (Suite, "Test Are.Generate_Go2",
Test_Generate_Go2'Access);
Caller.Add_Test (Suite, "Test Are.Generate_Go3",
Test_Generate_Go3'Access);
end Add_Tests;
procedure Test_Generate_Go1 (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Target : constant String := Util.Files.Compose (Dir, "resources1/resources1.go");
Web : constant String := "regtests/files/test-c-1/web";
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the resources1.go file
T.Execute (Tool & " --lang=go -o " & Dir
& " --name-access --resource=Resources1 --fileset '**/*' "
& Web, Result);
T.Assert (Ada.Directories.Exists (Target),
"Resource file 'resources1/resources1.go' not generated");
Are.Testsuite.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "resources1.go"),
Test => Target,
Message => "Invalid Go generation");
end Test_Generate_Go1;
procedure Test_Generate_Go2 (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Target : constant String := Util.Files.Compose (Dir, "resources2/resources2.go");
Web : constant String := "regtests/files/test-ada-2";
Rule : constant String := "regtests/files/test-ada-2/package.xml";
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the resources1.go file
T.Execute (Tool & " --lang=go -o " & Dir & " --name-access --rule=" & Rule
& " " & Web, Result);
T.Assert (Ada.Directories.Exists (Target),
"Resource file 'resources2/resources2.go' not generated");
Are.Testsuite.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "resources2.go"),
Test => Target,
Message => "Invalid Go generation");
end Test_Generate_Go2;
procedure Test_Generate_Go3 (T : in out Test) is
Dir : constant String := Util.Tests.Get_Test_Path ("");
Target : constant String := Util.Files.Compose (Dir, "resource4/resource4.go");
Web : constant String := "regtests/files/test-ada-4";
Rule : constant String := "regtests/files/test-ada-4/package.xml";
Result : Ada.Strings.Unbounded.Unbounded_String;
begin
-- Generate the resources1.go file
T.Execute (Tool & " --lang=go -o " & Dir & " --name-access --rule=" & Rule
& " " & Web, Result);
T.Assert (Ada.Directories.Exists (Target),
"Resource file 'resource4/resource4.go' not generated");
Are.Testsuite.Assert_Equal_Files
(T => T,
Expect => Util.Tests.Get_Path (Expect_Dir & "resource4.go"),
Test => Target,
Message => "Invalid Go generation");
end Test_Generate_Go3;
end Are.Generator.Go.Tests;
|
Cubical/HITs/SetTruncation/Properties.agda | ayberkt/cubical | 0 | 15323 | <reponame>ayberkt/cubical
{-
This file contains:
- Properties of set truncations
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.HITs.SetTruncation.Properties where
open import Cubical.HITs.SetTruncation.Base
open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Function
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Univalence
open import Cubical.Data.Sigma
private
variable
ℓ ℓ' : Level
A B C D : Type ℓ
rec : isSet B → (A → B) → ∥ A ∥₂ → B
rec Bset f ∣ x ∣₂ = f x
rec Bset f (squash₂ x y p q i j) =
Bset _ _ (cong (rec Bset f) p) (cong (rec Bset f) q) i j
rec2 : isSet C → (A → B → C) → ∥ A ∥₂ → ∥ B ∥₂ → C
rec2 Cset f ∣ x ∣₂ ∣ y ∣₂ = f x y
rec2 Cset f ∣ x ∣₂ (squash₂ y z p q i j) =
Cset _ _ (cong (rec2 Cset f ∣ x ∣₂) p) (cong (rec2 Cset f ∣ x ∣₂) q) i j
rec2 Cset f (squash₂ x y p q i j) z =
Cset _ _ (cong (λ a → rec2 Cset f a z) p) (cong (λ a → rec2 Cset f a z) q) i j
-- Old version:
-- rec2 Cset f = rec (isSetΠ λ _ → Cset) λ x → rec Cset (f x)
-- lemma 6.9.1 in HoTT book
elim : {B : ∥ A ∥₂ → Type ℓ}
(Bset : (x : ∥ A ∥₂) → isSet (B x))
(f : (a : A) → B (∣ a ∣₂))
(x : ∥ A ∥₂) → B x
elim Bset f ∣ a ∣₂ = f a
elim Bset f (squash₂ x y p q i j) =
isOfHLevel→isOfHLevelDep 2 Bset _ _
(cong (elim Bset f) p) (cong (elim Bset f) q) (squash₂ x y p q) i j
elim2 : {C : ∥ A ∥₂ → ∥ B ∥₂ → Type ℓ}
(Cset : ((x : ∥ A ∥₂) (y : ∥ B ∥₂) → isSet (C x y)))
(f : (a : A) (b : B) → C ∣ a ∣₂ ∣ b ∣₂)
(x : ∥ A ∥₂) (y : ∥ B ∥₂) → C x y
elim2 Cset f ∣ x ∣₂ ∣ y ∣₂ = f x y
elim2 Cset f ∣ x ∣₂ (squash₂ y z p q i j) =
isOfHLevel→isOfHLevelDep 2 (λ a → Cset ∣ x ∣₂ a) _ _
(cong (elim2 Cset f ∣ x ∣₂) p) (cong (elim2 Cset f ∣ x ∣₂) q) (squash₂ y z p q) i j
elim2 Cset f (squash₂ x y p q i j) z =
isOfHLevel→isOfHLevelDep 2 (λ a → Cset a z) _ _
(cong (λ a → elim2 Cset f a z) p) (cong (λ a → elim2 Cset f a z) q) (squash₂ x y p q) i j
-- Old version:
-- elim2 Cset f = elim (λ _ → isSetΠ (λ _ → Cset _ _))
-- (λ a → elim (λ _ → Cset _ _) (f a))
-- TODO: generalize
elim3 : {B : (x y z : ∥ A ∥₂) → Type ℓ}
(Bset : ((x y z : ∥ A ∥₂) → isSet (B x y z)))
(g : (a b c : A) → B ∣ a ∣₂ ∣ b ∣₂ ∣ c ∣₂)
(x y z : ∥ A ∥₂) → B x y z
elim3 Bset g = elim2 (λ _ _ → isSetΠ (λ _ → Bset _ _ _))
(λ a b → elim (λ _ → Bset _ _ _) (g a b))
map : (A → B) → ∥ A ∥₂ → ∥ B ∥₂
map f = rec squash₂ λ x → ∣ f x ∣₂
setTruncUniversal : isSet B → (∥ A ∥₂ → B) ≃ (A → B)
setTruncUniversal {B = B} Bset =
isoToEquiv (iso (λ h x → h ∣ x ∣₂) (rec Bset) (λ _ → refl) rinv)
where
rinv : (f : ∥ A ∥₂ → B) → rec Bset (λ x → f ∣ x ∣₂) ≡ f
rinv f i x =
elim (λ x → isProp→isSet (Bset (rec Bset (λ x → f ∣ x ∣₂) x) (f x)))
(λ _ → refl) x i
setTruncIsSet : isSet ∥ A ∥₂
setTruncIsSet a b p q = squash₂ a b p q
setTruncIdempotent≃ : isSet A → ∥ A ∥₂ ≃ A
setTruncIdempotent≃ {A = A} hA = isoToEquiv f
where
f : Iso ∥ A ∥₂ A
Iso.fun f = rec hA (idfun A)
Iso.inv f x = ∣ x ∣₂
Iso.rightInv f _ = refl
Iso.leftInv f = elim (λ _ → isSet→isGroupoid setTruncIsSet _ _) (λ _ → refl)
setTruncIdempotent : isSet A → ∥ A ∥₂ ≡ A
setTruncIdempotent hA = ua (setTruncIdempotent≃ hA)
isContr→isContrSetTrunc : isContr A → isContr (∥ A ∥₂)
isContr→isContrSetTrunc contr = ∣ fst contr ∣₂
, elim (λ _ → isOfHLevelPath 2 (setTruncIsSet) _ _)
λ a → cong ∣_∣₂ (snd contr a)
setTruncIso : Iso A B → Iso ∥ A ∥₂ ∥ B ∥₂
Iso.fun (setTruncIso is) = rec setTruncIsSet (λ x → ∣ Iso.fun is x ∣₂)
Iso.inv (setTruncIso is) = rec setTruncIsSet (λ x → ∣ Iso.inv is x ∣₂)
Iso.rightInv (setTruncIso is) =
elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ a → cong ∣_∣₂ (Iso.rightInv is a)
Iso.leftInv (setTruncIso is) =
elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ a → cong ∣_∣₂ (Iso.leftInv is a)
setSigmaIso : {B : A → Type ℓ} → Iso ∥ Σ A B ∥₂ ∥ Σ A (λ x → ∥ B x ∥₂) ∥₂
setSigmaIso {A = A} {B = B} = iso fun funinv sect retr
where
{- writing it out explicitly to avoid yellow highlighting -}
fun : ∥ Σ A B ∥₂ → ∥ Σ A (λ x → ∥ B x ∥₂) ∥₂
fun = rec setTruncIsSet λ {(a , p) → ∣ a , ∣ p ∣₂ ∣₂}
funinv : ∥ Σ A (λ x → ∥ B x ∥₂) ∥₂ → ∥ Σ A B ∥₂
funinv = rec setTruncIsSet (λ {(a , p) → rec setTruncIsSet (λ p → ∣ a , p ∣₂) p})
sect : section fun funinv
sect = elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ { (a , p) → elim {B = λ p → fun (funinv ∣ a , p ∣₂) ≡ ∣ a , p ∣₂}
(λ p → isOfHLevelPath 2 setTruncIsSet _ _) (λ _ → refl) p }
retr : retract fun funinv
retr = elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ { _ → refl }
sigmaElim : {B : ∥ A ∥₂ → Type ℓ} {C : Σ ∥ A ∥₂ B → Type ℓ'}
(Bset : (x : Σ ∥ A ∥₂ B) → isSet (C x))
(g : (a : A) (b : B ∣ a ∣₂) → C (∣ a ∣₂ , b))
(x : Σ ∥ A ∥₂ B) → C x
sigmaElim {B = B} {C = C} set g (x , y) =
elim {B = λ x → (y : B x) → C (x , y)} (λ _ → isSetΠ λ _ → set _) g x y
sigmaProdElim : {C : ∥ A ∥₂ × ∥ B ∥₂ → Type ℓ} {D : Σ (∥ A ∥₂ × ∥ B ∥₂) C → Type ℓ'}
(Bset : (x : Σ (∥ A ∥₂ × ∥ B ∥₂) C) → isSet (D x))
(g : (a : A) (b : B) (c : C (∣ a ∣₂ , ∣ b ∣₂)) → D ((∣ a ∣₂ , ∣ b ∣₂) , c))
(x : Σ (∥ A ∥₂ × ∥ B ∥₂) C) → D x
sigmaProdElim {B = B} {C = C} {D = D} set g ((x , y) , c) =
elim {B = λ x → (y : ∥ B ∥₂) (c : C (x , y)) → D ((x , y) , c)}
(λ _ → isSetΠ λ _ → isSetΠ λ _ → set _)
(λ x → elim (λ _ → isSetΠ λ _ → set _) (g x))
x y c
prodElim : {C : ∥ A ∥₂ × ∥ B ∥₂ → Type ℓ}
→ ((x : ∥ A ∥₂ × ∥ B ∥₂) → isSet (C x))
→ ((a : A) (b : B) → C (∣ a ∣₂ , ∣ b ∣₂))
→ (x : ∥ A ∥₂ × ∥ B ∥₂) → C x
prodElim setC f (a , b) = elim2 (λ x y → setC (x , y)) f a b
prodRec : {C : Type ℓ} → isSet C → (A → B → C) → ∥ A ∥₂ × ∥ B ∥₂ → C
prodRec setC f (a , b) = rec2 setC f a b
prodElim2 : {E : (∥ A ∥₂ × ∥ B ∥₂) → (∥ C ∥₂ × ∥ D ∥₂) → Type ℓ}
→ ((x : ∥ A ∥₂ × ∥ B ∥₂) (y : ∥ C ∥₂ × ∥ D ∥₂) → isSet (E x y))
→ ((a : A) (b : B) (c : C) (d : D) → E (∣ a ∣₂ , ∣ b ∣₂) (∣ c ∣₂ , ∣ d ∣₂))
→ ((x : ∥ A ∥₂ × ∥ B ∥₂) (y : ∥ C ∥₂ × ∥ D ∥₂) → (E x y))
prodElim2 isset f = prodElim (λ _ → isSetΠ λ _ → isset _ _)
λ a b → prodElim (λ _ → isset _ _)
λ c d → f a b c d
setTruncOfProdIso : Iso ∥ A × B ∥₂ (∥ A ∥₂ × ∥ B ∥₂)
Iso.fun setTruncOfProdIso = rec (isSet× setTruncIsSet setTruncIsSet) λ { (a , b) → ∣ a ∣₂ , ∣ b ∣₂ }
Iso.inv setTruncOfProdIso = prodRec setTruncIsSet λ a b → ∣ a , b ∣₂
Iso.rightInv setTruncOfProdIso =
prodElim (λ _ → isOfHLevelPath 2 (isSet× setTruncIsSet setTruncIsSet) _ _) λ _ _ → refl
Iso.leftInv setTruncOfProdIso =
elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _) λ {(a , b) → refl}
IsoSetTruncateSndΣ : {A : Type ℓ} {B : A → Type ℓ'} → Iso ∥ Σ A B ∥₂ ∥ Σ A (λ x → ∥ B x ∥₂) ∥₂
Iso.fun IsoSetTruncateSndΣ = map λ a → (fst a) , ∣ snd a ∣₂
Iso.inv IsoSetTruncateSndΣ = rec setTruncIsSet (uncurry λ x → map λ b → x , b)
Iso.rightInv IsoSetTruncateSndΣ =
elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
(uncurry λ a → elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ _ → refl)
Iso.leftInv IsoSetTruncateSndΣ =
elim (λ _ → isOfHLevelPath 2 setTruncIsSet _ _)
λ _ → refl
|
canonical-value-forms.agda | hazelgrove/hazelnut-dynamics-agda | 16 | 7687 | open import Nat
open import Prelude
open import contexts
open import core
module canonical-value-forms where
canonical-value-forms-b : ∀{Δ d} →
Δ , ∅ ⊢ d :: b →
d val →
d == c
canonical-value-forms-b TAConst VConst = refl
canonical-value-forms-b (TAVar x₁) ()
canonical-value-forms-b (TAAp wt wt₁) ()
canonical-value-forms-b (TAEHole x x₁) ()
canonical-value-forms-b (TANEHole x wt x₁) ()
canonical-value-forms-b (TACast wt x) ()
canonical-value-forms-b (TAFailedCast wt x x₁ x₂) ()
canonical-value-forms-arr : ∀{Δ d τ1 τ2} →
Δ , ∅ ⊢ d :: (τ1 ==> τ2) →
d val →
Σ[ x ∈ Nat ] Σ[ d' ∈ ihexp ]
((d == (·λ x [ τ1 ] d')) ×
(Δ , ■ (x , τ1) ⊢ d' :: τ2))
canonical-value-forms-arr (TAVar x₁) ()
canonical-value-forms-arr (TALam _ wt) VLam = _ , _ , refl , wt
canonical-value-forms-arr (TAAp wt wt₁) ()
canonical-value-forms-arr (TAEHole x x₁) ()
canonical-value-forms-arr (TANEHole x wt x₁) ()
canonical-value-forms-arr (TACast wt x) ()
canonical-value-forms-arr (TAFailedCast x x₁ x₂ x₃) ()
-- this argues (somewhat informally, because you still have to inspect
-- the types of the theorems above and manually verify this property)
-- that we didn't miss any cases above; this intentionally will make this
-- file fail to typecheck if we added more types, hopefully forcing us to
-- remember to add canonical forms lemmas as appropriate
canonical-value-forms-coverage1 : ∀{Δ d τ} →
Δ , ∅ ⊢ d :: τ →
d val →
τ ≠ b →
((τ1 : htyp) (τ2 : htyp) → τ ≠ (τ1 ==> τ2)) →
⊥
canonical-value-forms-coverage1 TAConst VConst = λ z _ → z refl
canonical-value-forms-coverage1 (TAVar x₁) ()
canonical-value-forms-coverage1 (TALam _ wt) VLam = λ _ z → z _ _ refl
canonical-value-forms-coverage1 (TAAp wt wt₁) ()
canonical-value-forms-coverage1 (TAEHole x x₁) ()
canonical-value-forms-coverage1 (TANEHole x wt x₁) ()
canonical-value-forms-coverage1 (TACast wt x) ()
canonical-value-forms-coverage1 (TAFailedCast wt x x₁ x₂) ()
canonical-value-forms-coverage2 : ∀{Δ d} →
Δ , ∅ ⊢ d :: ⦇-⦈ →
d val →
⊥
canonical-value-forms-coverage2 (TAVar x₁) ()
canonical-value-forms-coverage2 (TAAp wt wt₁) ()
canonical-value-forms-coverage2 (TAEHole x x₁) ()
canonical-value-forms-coverage2 (TANEHole x wt x₁) ()
canonical-value-forms-coverage2 (TACast wt x) ()
canonical-value-forms-coverage2 (TAFailedCast wt x x₁ x₂) ()
|
programs/oeis/138/A138402.asm | neoneye/loda | 22 | 1879 | ; A138402: a(n) = (n-th prime)^4-(n-th prime)^2.
; 12,72,600,2352,14520,28392,83232,129960,279312,706440,922560,1872792,2824080,3416952,4877472,7887672,12113880,13842120,20146632,25406640,28392912,38943840,47451432,62734320,88519872,104050200,112540272,131068152,141146280,163034592,260128512,294482760,352256592,373281720,492862200,519862800,607548552,705885192,777768432,895715112,1026593640,1073250360,1330826880,1387450752,1506099672,1568199600,1982074920,2472923712,2655186312,2750006040,2947241232,3262751520,3373344480,3969063000,4362404352,4784281392,5236041960,5393507040,5887262712,6234760560,6414167832,7369964952,8882779752,9354855120,9597826992,10097938632,12003503160,12897804192,14498206872,14835361800,15527278272,16610183280,18140992032,19356739512,20632593240,21517516032,22897893720,24840439272,25856800800,27982765680,30821489160,31414194840,34506963360,35151937632,37141191120,38513473752,40642761600,43617695952,45164962920,45953853792,47562593832,52642943040,56248897392,58119807480,62001249000,64013301072,67122705480,73679945040,74817840312,85661875080
seq $0,6005 ; The odd prime numbers together with 1.
pow $0,2
max $0,4
bin $0,2
div $0,6
mul $0,12
|
ejercicios6/prueba_interseccion.adb | iyan22/AprendeAda | 0 | 9818 | <filename>ejercicios6/prueba_interseccion.adb
with Ada.Text_Io, Datos;
with Crear_Lista_Vacia, Esc, Ins, Interseccion;
use Datos;
use Ada.Text_Io;
procedure Prueba_Interseccion is
Lis1, Lis2 : Lista; -- variables del programa principal
procedure Pedir_Return is
begin
Put_Line("pulsa return para continuar ");
Skip_Line;
end Pedir_Return;
begin -- programa principal
-- Casos de prueba:
-- 1. Dos listas vacias.
-- 2. Una lista vacia y la otra no.
-- 3. Listas de un solo elemento que es comun.
-- 4. Listas de un solo elemento que es distinto.
-- 5. Listas de varios elementos.
-- 5.1. Listas de varios elementos. Elementos comunes
-- 5.2. Listas de varios elementos. Elementos disjuntos
Put_Line("Programa de prueba: ");
Put_Line("*********");
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Put_Line("Caso de prueba 1: Listas vacias ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista vacia: ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Ins(Lis1, 3);
Ins(Lis1, 5);
Put_Line("Caso de prueba 2: Una lista vacia y la otra no. ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista vacia: ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Ins(Lis1, 3);
Ins(Lis2, 3);
Put_Line("Caso de prueba 3: Listas de un solo elemento que es comun. ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista <3> ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Ins(Lis1, 3);
Ins(Lis2, 5);
Put_Line("Caso de prueba 4: Listas de un solo elemento que es distinto. ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista <> ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Ins(Lis1, 3);
Ins(Lis1, 5);
Ins(Lis1, 7);
Ins(Lis1, 9);
Ins(Lis2, 5);
Ins(Lis2, 9);
Put_Line("Caso de prueba 5.1: Listas de varios elementos. Elementos comunes. ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista <9, 5> ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Crear_Lista_Vacia(Lis1);
Crear_Lista_Vacia(Lis2);
Ins(Lis1, 3);
Ins(Lis1, 5);
Ins(Lis1, 7);
Ins(Lis1, 9);
Ins(Lis2, 11);
Ins(Lis2, 13);
Put_Line("Caso de prueba 5.2: Listas de varios elementos. Elementos disjuntos. ");
Put_Line("Las listas iniciales contienen ");
Esc(Lis1);
Esc(Lis2);
Put_Line("Ahora deberia escribir la lista <> ");
Esc(Interseccion(Lis1, Lis2));
New_Line;
New_Line;
Pedir_Return;
Put_Line("Se acabo la prueba. Agur ");
end Prueba_Interseccion;
|
programs/oeis/021/A021067.asm | jmorken/loda | 1 | 99182 | <filename>programs/oeis/021/A021067.asm<gh_stars>1-10
; A021067: Decimal expansion of 1/63.
; 0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5,8,7,3,0,1,5
mov $2,3
lpb $0
sub $0,1
add $2,4
sub $2,$1
add $1,$2
sub $1,6
lpe
|
coms/basic/decodeLEB128.asm | yunxu1019/efront | 1 | 102508 | <reponame>yunxu1019/efront
decodeLEB128 proc srcstart,srcsize,dststart
local temp,delta,b,dstsize
local srcend
mov eax,10009h
mov ecx,srcstart
mov eax,ecx
mov ebx,srcsize
add eax,ebx
mov edx,eax
mov temp,0
mov dstsize,0
.while ecx <edx
mov ebx,0
mov bl,BYTE ptr[ecx]
mov b,ebx
and ebx,07fh
push ecx
mov ecx,delta
shl ebx,cl
pop ecx
inc ecx
mov eax,temp
or eax,ebx
mov temp,eax
mov ebx,b
shr ebx,7
.if ebx
mov ebx,delta
add ebx,7
mov delta,ebx
.continue
.endif
mov ebx,dststart
add ebx,dstsize
mov DWORD ptr [ebx],eax
mov ebx,dstsize
add ebx,4
mov dstsize,ebx
mov temp,0
mov delta,0
.endw
mov eax,dstsize
shr eax,2
ret
decodeLEB128 endp
|
oeis/014/A014771.asm | neoneye/loda-programs | 11 | 19396 | <reponame>neoneye/loda-programs<filename>oeis/014/A014771.asm
; A014771: Squares of odd hexagonal numbers.
; 1,225,2025,8281,23409,53361,105625,189225,314721,494209,741321,1071225,1500625,2047761,2732409,3575881,4601025,5832225,7295401,9018009,11029041,13359025,16040025,19105641,22591009,26532801,30969225,35940025,41486481,47651409,54479161,62015625,70308225,79405921,89359209,100220121,112042225,124880625,138791961,153834409,170067681,187553025,206353225,226532601,248157009,271293841,296012025,322382025,350475841,380367009,412130601,445843225,481583025,519429681,559464409,601769961,646430625,693532225
mul $0,4
add $0,2
bin $0,2
pow $0,2
|
wc.asm | ShwetiMahajan/xv6_schedulersOS | 0 | 6555 |
_wc: file format elf32-i386
Disassembly of section .text:
00000000 <wc>:
char buf[512];
void
wc(int fd, char *name)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 57 push %edi
4: 31 ff xor %edi,%edi
6: 56 push %esi
7: 31 f6 xor %esi,%esi
9: 53 push %ebx
a: 83 ec 3c sub $0x3c,%esp
d: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
14: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
1b: 90 nop
1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
int i, n;
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
20: 8b 45 08 mov 0x8(%ebp),%eax
23: c7 44 24 08 00 02 00 movl $0x200,0x8(%esp)
2a: 00
2b: c7 44 24 04 e0 08 00 movl $0x8e0,0x4(%esp)
32: 00
33: 89 04 24 mov %eax,(%esp)
36: e8 a5 03 00 00 call 3e0 <read>
3b: 83 f8 00 cmp $0x0,%eax
3e: 89 45 e4 mov %eax,-0x1c(%ebp)
41: 7e 4f jle 92 <wc+0x92>
43: 31 db xor %ebx,%ebx
45: eb 0b jmp 52 <wc+0x52>
47: 90 nop
for(i=0; i<n; i++){
c++;
if(buf[i] == '\n')
l++;
if(strchr(" \r\t\n\v", buf[i]))
48: 31 ff xor %edi,%edi
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
4a: 83 c3 01 add $0x1,%ebx
4d: 39 5d e4 cmp %ebx,-0x1c(%ebp)
50: 7e 38 jle 8a <wc+0x8a>
c++;
if(buf[i] == '\n')
52: 0f be 83 e0 08 00 00 movsbl 0x8e0(%ebx),%eax
l++;
59: 31 d2 xor %edx,%edx
if(strchr(" \r\t\n\v", buf[i]))
5b: c7 04 24 66 08 00 00 movl $0x866,(%esp)
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
c++;
if(buf[i] == '\n')
l++;
62: 3c 0a cmp $0xa,%al
64: 0f 94 c2 sete %dl
67: 01 d6 add %edx,%esi
if(strchr(" \r\t\n\v", buf[i]))
69: 89 44 24 04 mov %eax,0x4(%esp)
6d: e8 ee 01 00 00 call 260 <strchr>
72: 85 c0 test %eax,%eax
74: 75 d2 jne 48 <wc+0x48>
inword = 0;
else if(!inword){
76: 85 ff test %edi,%edi
78: 75 d0 jne 4a <wc+0x4a>
w++;
7a: 83 45 e0 01 addl $0x1,-0x20(%ebp)
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
7e: 83 c3 01 add $0x1,%ebx
81: 39 5d e4 cmp %ebx,-0x1c(%ebp)
if(buf[i] == '\n')
l++;
if(strchr(" \r\t\n\v", buf[i]))
inword = 0;
else if(!inword){
w++;
84: 66 bf 01 00 mov $0x1,%di
int l, w, c, inword;
l = w = c = 0;
inword = 0;
while((n = read(fd, buf, sizeof(buf))) > 0){
for(i=0; i<n; i++){
88: 7f c8 jg 52 <wc+0x52>
8a: 8b 45 e4 mov -0x1c(%ebp),%eax
8d: 01 45 dc add %eax,-0x24(%ebp)
90: eb 8e jmp 20 <wc+0x20>
w++;
inword = 1;
}
}
}
if(n < 0){
92: 75 35 jne c9 <wc+0xc9>
printf(1, "wc: read error\n");
exit();
}
printf(1, "%d %d %d %s\n", l, w, c, name);
94: 8b 45 0c mov 0xc(%ebp),%eax
97: 89 74 24 08 mov %esi,0x8(%esp)
9b: c7 44 24 04 7c 08 00 movl $0x87c,0x4(%esp)
a2: 00
a3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
aa: 89 44 24 14 mov %eax,0x14(%esp)
ae: 8b 45 dc mov -0x24(%ebp),%eax
b1: 89 44 24 10 mov %eax,0x10(%esp)
b5: 8b 45 e0 mov -0x20(%ebp),%eax
b8: 89 44 24 0c mov %eax,0xc(%esp)
bc: e8 3f 04 00 00 call 500 <printf>
}
c1: 83 c4 3c add $0x3c,%esp
c4: 5b pop %ebx
c5: 5e pop %esi
c6: 5f pop %edi
c7: 5d pop %ebp
c8: c3 ret
inword = 1;
}
}
}
if(n < 0){
printf(1, "wc: read error\n");
c9: c7 44 24 04 6c 08 00 movl $0x86c,0x4(%esp)
d0: 00
d1: c7 04 24 01 00 00 00 movl $0x1,(%esp)
d8: e8 23 04 00 00 call 500 <printf>
exit();
dd: e8 e6 02 00 00 call 3c8 <exit>
e2: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000000f0 <main>:
printf(1, "%d %d %d %s\n", l, w, c, name);
}
int
main(int argc, char *argv[])
{
f0: 55 push %ebp
f1: 89 e5 mov %esp,%ebp
f3: 83 e4 f0 and $0xfffffff0,%esp
f6: 57 push %edi
f7: 56 push %esi
f8: 53 push %ebx
f9: 83 ec 24 sub $0x24,%esp
fc: 8b 7d 08 mov 0x8(%ebp),%edi
int fd, i;
if(argc <= 1){
ff: 83 ff 01 cmp $0x1,%edi
102: 7e 74 jle 178 <main+0x88>
wc(0, "");
exit();
104: 8b 5d 0c mov 0xc(%ebp),%ebx
107: be 01 00 00 00 mov $0x1,%esi
10c: 83 c3 04 add $0x4,%ebx
10f: 90 nop
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
110: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
117: 00
118: 8b 03 mov (%ebx),%eax
11a: 89 04 24 mov %eax,(%esp)
11d: e8 e6 02 00 00 call 408 <open>
122: 85 c0 test %eax,%eax
124: 78 32 js 158 <main+0x68>
printf(1, "wc: cannot open %s\n", argv[i]);
exit();
}
wc(fd, argv[i]);
126: 8b 13 mov (%ebx),%edx
if(argc <= 1){
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
128: 83 c6 01 add $0x1,%esi
12b: 83 c3 04 add $0x4,%ebx
if((fd = open(argv[i], 0)) < 0){
printf(1, "wc: cannot open %s\n", argv[i]);
exit();
}
wc(fd, argv[i]);
12e: 89 04 24 mov %eax,(%esp)
131: 89 44 24 1c mov %eax,0x1c(%esp)
135: 89 54 24 04 mov %edx,0x4(%esp)
139: e8 c2 fe ff ff call 0 <wc>
close(fd);
13e: 8b 44 24 1c mov 0x1c(%esp),%eax
142: 89 04 24 mov %eax,(%esp)
145: e8 a6 02 00 00 call 3f0 <close>
if(argc <= 1){
wc(0, "");
exit();
}
for(i = 1; i < argc; i++){
14a: 39 f7 cmp %esi,%edi
14c: 7f c2 jg 110 <main+0x20>
exit();
}
wc(fd, argv[i]);
close(fd);
}
exit();
14e: e8 75 02 00 00 call 3c8 <exit>
153: 90 nop
154: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
exit();
}
for(i = 1; i < argc; i++){
if((fd = open(argv[i], 0)) < 0){
printf(1, "wc: cannot open %s\n", argv[i]);
158: 8b 03 mov (%ebx),%eax
15a: c7 44 24 04 89 08 00 movl $0x889,0x4(%esp)
161: 00
162: c7 04 24 01 00 00 00 movl $0x1,(%esp)
169: 89 44 24 08 mov %eax,0x8(%esp)
16d: e8 8e 03 00 00 call 500 <printf>
exit();
172: e8 51 02 00 00 call 3c8 <exit>
177: 90 nop
main(int argc, char *argv[])
{
int fd, i;
if(argc <= 1){
wc(0, "");
178: c7 44 24 04 7b 08 00 movl $0x87b,0x4(%esp)
17f: 00
180: c7 04 24 00 00 00 00 movl $0x0,(%esp)
187: e8 74 fe ff ff call 0 <wc>
exit();
18c: e8 37 02 00 00 call 3c8 <exit>
191: 90 nop
192: 90 nop
193: 90 nop
194: 90 nop
195: 90 nop
196: 90 nop
197: 90 nop
198: 90 nop
199: 90 nop
19a: 90 nop
19b: 90 nop
19c: 90 nop
19d: 90 nop
19e: 90 nop
19f: 90 nop
000001a0 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
1a0: 55 push %ebp
1a1: 31 d2 xor %edx,%edx
1a3: 89 e5 mov %esp,%ebp
1a5: 8b 45 08 mov 0x8(%ebp),%eax
1a8: 53 push %ebx
1a9: 8b 5d 0c mov 0xc(%ebp),%ebx
1ac: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
1b0: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
1b4: 88 0c 10 mov %cl,(%eax,%edx,1)
1b7: 83 c2 01 add $0x1,%edx
1ba: 84 c9 test %cl,%cl
1bc: 75 f2 jne 1b0 <strcpy+0x10>
;
return os;
}
1be: 5b pop %ebx
1bf: 5d pop %ebp
1c0: c3 ret
1c1: eb 0d jmp 1d0 <strcmp>
1c3: 90 nop
1c4: 90 nop
1c5: 90 nop
1c6: 90 nop
1c7: 90 nop
1c8: 90 nop
1c9: 90 nop
1ca: 90 nop
1cb: 90 nop
1cc: 90 nop
1cd: 90 nop
1ce: 90 nop
1cf: 90 nop
000001d0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
1d0: 55 push %ebp
1d1: 89 e5 mov %esp,%ebp
1d3: 8b 4d 08 mov 0x8(%ebp),%ecx
1d6: 53 push %ebx
1d7: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
1da: 0f b6 01 movzbl (%ecx),%eax
1dd: 84 c0 test %al,%al
1df: 75 14 jne 1f5 <strcmp+0x25>
1e1: eb 25 jmp 208 <strcmp+0x38>
1e3: 90 nop
1e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
1e8: 83 c1 01 add $0x1,%ecx
1eb: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
1ee: 0f b6 01 movzbl (%ecx),%eax
1f1: 84 c0 test %al,%al
1f3: 74 13 je 208 <strcmp+0x38>
1f5: 0f b6 1a movzbl (%edx),%ebx
1f8: 38 d8 cmp %bl,%al
1fa: 74 ec je 1e8 <strcmp+0x18>
1fc: 0f b6 db movzbl %bl,%ebx
1ff: 0f b6 c0 movzbl %al,%eax
202: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
204: 5b pop %ebx
205: 5d pop %ebp
206: c3 ret
207: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
208: 0f b6 1a movzbl (%edx),%ebx
20b: 31 c0 xor %eax,%eax
20d: 0f b6 db movzbl %bl,%ebx
210: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
212: 5b pop %ebx
213: 5d pop %ebp
214: c3 ret
215: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
219: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000220 <strlen>:
uint
strlen(char *s)
{
220: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
221: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
223: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
225: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
227: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
22a: 80 39 00 cmpb $0x0,(%ecx)
22d: 74 0c je 23b <strlen+0x1b>
22f: 90 nop
230: 83 c2 01 add $0x1,%edx
233: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
237: 89 d0 mov %edx,%eax
239: 75 f5 jne 230 <strlen+0x10>
;
return n;
}
23b: 5d pop %ebp
23c: c3 ret
23d: 8d 76 00 lea 0x0(%esi),%esi
00000240 <memset>:
void*
memset(void *dst, int c, uint n)
{
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
243: 8b 55 08 mov 0x8(%ebp),%edx
246: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
247: 8b 4d 10 mov 0x10(%ebp),%ecx
24a: 8b 45 0c mov 0xc(%ebp),%eax
24d: 89 d7 mov %edx,%edi
24f: fc cld
250: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
252: 89 d0 mov %edx,%eax
254: 5f pop %edi
255: 5d pop %ebp
256: c3 ret
257: 89 f6 mov %esi,%esi
259: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000260 <strchr>:
char*
strchr(const char *s, char c)
{
260: 55 push %ebp
261: 89 e5 mov %esp,%ebp
263: 8b 45 08 mov 0x8(%ebp),%eax
266: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
26a: 0f b6 10 movzbl (%eax),%edx
26d: 84 d2 test %dl,%dl
26f: 75 11 jne 282 <strchr+0x22>
271: eb 15 jmp 288 <strchr+0x28>
273: 90 nop
274: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
278: 83 c0 01 add $0x1,%eax
27b: 0f b6 10 movzbl (%eax),%edx
27e: 84 d2 test %dl,%dl
280: 74 06 je 288 <strchr+0x28>
if(*s == c)
282: 38 ca cmp %cl,%dl
284: 75 f2 jne 278 <strchr+0x18>
return (char*)s;
return 0;
}
286: 5d pop %ebp
287: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
288: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
28a: 5d pop %ebp
28b: 90 nop
28c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
290: c3 ret
291: eb 0d jmp 2a0 <atoi>
293: 90 nop
294: 90 nop
295: 90 nop
296: 90 nop
297: 90 nop
298: 90 nop
299: 90 nop
29a: 90 nop
29b: 90 nop
29c: 90 nop
29d: 90 nop
29e: 90 nop
29f: 90 nop
000002a0 <atoi>:
return r;
}
int
atoi(const char *s)
{
2a0: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
2a1: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
2a3: 89 e5 mov %esp,%ebp
2a5: 8b 4d 08 mov 0x8(%ebp),%ecx
2a8: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
2a9: 0f b6 11 movzbl (%ecx),%edx
2ac: 8d 5a d0 lea -0x30(%edx),%ebx
2af: 80 fb 09 cmp $0x9,%bl
2b2: 77 1c ja 2d0 <atoi+0x30>
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
2b8: 0f be d2 movsbl %dl,%edx
2bb: 83 c1 01 add $0x1,%ecx
2be: 8d 04 80 lea (%eax,%eax,4),%eax
2c1: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
2c5: 0f b6 11 movzbl (%ecx),%edx
2c8: 8d 5a d0 lea -0x30(%edx),%ebx
2cb: 80 fb 09 cmp $0x9,%bl
2ce: 76 e8 jbe 2b8 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
2d0: 5b pop %ebx
2d1: 5d pop %ebp
2d2: c3 ret
2d3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
2d9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000002e0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2e0: 55 push %ebp
2e1: 89 e5 mov %esp,%ebp
2e3: 56 push %esi
2e4: 8b 45 08 mov 0x8(%ebp),%eax
2e7: 53 push %ebx
2e8: 8b 5d 10 mov 0x10(%ebp),%ebx
2eb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
2ee: 85 db test %ebx,%ebx
2f0: 7e 14 jle 306 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
2f2: 31 d2 xor %edx,%edx
2f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
2f8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
2fc: 88 0c 10 mov %cl,(%eax,%edx,1)
2ff: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
302: 39 da cmp %ebx,%edx
304: 75 f2 jne 2f8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
306: 5b pop %ebx
307: 5e pop %esi
308: 5d pop %ebp
309: c3 ret
30a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
00000310 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
310: 55 push %ebp
311: 89 e5 mov %esp,%ebp
313: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
316: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
319: 89 5d f8 mov %ebx,-0x8(%ebp)
31c: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
31f: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
324: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
32b: 00
32c: 89 04 24 mov %eax,(%esp)
32f: e8 d4 00 00 00 call 408 <open>
if(fd < 0)
334: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
336: 89 c3 mov %eax,%ebx
if(fd < 0)
338: 78 19 js 353 <stat+0x43>
return -1;
r = fstat(fd, st);
33a: 8b 45 0c mov 0xc(%ebp),%eax
33d: 89 1c 24 mov %ebx,(%esp)
340: 89 44 24 04 mov %eax,0x4(%esp)
344: e8 d7 00 00 00 call 420 <fstat>
close(fd);
349: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
34c: 89 c6 mov %eax,%esi
close(fd);
34e: e8 9d 00 00 00 call 3f0 <close>
return r;
}
353: 89 f0 mov %esi,%eax
355: 8b 5d f8 mov -0x8(%ebp),%ebx
358: 8b 75 fc mov -0x4(%ebp),%esi
35b: 89 ec mov %ebp,%esp
35d: 5d pop %ebp
35e: c3 ret
35f: 90 nop
00000360 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
360: 55 push %ebp
361: 89 e5 mov %esp,%ebp
363: 57 push %edi
364: 56 push %esi
365: 31 f6 xor %esi,%esi
367: 53 push %ebx
368: 83 ec 2c sub $0x2c,%esp
36b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
36e: eb 06 jmp 376 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
370: 3c 0a cmp $0xa,%al
372: 74 39 je 3ad <gets+0x4d>
374: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
376: 8d 5e 01 lea 0x1(%esi),%ebx
379: 3b 5d 0c cmp 0xc(%ebp),%ebx
37c: 7d 31 jge 3af <gets+0x4f>
cc = read(0, &c, 1);
37e: 8d 45 e7 lea -0x19(%ebp),%eax
381: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
388: 00
389: 89 44 24 04 mov %eax,0x4(%esp)
38d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
394: e8 47 00 00 00 call 3e0 <read>
if(cc < 1)
399: 85 c0 test %eax,%eax
39b: 7e 12 jle 3af <gets+0x4f>
break;
buf[i++] = c;
39d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3a1: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
3a5: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
3a9: 3c 0d cmp $0xd,%al
3ab: 75 c3 jne 370 <gets+0x10>
3ad: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
3af: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
3b3: 89 f8 mov %edi,%eax
3b5: 83 c4 2c add $0x2c,%esp
3b8: 5b pop %ebx
3b9: 5e pop %esi
3ba: 5f pop %edi
3bb: 5d pop %ebp
3bc: c3 ret
3bd: 90 nop
3be: 90 nop
3bf: 90 nop
000003c0 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
3c0: b8 01 00 00 00 mov $0x1,%eax
3c5: cd 40 int $0x40
3c7: c3 ret
000003c8 <exit>:
SYSCALL(exit)
3c8: b8 02 00 00 00 mov $0x2,%eax
3cd: cd 40 int $0x40
3cf: c3 ret
000003d0 <wait>:
SYSCALL(wait)
3d0: b8 03 00 00 00 mov $0x3,%eax
3d5: cd 40 int $0x40
3d7: c3 ret
000003d8 <pipe>:
SYSCALL(pipe)
3d8: b8 04 00 00 00 mov $0x4,%eax
3dd: cd 40 int $0x40
3df: c3 ret
000003e0 <read>:
SYSCALL(read)
3e0: b8 05 00 00 00 mov $0x5,%eax
3e5: cd 40 int $0x40
3e7: c3 ret
000003e8 <write>:
SYSCALL(write)
3e8: b8 10 00 00 00 mov $0x10,%eax
3ed: cd 40 int $0x40
3ef: c3 ret
000003f0 <close>:
SYSCALL(close)
3f0: b8 15 00 00 00 mov $0x15,%eax
3f5: cd 40 int $0x40
3f7: c3 ret
000003f8 <kill>:
SYSCALL(kill)
3f8: b8 06 00 00 00 mov $0x6,%eax
3fd: cd 40 int $0x40
3ff: c3 ret
00000400 <exec>:
SYSCALL(exec)
400: b8 07 00 00 00 mov $0x7,%eax
405: cd 40 int $0x40
407: c3 ret
00000408 <open>:
SYSCALL(open)
408: b8 0f 00 00 00 mov $0xf,%eax
40d: cd 40 int $0x40
40f: c3 ret
00000410 <mknod>:
SYSCALL(mknod)
410: b8 11 00 00 00 mov $0x11,%eax
415: cd 40 int $0x40
417: c3 ret
00000418 <unlink>:
SYSCALL(unlink)
418: b8 12 00 00 00 mov $0x12,%eax
41d: cd 40 int $0x40
41f: c3 ret
00000420 <fstat>:
SYSCALL(fstat)
420: b8 08 00 00 00 mov $0x8,%eax
425: cd 40 int $0x40
427: c3 ret
00000428 <link>:
SYSCALL(link)
428: b8 13 00 00 00 mov $0x13,%eax
42d: cd 40 int $0x40
42f: c3 ret
00000430 <mkdir>:
SYSCALL(mkdir)
430: b8 14 00 00 00 mov $0x14,%eax
435: cd 40 int $0x40
437: c3 ret
00000438 <chdir>:
SYSCALL(chdir)
438: b8 09 00 00 00 mov $0x9,%eax
43d: cd 40 int $0x40
43f: c3 ret
00000440 <dup>:
SYSCALL(dup)
440: b8 0a 00 00 00 mov $0xa,%eax
445: cd 40 int $0x40
447: c3 ret
00000448 <getpid>:
SYSCALL(getpid)
448: b8 0b 00 00 00 mov $0xb,%eax
44d: cd 40 int $0x40
44f: c3 ret
00000450 <sbrk>:
SYSCALL(sbrk)
450: b8 0c 00 00 00 mov $0xc,%eax
455: cd 40 int $0x40
457: c3 ret
00000458 <sleep>:
SYSCALL(sleep)
458: b8 0d 00 00 00 mov $0xd,%eax
45d: cd 40 int $0x40
45f: c3 ret
00000460 <set_tickets>:
SYSCALL(set_tickets)
460: b8 16 00 00 00 mov $0x16,%eax
465: cd 40 int $0x40
467: c3 ret
468: 90 nop
469: 90 nop
46a: 90 nop
46b: 90 nop
46c: 90 nop
46d: 90 nop
46e: 90 nop
46f: 90 nop
00000470 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
470: 55 push %ebp
471: 89 e5 mov %esp,%ebp
473: 57 push %edi
474: 89 cf mov %ecx,%edi
476: 56 push %esi
477: 89 c6 mov %eax,%esi
479: 53 push %ebx
47a: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
47d: 8b 4d 08 mov 0x8(%ebp),%ecx
480: 85 c9 test %ecx,%ecx
482: 74 04 je 488 <printint+0x18>
484: 85 d2 test %edx,%edx
486: 78 68 js 4f0 <printint+0x80>
neg = 1;
x = -xx;
} else {
x = xx;
488: 89 d0 mov %edx,%eax
48a: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
491: 31 c9 xor %ecx,%ecx
493: 8d 5d d7 lea -0x29(%ebp),%ebx
496: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
498: 31 d2 xor %edx,%edx
49a: f7 f7 div %edi
49c: 0f b6 92 a4 08 00 00 movzbl 0x8a4(%edx),%edx
4a3: 88 14 0b mov %dl,(%ebx,%ecx,1)
4a6: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
4a9: 85 c0 test %eax,%eax
4ab: 75 eb jne 498 <printint+0x28>
if(neg)
4ad: 8b 45 c4 mov -0x3c(%ebp),%eax
4b0: 85 c0 test %eax,%eax
4b2: 74 08 je 4bc <printint+0x4c>
buf[i++] = '-';
4b4: c6 44 0d d7 2d movb $0x2d,-0x29(%ebp,%ecx,1)
4b9: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
4bc: 8d 79 ff lea -0x1(%ecx),%edi
4bf: 90 nop
4c0: 0f b6 04 3b movzbl (%ebx,%edi,1),%eax
4c4: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4c7: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
4ce: 00
4cf: 89 34 24 mov %esi,(%esp)
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
4d2: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4d5: 8d 45 e7 lea -0x19(%ebp),%eax
4d8: 89 44 24 04 mov %eax,0x4(%esp)
4dc: e8 07 ff ff ff call 3e8 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
4e1: 83 ff ff cmp $0xffffffff,%edi
4e4: 75 da jne 4c0 <printint+0x50>
putc(fd, buf[i]);
}
4e6: 83 c4 4c add $0x4c,%esp
4e9: 5b pop %ebx
4ea: 5e pop %esi
4eb: 5f pop %edi
4ec: 5d pop %ebp
4ed: c3 ret
4ee: 66 90 xchg %ax,%ax
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
4f0: 89 d0 mov %edx,%eax
4f2: f7 d8 neg %eax
4f4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
4fb: eb 94 jmp 491 <printint+0x21>
4fd: 8d 76 00 lea 0x0(%esi),%esi
00000500 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
500: 55 push %ebp
501: 89 e5 mov %esp,%ebp
503: 57 push %edi
504: 56 push %esi
505: 53 push %ebx
506: 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++){
509: 8b 45 0c mov 0xc(%ebp),%eax
50c: 0f b6 10 movzbl (%eax),%edx
50f: 84 d2 test %dl,%dl
511: 0f 84 c1 00 00 00 je 5d8 <printf+0xd8>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
517: 8d 4d 10 lea 0x10(%ebp),%ecx
51a: 31 ff xor %edi,%edi
51c: 89 4d d4 mov %ecx,-0x2c(%ebp)
51f: 31 db xor %ebx,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
521: 8d 75 e7 lea -0x19(%ebp),%esi
524: eb 1e jmp 544 <printf+0x44>
526: 66 90 xchg %ax,%ax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
528: 83 fa 25 cmp $0x25,%edx
52b: 0f 85 af 00 00 00 jne 5e0 <printf+0xe0>
531: 66 bf 25 00 mov $0x25,%di
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
535: 83 c3 01 add $0x1,%ebx
538: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
53c: 84 d2 test %dl,%dl
53e: 0f 84 94 00 00 00 je 5d8 <printf+0xd8>
c = fmt[i] & 0xff;
if(state == 0){
544: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
546: 0f b6 d2 movzbl %dl,%edx
if(state == 0){
549: 74 dd je 528 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
54b: 83 ff 25 cmp $0x25,%edi
54e: 75 e5 jne 535 <printf+0x35>
if(c == 'd'){
550: 83 fa 64 cmp $0x64,%edx
553: 0f 84 3f 01 00 00 je 698 <printf+0x198>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
559: 83 fa 70 cmp $0x70,%edx
55c: 0f 84 a6 00 00 00 je 608 <printf+0x108>
562: 83 fa 78 cmp $0x78,%edx
565: 0f 84 9d 00 00 00 je 608 <printf+0x108>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
56b: 83 fa 73 cmp $0x73,%edx
56e: 66 90 xchg %ax,%ax
570: 0f 84 ba 00 00 00 je 630 <printf+0x130>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
576: 83 fa 63 cmp $0x63,%edx
579: 0f 84 41 01 00 00 je 6c0 <printf+0x1c0>
putc(fd, *ap);
ap++;
} else if(c == '%'){
57f: 83 fa 25 cmp $0x25,%edx
582: 0f 84 00 01 00 00 je 688 <printf+0x188>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
588: 8b 4d 08 mov 0x8(%ebp),%ecx
58b: 89 55 cc mov %edx,-0x34(%ebp)
58e: c6 45 e7 25 movb $0x25,-0x19(%ebp)
592: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
599: 00
59a: 89 74 24 04 mov %esi,0x4(%esp)
59e: 89 0c 24 mov %ecx,(%esp)
5a1: e8 42 fe ff ff call 3e8 <write>
5a6: 8b 55 cc mov -0x34(%ebp),%edx
5a9: 88 55 e7 mov %dl,-0x19(%ebp)
5ac: 8b 45 08 mov 0x8(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5af: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5b2: 31 ff xor %edi,%edi
5b4: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5bb: 00
5bc: 89 74 24 04 mov %esi,0x4(%esp)
5c0: 89 04 24 mov %eax,(%esp)
5c3: e8 20 fe ff ff call 3e8 <write>
5c8: 8b 45 0c mov 0xc(%ebp),%eax
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
5cb: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
5cf: 84 d2 test %dl,%dl
5d1: 0f 85 6d ff ff ff jne 544 <printf+0x44>
5d7: 90 nop
putc(fd, c);
}
state = 0;
}
}
}
5d8: 83 c4 3c add $0x3c,%esp
5db: 5b pop %ebx
5dc: 5e pop %esi
5dd: 5f pop %edi
5de: 5d pop %ebp
5df: c3 ret
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5e0: 8b 45 08 mov 0x8(%ebp),%eax
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
5e3: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5e6: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5ed: 00
5ee: 89 74 24 04 mov %esi,0x4(%esp)
5f2: 89 04 24 mov %eax,(%esp)
5f5: e8 ee fd ff ff call 3e8 <write>
5fa: 8b 45 0c mov 0xc(%ebp),%eax
5fd: e9 33 ff ff ff jmp 535 <printf+0x35>
602: 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);
608: 8b 45 d4 mov -0x2c(%ebp),%eax
60b: b9 10 00 00 00 mov $0x10,%ecx
ap++;
610: 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);
612: c7 04 24 00 00 00 00 movl $0x0,(%esp)
619: 8b 10 mov (%eax),%edx
61b: 8b 45 08 mov 0x8(%ebp),%eax
61e: e8 4d fe ff ff call 470 <printint>
623: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
626: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
62a: e9 06 ff ff ff jmp 535 <printf+0x35>
62f: 90 nop
} else if(c == 's'){
s = (char*)*ap;
630: 8b 55 d4 mov -0x2c(%ebp),%edx
ap++;
if(s == 0)
633: b9 9d 08 00 00 mov $0x89d,%ecx
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
638: 8b 3a mov (%edx),%edi
ap++;
63a: 83 c2 04 add $0x4,%edx
63d: 89 55 d4 mov %edx,-0x2c(%ebp)
if(s == 0)
640: 85 ff test %edi,%edi
642: 0f 44 f9 cmove %ecx,%edi
s = "(null)";
while(*s != 0){
645: 0f b6 17 movzbl (%edi),%edx
648: 84 d2 test %dl,%dl
64a: 74 33 je 67f <printf+0x17f>
64c: 89 5d d0 mov %ebx,-0x30(%ebp)
64f: 8b 5d 08 mov 0x8(%ebp),%ebx
652: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
s++;
658: 83 c7 01 add $0x1,%edi
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
65b: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
65e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
665: 00
666: 89 74 24 04 mov %esi,0x4(%esp)
66a: 89 1c 24 mov %ebx,(%esp)
66d: e8 76 fd ff ff call 3e8 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
672: 0f b6 17 movzbl (%edi),%edx
675: 84 d2 test %dl,%dl
677: 75 df jne 658 <printf+0x158>
679: 8b 5d d0 mov -0x30(%ebp),%ebx
67c: 8b 45 0c mov 0xc(%ebp),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
67f: 31 ff xor %edi,%edi
681: e9 af fe ff ff jmp 535 <printf+0x35>
686: 66 90 xchg %ax,%ax
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
688: c6 45 e7 25 movb $0x25,-0x19(%ebp)
68c: e9 1b ff ff ff jmp 5ac <printf+0xac>
691: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
698: 8b 45 d4 mov -0x2c(%ebp),%eax
69b: b9 0a 00 00 00 mov $0xa,%ecx
ap++;
6a0: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
6a3: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6aa: 8b 10 mov (%eax),%edx
6ac: 8b 45 08 mov 0x8(%ebp),%eax
6af: e8 bc fd ff ff call 470 <printint>
6b4: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
6b7: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
6bb: e9 75 fe ff ff jmp 535 <printf+0x35>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
6c0: 8b 55 d4 mov -0x2c(%ebp),%edx
putc(fd, *ap);
ap++;
6c3: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6c5: 8b 4d 08 mov 0x8(%ebp),%ecx
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
6c8: 8b 02 mov (%edx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6ca: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6d1: 00
6d2: 89 74 24 04 mov %esi,0x4(%esp)
6d6: 89 0c 24 mov %ecx,(%esp)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
6d9: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6dc: e8 07 fd ff ff call 3e8 <write>
6e1: 8b 45 0c mov 0xc(%ebp),%eax
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
6e4: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
6e8: e9 48 fe ff ff jmp 535 <printf+0x35>
6ed: 90 nop
6ee: 90 nop
6ef: 90 nop
000006f0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
6f0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6f1: a1 c8 08 00 00 mov 0x8c8,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
6f6: 89 e5 mov %esp,%ebp
6f8: 57 push %edi
6f9: 56 push %esi
6fa: 53 push %ebx
6fb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
6fe: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
701: 39 c8 cmp %ecx,%eax
703: 73 1d jae 722 <free+0x32>
705: 8d 76 00 lea 0x0(%esi),%esi
708: 8b 10 mov (%eax),%edx
70a: 39 d1 cmp %edx,%ecx
70c: 72 1a jb 728 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
70e: 39 d0 cmp %edx,%eax
710: 72 08 jb 71a <free+0x2a>
712: 39 c8 cmp %ecx,%eax
714: 72 12 jb 728 <free+0x38>
716: 39 d1 cmp %edx,%ecx
718: 72 0e jb 728 <free+0x38>
71a: 89 d0 mov %edx,%eax
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
71c: 39 c8 cmp %ecx,%eax
71e: 66 90 xchg %ax,%ax
720: 72 e6 jb 708 <free+0x18>
722: 8b 10 mov (%eax),%edx
724: eb e8 jmp 70e <free+0x1e>
726: 66 90 xchg %ax,%ax
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
728: 8b 71 04 mov 0x4(%ecx),%esi
72b: 8d 3c f1 lea (%ecx,%esi,8),%edi
72e: 39 d7 cmp %edx,%edi
730: 74 19 je 74b <free+0x5b>
bp->s.size += p->s.ptr->s.size;
bp->s.ptr = p->s.ptr->s.ptr;
} else
bp->s.ptr = p->s.ptr;
732: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
735: 8b 50 04 mov 0x4(%eax),%edx
738: 8d 34 d0 lea (%eax,%edx,8),%esi
73b: 39 ce cmp %ecx,%esi
73d: 74 23 je 762 <free+0x72>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
73f: 89 08 mov %ecx,(%eax)
freep = p;
741: a3 c8 08 00 00 mov %eax,0x8c8
}
746: 5b pop %ebx
747: 5e pop %esi
748: 5f pop %edi
749: 5d pop %ebp
74a: c3 ret
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
bp->s.size += p->s.ptr->s.size;
74b: 03 72 04 add 0x4(%edx),%esi
74e: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
751: 8b 10 mov (%eax),%edx
753: 8b 12 mov (%edx),%edx
755: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
758: 8b 50 04 mov 0x4(%eax),%edx
75b: 8d 34 d0 lea (%eax,%edx,8),%esi
75e: 39 ce cmp %ecx,%esi
760: 75 dd jne 73f <free+0x4f>
p->s.size += bp->s.size;
762: 03 51 04 add 0x4(%ecx),%edx
765: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
768: 8b 53 f8 mov -0x8(%ebx),%edx
76b: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
76d: a3 c8 08 00 00 mov %eax,0x8c8
}
772: 5b pop %ebx
773: 5e pop %esi
774: 5f pop %edi
775: 5d pop %ebp
776: c3 ret
777: 89 f6 mov %esi,%esi
779: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000780 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
780: 55 push %ebp
781: 89 e5 mov %esp,%ebp
783: 57 push %edi
784: 56 push %esi
785: 53 push %ebx
786: 83 ec 2c sub $0x2c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
789: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
78c: 8b 0d c8 08 00 00 mov 0x8c8,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
792: 83 c3 07 add $0x7,%ebx
795: c1 eb 03 shr $0x3,%ebx
798: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
79b: 85 c9 test %ecx,%ecx
79d: 0f 84 9b 00 00 00 je 83e <malloc+0xbe>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
7a3: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
7a5: 8b 50 04 mov 0x4(%eax),%edx
7a8: 39 d3 cmp %edx,%ebx
7aa: 76 27 jbe 7d3 <malloc+0x53>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
7ac: 8d 3c dd 00 00 00 00 lea 0x0(,%ebx,8),%edi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
7b3: be 00 80 00 00 mov $0x8000,%esi
7b8: 89 7d e4 mov %edi,-0x1c(%ebp)
7bb: 90 nop
7bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
7c0: 3b 05 c8 08 00 00 cmp 0x8c8,%eax
7c6: 74 30 je 7f8 <malloc+0x78>
7c8: 89 c1 mov %eax,%ecx
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){
7ca: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
7cc: 8b 50 04 mov 0x4(%eax),%edx
7cf: 39 d3 cmp %edx,%ebx
7d1: 77 ed ja 7c0 <malloc+0x40>
if(p->s.size == nunits)
7d3: 39 d3 cmp %edx,%ebx
7d5: 74 61 je 838 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
7d7: 29 da sub %ebx,%edx
7d9: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
7dc: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
7df: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
7e2: 89 0d c8 08 00 00 mov %ecx,0x8c8
return (void*)(p + 1);
7e8: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
7eb: 83 c4 2c add $0x2c,%esp
7ee: 5b pop %ebx
7ef: 5e pop %esi
7f0: 5f pop %edi
7f1: 5d pop %ebp
7f2: c3 ret
7f3: 90 nop
7f4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
7f8: 8b 45 e4 mov -0x1c(%ebp),%eax
7fb: 81 fb 00 10 00 00 cmp $0x1000,%ebx
801: bf 00 10 00 00 mov $0x1000,%edi
806: 0f 43 fb cmovae %ebx,%edi
809: 0f 42 c6 cmovb %esi,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
80c: 89 04 24 mov %eax,(%esp)
80f: e8 3c fc ff ff call 450 <sbrk>
if(p == (char*)-1)
814: 83 f8 ff cmp $0xffffffff,%eax
817: 74 18 je 831 <malloc+0xb1>
return 0;
hp = (Header*)p;
hp->s.size = nu;
819: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
81c: 83 c0 08 add $0x8,%eax
81f: 89 04 24 mov %eax,(%esp)
822: e8 c9 fe ff ff call 6f0 <free>
return freep;
827: 8b 0d c8 08 00 00 mov 0x8c8,%ecx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
82d: 85 c9 test %ecx,%ecx
82f: 75 99 jne 7ca <malloc+0x4a>
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){
831: 31 c0 xor %eax,%eax
833: eb b6 jmp 7eb <malloc+0x6b>
835: 8d 76 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
838: 8b 10 mov (%eax),%edx
83a: 89 11 mov %edx,(%ecx)
83c: eb a4 jmp 7e2 <malloc+0x62>
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
83e: c7 05 c8 08 00 00 c0 movl $0x8c0,0x8c8
845: 08 00 00
base.s.size = 0;
848: b9 c0 08 00 00 mov $0x8c0,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
84d: c7 05 c0 08 00 00 c0 movl $0x8c0,0x8c0
854: 08 00 00
base.s.size = 0;
857: c7 05 c4 08 00 00 00 movl $0x0,0x8c4
85e: 00 00 00
861: e9 3d ff ff ff jmp 7a3 <malloc+0x23>
|
libsrc/_DEVELOPMENT/stdio/z80/asm__fflushall_unlocked.asm | jpoikela/z88dk | 640 | 84998 |
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_stdio
PUBLIC asm__fflushall_unlocked
EXTERN __stdio_open_file_list
EXTERN asm1_fflush_unlocked, asm_p_forward_list_next
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $04
EXTERN __stdio_lock_file_list, __stdio_unlock_file_list
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
asm__fflushall_unlocked:
; enter : none
;
; exit : ix = 0
; carry reset
;
; uses : all
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $04
call __stdio_lock_file_list ; acquire list lock
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ld hl,__stdio_open_file_list
file_loop:
call asm_p_forward_list_next
push hl
pop ix
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $04
jp z, __stdio_unlock_file_list ; if no more open files in list
ELSE
ret z ; if no more open files in list
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
push hl
call asm1_fflush_unlocked
pop hl
jr file_loop
|
source/web-lock_files.adb | ytomino/web-ada | 2 | 14213 | <reponame>ytomino/web-ada<gh_stars>1-10
with Ada.Calendar;
with Ada.Directories;
package body Web.Lock_Files is
use type Ada.Calendar.Time;
function Lock (
Name : String;
Force : Duration := 0.0;
Timeout : Duration := 3.0;
Retry_Interval : Duration := 1.0;
Forced : access Boolean := null)
return Boolean
is
Gone : Duration := 0.0;
begin
if Forced /= null then
Forced.all := False;
end if;
loop
if Force /= 0.0 then
declare
Now : constant Ada.Calendar.Time := Ada.Calendar.Clock;
begin
if Now - Ada.Directories.Modification_Time (Name) >= Force then
Ada.Directories.Delete_Directory (Name);
if Forced /= null then
Forced.all := True;
end if;
end if;
exception
when Name_Error | Use_Error => null;
end;
end if;
begin
Ada.Directories.Create_Directory (Name);
return True;
exception
when Use_Error => null;
end;
declare
Interval : constant Duration := Duration'Min (Retry_Interval, Timeout - Gone);
begin
if Interval <= 0.0 then
return False;
end if;
delay Interval;
Gone := Gone + Interval;
end;
end loop;
end Lock;
procedure Lock (
Name : in String;
Force : in Duration := 0.0;
Timeout : in Duration := 3.0;
Retry_Interval : in Duration := 1.0;
Forced : access Boolean := null) is
begin
if not Lock (
Name,
Force => Force,
Timeout => Timeout,
Retry_Interval => Retry_Interval,
Forced => Forced)
then
raise Lock_Error;
end if;
end Lock;
procedure Unlock (Name : in String)
renames Ada.Directories.Delete_Directory;
function Lock (
Name : String;
Force : Duration := 0.0;
Timeout : Duration := 3.0;
Retry_Interval : Duration := 1.0)
return Lock_Type is
begin
return Result : Lock_Type :=
(Ada.Finalization.Limited_Controlled
with
Name_Length => Name'Length,
Locked => False,
Forced => False,
Name => Name)
do
Lock (
Name,
Force => Force,
Timeout => Timeout,
Retry_Interval => Retry_Interval,
Forced => Result.Forced'Access);
Result.Locked := True;
end return;
end Lock;
function Forced (Object : Lock_Type) return Boolean is
begin
return Object.Forced;
end Forced;
procedure Unlock (Object : in out Lock_Type) is
begin
if Object.Locked then
Unlock (Object.Name);
end if;
end Unlock;
overriding procedure Finalize (Object : in out Lock_Type) is
begin
Unlock (Object);
exception
when Name_Error | Use_Error => null; -- Finalize can not raise any exception
end Finalize;
end Web.Lock_Files;
|
src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_sdp_gstsdp_h.ads | persan/A-gst | 1 | 21869 | <filename>src/gen/gstreamer-gst_low_level-gstreamer_0_10_gst_sdp_gstsdp_h.ads
pragma Ada_2005;
pragma Style_Checks (Off);
pragma Warnings (Off);
with Interfaces.C; use Interfaces.C;
package GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdp_h is
-- GStreamer
-- * Copyright (C) <2005,2006> <NAME> <<EMAIL>>
-- *
-- * This library is free software; you can redistribute it and/or
-- * modify it under the terms of the GNU Library General Public
-- * License as published by the Free Software Foundation; either
-- * version 2 of the License, or (at your option) any later version.
-- *
-- * This library is distributed in the hope that it will be useful,
-- * but WITHOUT ANY WARRANTY; without even the implied warranty of
-- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- * Library General Public License for more details.
-- *
-- * You should have received a copy of the GNU Library General Public
-- * License along with this library; if not, write to the
-- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-- * Boston, MA 02111-1307, USA.
--
-- * Unless otherwise indicated, Source Code is licensed under MIT license.
-- * See further explanation attached in License Statement (distributed in the file
-- * LICENSE).
-- *
-- * 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.
--
--*
-- * GstSDPResult:
-- * @GST_SDP_OK: A successful return value
-- * @GST_SDP_EINVAL: a function was given invalid parameters
-- *
-- * Return values for the SDP functions.
--
subtype GstSDPResult is int;
GST_SDP_OK : constant GstSDPResult := 0;
GST_SDP_EINVAL : constant GstSDPResult := -1; -- gst/sdp/gstsdp.h:56
end GStreamer.GST_Low_Level.gstreamer_0_10_gst_sdp_gstsdp_h;
|
test/Fail/Unknown-names-in-polarity-pragmas.agda | shlevy/agda | 1,989 | 3937 | {-# OPTIONS --warning=error #-}
{-# POLARITY F #-}
{-# POLARITY G #-}
|
programs/oeis/337/A337929.asm | neoneye/loda | 22 | 174755 | ; A337929: Numbers w such that (F(2*n-1)^2, -F(2*n)^2, w) are primitive solutions of the Diophantine equation 2*x^3 + 2*y^3 + z^3 = 1, where F(n) is the n-th Fibonacci number (A000045).
; 1,11,79,545,3739,25631,175681,1204139,8253295,56568929,387729211,2657535551,18215019649,124847601995,855718194319,5865179758241,40200540113371,275538601035359,1888569667134145,12944449068903659,88722573815191471,608113567637436641
mov $1,1
mov $2,2
lpb $0
sub $0,1
add $2,1
add $1,$2
add $2,$1
add $1,$2
add $2,$1
lpe
mov $0,$1
|
programs/oeis/125/A125823.asm | neoneye/loda | 22 | 2684 | <reponame>neoneye/loda
; A125823: Numbers whose base 7 representation is 4444....4.
; 0,4,32,228,1600,11204,78432,549028,3843200,26902404,188316832,1318217828,9227524800,64592673604,452148715232,3165041006628,22155287046400,155087009324804,1085609065273632,7599263456915428,53194844198408000,372363909388856004,2606547365721992032,18245831560053944228,127720820920377609600,894045746442643267204,6258320225098502870432,43808241575689520093028,306657691029826640651200,2146603837208786484558404,15026226860461505391908832,105183588023230537743361828,736285116162613764203532800,5153995813138296349424729604,36077970691968074445973107232,252545794843776521121811750628,1767820563906435647852682254400,12374743947345049534968775780804,86623207631415346744781430465632,606362453419907427213470013259428,4244537173939351990494290092816000,29711760217575463933460030649712004,207982321523028247534220214547984032
mov $1,7
pow $1,$0
div $1,6
mul $1,4
mov $0,$1
|
test/interaction/Issue2487-1.agda | cruhland/agda | 1,989 | 13613 | module Issue2487-1 where
postulate get-out-of-jail : {A : Set} -> A
|
examples/Linux/spi_test/src/spi_test.adb | Sawchord/Ada_Drivers_Library | 0 | 11422 | <filename>examples/Linux/spi_test/src/spi_test.adb<gh_stars>0
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Posix;
with HAL;
with HAL.SPI; use HAL.SPI;
with HAL.I2C; use HAL.I2C;
with Native.SPI; -- use Native.SPI;
with Native.I2C;
procedure Spi_Test is
SPI_Device : String := "/dev/spidev0.0";
SPI_Conf : Native.SPI.SPI_Configuration :=
(Data_Size => HAL.SPI.Data_Size_16b,
Clock_Polarity => Native.SPI.High,
Clock_Phase => Native.SPI.P1Edge,
Slave_Manager => Native.SPI.Hardware_Managed,
First_Bit => Native.SPI.MSB,
Baud_Rate => 100_000);
SPI_Port : Native.SPI.SPI_Port;
SPI_Status : HAL.SPI.SPI_Status;
SPI_Out_Data : HAL.SPI.SPI_Data_16b(1..1) := (1 => 16#D0#);
SPI_In_Data : HAL.SPI.SPI_Data_16b(1..1);
I2C_Device : String := "/dev/i2c-1";
I2C_Conf : Native.I2C.I2C_Configuration :=
(Addressing_Mode => Native.I2C.Addressing_Mode_7bit,
Ack => Native.I2C.Ack_Enable,
Device_Mode => Native.I2C.I2C_Mode);
I2C_Port : Native.I2C.I2C_Port;
I2C_Status : HAL.I2C.I2C_Status;
I2C_Addr : HAL.I2C.I2C_Address := 16#0A#;
I2C_Data : HAL.I2C.I2C_Data := (5,6,7,8);
begin
Put_Line ("Hello SPI");
-- Initialize the SPI_Port with given Configuration
SPI_Port := Native.SPI.Configure (SPI_Device, SPI_Conf, SPI_Status);
if SPI_Status /= HAL.SPI.Ok then
Put_Line ("Error while initializing SPI Device");
return;
end if;
-- Send Data over the Wire
Put_Line ("SPI Initialized, attempt to send");
SPI_Port.Transmit(SPI_Out_Data, SPI_Status);
if SPI_Status /= HAL.SPI.Ok then
Put_Line ("Error while transmitting SPI data");
return;
end if;
Put_Line ("Transmission was successfull");
SPI_Port.Receive(SPI_In_Data, SPI_Status);
if SPI_Status /= HAL.SPI.Ok then
Put_Line ("Error while receiving SPI data");
return;
end if;
Put ("Reveiced value:");
Put (Integer(SPI_In_Data(1)), 2);
New_Line;
Put_Line ("Hello I2C");
I2C_Port := Native.I2C.Configure (I2C_Device, I2C_Conf, I2C_Status);
if I2C_Status /= HAL.I2C.Ok then
Put_Line ("Error while initializing I2C Device");
end if;
I2C_Port.Master_Transmit (I2C_Addr, I2C_Data, I2C_Status);
if I2C_Status /= HAL.I2C.Ok then
Put_Line ("Error while transmitting I2C data");
end if;
end;
|
src/shipmodules.ads | thindil/steamsky | 80 | 20020 | -- Copyright 2016-2021 <NAME>
--
-- This file is part of Steam Sky.
--
-- Steam Sky is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- Steam Sky is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>.
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Unbounded.Hash;
with Ada.Containers.Hashed_Maps; use Ada.Containers;
with DOM.Readers; use DOM.Readers;
with Game; use Game;
-- ****h* ShipModules/ShipModules
-- FUNCTION
-- Provided code to manipulate ship modules prototypes
-- SOURCE
package ShipModules is
-- ****
-- ****t* ShipModules/ShipModules.ModuleType
-- FUNCTION
-- Types of ship modules
-- SOURCE
type ModuleType is
(ANY, ENGINE, CABIN, COCKPIT, TURRET, GUN, CARGO, HULL, ARMOR,
BATTERING_RAM, ALCHEMY_LAB, FURNACE, WATER_COLLECTOR, WORKSHOP,
GREENHOUSE, MEDICAL_ROOM, HARPOON_GUN, TRAINING_ROOM) with
Default_Value => ANY;
-- ****
-- ****s* ShipModules/ShipModules.BaseModule_Data
-- FUNCTION
-- Data structure for prototypes of ship modules
-- PARAMETERS
-- Name - Name of module
-- MType - Type of module
-- Weight - Base weight of module
-- Value - For engine base power, depends on module
-- MaxValue - For gun, damage, depends on module
-- Durability - Base durability of module
-- RepairMaterial - Material needed for repair module
-- RepairSkill - Skill needed for repair module
-- Price - Price for module in shipyards
-- InstallTime - Amount of minutes needed for install/remove module
-- Unique - Did ship can have installed only one that module
-- Size - How many space in ship this module take
-- Description - Description of module
-- MaxOwners - How many owners module can have
-- Speed - How fast the gun shoots in combat
-- Reputation - Minimal reputation in base needed to buy that module
-- SOURCE
type BaseModule_Data is record
Name: Unbounded_String;
MType: ModuleType;
Weight: Natural := 0;
Value: Integer := 0;
MaxValue: Integer := 0;
Durability: Integer := 0;
RepairMaterial: Unbounded_String;
RepairSkill: SkillsData_Container.Extended_Index;
Price: Natural := 0;
InstallTime: Positive := 1;
Unique: Boolean;
Size: Positive := 1;
Description: Unbounded_String;
MaxOwners: Natural := 0;
Speed: Integer := 0;
Reputation: Reputation_Range;
end record;
-- ****
-- ****t* ShipModules/ShipModules.BaseModules_Container
-- FUNCTION
-- Used for store prototypes of modules
-- SOURCE
package BaseModules_Container is new Hashed_Maps
(Unbounded_String, BaseModule_Data, Ada.Strings.Unbounded.Hash, "=");
-- ****
-- ****v* ShipModules/ShipModules.Modules_List
-- FUNCTION
-- List of ship modules available in game
-- SOURCE
Modules_List: BaseModules_Container.Map;
-- ****
-- ****f* ShipModules/ShipModules.LoadShipModules
-- FUNCTION
-- Load modules from files
-- PARAMETERS
-- Reader - XML Reader from which ship modules data will be read
-- SOURCE
procedure LoadShipModules(Reader: Tree_Reader);
-- ****
-- ****f* ShipModules/ShipModules.GetModuleType
-- FUNCTION
-- Get type of selected module (replace all underscore with spaces)
-- PARAMETERS
-- ModuleIndex - Index of module in prototypes list
-- RETURNS
-- Formatted type of module
-- SOURCE
function GetModuleType(ModuleIndex: Unbounded_String) return String with
Pre => Length(ModuleIndex) > 0,
Post => GetModuleType'Result'Length > 0,
Test_Case => (Name => "Test_GetModuleType", Mode => Nominal);
-- ****
end ShipModules;
|
oeis/164/A164015.asm | neoneye/loda-programs | 11 | 247099 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A164015: 5 times centered pentagonal numbers: 5*(5*n^2 + 5*n + 2)/2.
; 5,30,80,155,255,380,530,705,905,1130,1380,1655,1955,2280,2630,3005,3405,3830,4280,4755,5255,5780,6330,6905,7505,8130,8780,9455,10155,10880,11630,12405,13205,14030,14880,15755,16655,17580,18530,19505,20505,21530,22580,23655,24755,25880,27030,28205,29405,30630,31880,33155,34455,35780,37130,38505,39905,41330,42780,44255,45755,47280,48830,50405,52005,53630,55280,56955,58655,60380,62130,63905,65705,67530,69380,71255,73155,75080,77030,79005,81005,83030,85080,87155,89255,91380,93530,95705,97905,100130
sub $1,$0
bin $1,2
mul $1,25
add $1,5
mov $0,$1
|
core/lib/types/Wedge.agda | mikeshulman/HoTT-Agda | 0 | 8573 | {-# OPTIONS --without-K --rewriting #-}
open import lib.Basics
open import lib.types.Coproduct
open import lib.types.Paths
open import lib.types.Pointed
open import lib.types.Pushout
open import lib.types.PushoutFlattening
open import lib.types.PushoutFmap
open import lib.types.Span
open import lib.types.Unit
-- Wedge of two pointed types is defined as a particular case of pushout
module lib.types.Wedge where
module _ {i j} (X : Ptd i) (Y : Ptd j) where
wedge-span : Span
wedge-span = span (de⊙ X) (de⊙ Y) Unit (λ _ → pt X) (λ _ → pt Y)
Wedge : Type (lmax i j)
Wedge = Pushout wedge-span
infix 80 _∨_
_∨_ = Wedge
module _ {i j} {X : Ptd i} {Y : Ptd j} where
winl : de⊙ X → X ∨ Y
winl x = left x
winr : de⊙ Y → X ∨ Y
winr y = right y
wglue : winl (pt X) == winr (pt Y)
wglue = glue tt
module _ {i j} (X : Ptd i) (Y : Ptd j) where
⊙Wedge : Ptd (lmax i j)
⊙Wedge = ⊙[ Wedge X Y , winl (pt X) ]
infix 80 _⊙∨_
_⊙∨_ = ⊙Wedge
module _ {i j} {X : Ptd i} {Y : Ptd j} where
⊙winl : X ⊙→ X ⊙∨ Y
⊙winl = (winl , idp)
⊙winr : Y ⊙→ X ⊙∨ Y
⊙winr = (winr , ! wglue)
module _ {i j} {X : Ptd i} {Y : Ptd j} where
module WedgeElim {k} {P : X ∨ Y → Type k}
(inl* : (x : de⊙ X) → P (winl x)) (inr* : (y : de⊙ Y) → P (winr y))
(glue* : inl* (pt X) == inr* (pt Y) [ P ↓ wglue ]) where
private
module M = PushoutElim inl* inr* (λ _ → glue*)
f = M.f
glue-β = M.glue-β unit
open WedgeElim public using () renaming (f to Wedge-elim)
module WedgeRec {k} {C : Type k} (inl* : de⊙ X → C) (inr* : de⊙ Y → C)
(glue* : inl* (pt X) == inr* (pt Y)) where
private
module M = PushoutRec {d = wedge-span X Y} inl* inr* (λ _ → glue*)
f = M.f
glue-β = M.glue-β unit
open WedgeRec public using () renaming (f to Wedge-rec)
module ⊙WedgeRec {i j k} {X : Ptd i} {Y : Ptd j} {Z : Ptd k}
(g : X ⊙→ Z) (h : Y ⊙→ Z) where
open WedgeRec (fst g) (fst h) (snd g ∙ ! (snd h)) public
⊙f : X ⊙∨ Y ⊙→ Z
⊙f = (f , snd g)
⊙winl-β : ⊙f ⊙∘ ⊙winl == g
⊙winl-β = idp
⊙winr-β : ⊙f ⊙∘ ⊙winr == h
⊙winr-β = ⊙λ= (λ _ → idp) $
ap (_∙ snd g)
(ap-! f wglue ∙ ap ! glue-β ∙ !-∙ (snd g) (! (snd h)))
∙ ∙-assoc (! (! (snd h))) (! (snd g)) (snd g)
∙ ap (! (! (snd h)) ∙_) (!-inv-l (snd g))
∙ ∙-unit-r (! (! (snd h)))
∙ !-! (snd h)
⊙Wedge-rec = ⊙WedgeRec.⊙f
⊙Wedge-rec-post∘ : ∀ {i j k l} {X : Ptd i} {Y : Ptd j} {Z : Ptd k} {W : Ptd l}
(k : Z ⊙→ W) (g : X ⊙→ Z) (h : Y ⊙→ Z)
→ k ⊙∘ ⊙Wedge-rec g h == ⊙Wedge-rec (k ⊙∘ g) (k ⊙∘ h)
⊙Wedge-rec-post∘ k g h = ⊙λ=
(Wedge-elim (λ _ → idp) (λ _ → idp)
(↓-='-in' $ ⊙WedgeRec.glue-β (k ⊙∘ g) (k ⊙∘ h)
∙ lemma (fst k) (snd g) (snd h) (snd k)
∙ ! (ap (ap (fst k)) (⊙WedgeRec.glue-β g h))
∙ ∘-ap (fst k) (fst (⊙Wedge-rec g h)) wglue))
idp
where
lemma : ∀ {i j} {A : Type i} {B : Type j} (f : A → B) {x y z : A} {w : B}
(p : x == z) (q : y == z) (r : f z == w)
→ (ap f p ∙ r) ∙ ! (ap f q ∙ r) == ap f (p ∙ ! q)
lemma f idp idp idp = idp
⊙Wedge-rec-η : ∀ {i j} {X : Ptd i} {Y : Ptd j}
→ ⊙Wedge-rec ⊙winl ⊙winr == ⊙idf (X ⊙∨ Y)
⊙Wedge-rec-η = ⊙λ=
(Wedge-elim (λ _ → idp) (λ _ → idp)
(↓-='-in' $ ap-idf wglue
∙ ! (!-! wglue)
∙ ! (⊙WedgeRec.glue-β ⊙winl ⊙winr)))
idp
module _ {i j} {X : Ptd i} {Y : Ptd j} where
add-wglue : de⊙ (X ⊙⊔ Y) → X ∨ Y
add-wglue (inl x) = winl x
add-wglue (inr y) = winr y
⊙add-wglue : X ⊙⊔ Y ⊙→ X ⊙∨ Y
⊙add-wglue = add-wglue , idp
module Fold {i} {X : Ptd i} = ⊙WedgeRec (⊙idf X) (⊙idf X)
fold = Fold.f
⊙fold = Fold.⊙f
module _ {i j} (X : Ptd i) (Y : Ptd j) where
module Projl = ⊙WedgeRec (⊙idf X) (⊙cst {X = Y})
module Projr = ⊙WedgeRec (⊙cst {X = X}) (⊙idf Y)
projl = Projl.f
projr = Projr.f
⊙projl = Projl.⊙f
⊙projr = Projr.⊙f
module _ {i i' j j'} {X : Ptd i} {X' : Ptd i'} {Y : Ptd j} {Y' : Ptd j'}
(eqX : X ⊙≃ X') (eqY : Y ⊙≃ Y') where
wedge-span-emap : SpanEquiv (wedge-span X Y) (wedge-span X' Y')
wedge-span-emap = ( span-map (fst (fst eqX)) (fst (fst eqY)) (idf _)
(comm-sqr λ _ → snd (fst eqX))
(comm-sqr λ _ → snd (fst eqY))
, snd eqX , snd eqY , idf-is-equiv _)
∨-emap : X ∨ Y ≃ X' ∨ Y'
∨-emap = Pushout-emap wedge-span-emap
⊙∨-emap : X ⊙∨ Y ⊙≃ X' ⊙∨ Y'
⊙∨-emap = ≃-to-⊙≃ ∨-emap (ap winl (snd (fst eqX)))
|
src/natools-chunked_strings.adb | faelys/natools | 0 | 1669 | ------------------------------------------------------------------------------
-- Copyright (c) 2011, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Strings;
with Ada.Strings.Fixed;
with Ada.Unchecked_Deallocation;
package body Natools.Chunked_Strings is
package Fixed renames Ada.Strings.Fixed;
type Relation is (Equal, Greater, Lesser);
-----------------------
-- Local subprograms --
-----------------------
function Allocated_Size (Source : in Chunked_String) return Natural;
pragma Inline (Allocated_Size);
-- Return the number of Characters that can currently fit in Source
function Chunks_For (Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive)
return Natural;
pragma Inline (Chunks_For);
-- Return the number of chunks to accommodate Size characters
generic
type Map_Type is private;
with function Count (Source : in String;
Pattern : in String;
Mapping : in Map_Type)
return Natural;
function Count_Gen (Source : in Chunked_String;
Pattern : in String;
Mapping : in Map_Type)
return Natural;
-- Count the number of non-overlapping occurrences of the pattern
function Compare
(Left : in Chunk_Array;
Left_Size : in Natural;
Right : in Chunk_Array;
Right_Size : in Natural)
return Relation;
function Compare
(Left : in Chunk_Array_Access;
Left_Size : in Natural;
Right : in Chunk_Array_Access;
Right_Size : in Natural)
return Relation;
function Compare
(Left : in Chunk_Array;
Left_Size : in Natural;
Right : in String)
return Relation;
function Compare
(Left : in Chunk_Array_Access;
Left_Size : in Natural;
Right : in String)
return Relation;
-- String comparisons
procedure Fill (Data : in out Chunk_Array;
From : in Positive;
Count : in Natural;
C : in Character;
Chunk_Size : in Positive);
-- Fill an area of the chunks with the given Character
procedure Free (Data : in out Chunk_Array_Access);
-- Free data associated to all chunks and to the chunk array
generic
type Map_Type is private;
with function Index
(Source : String;
Pattern : String;
From : Positive;
Going : Ada.Strings.Direction;
Map : Map_Type)
return Natural;
function Index_Gen
(Source : Chunked_String;
Pattern : String;
From : Positive;
Going : Ada.Strings.Direction;
Map : Map_Type)
return Natural;
-- Search for a pattern in a source as described in the ARM
procedure Move (Target : in out Chunk_Array;
Target_Position : in Positive;
Source : in out Chunk_Array;
Source_Position : in Positive;
Length : in Natural);
-- Moves characters from one Chunk_Array to another, even when they
-- do not have the same chunk size
procedure Move (Target : in out Chunk_Array;
Source : in String;
Position : in Positive;
Chunk_Size : in Positive);
-- Writes the string in the chunk array, which must be large enough
procedure Move (Target : out String;
Source : in Chunk_Array;
From : in Positive);
-- Fills a string using characters from the Chunk_Array
procedure Move (Data : in out Chunk_Array;
Target_Position : in Positive;
Source_Position : in Positive;
Length : in Positive;
Chunk_Size : in Positive);
-- Move a slice of data inside a given chunk array
procedure Resize_Chunk (Chunk : in out String_Access;
Size : in Positive);
-- Resize a chunk to the target set
procedure Resize_Chunks (Data : in out Chunk_Array_Access;
Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive;
Can_Shrink : in Boolean := True);
-- Resize Data to fit Size characters
procedure Trim_Bounds (Source : in Chunked_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set;
Low : out Positive;
High : out Natural);
-- Compute slice bounds of the trimmed result
function Units_For (Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive)
return Natural;
pragma Inline (Units_For);
-- Return the number of allocation units in the last chunk
---------------------------------------
-- Chunked_String memory subprograms --
---------------------------------------
function Allocated_Size (Source : in Chunked_String) return Natural is
begin
if Source.Data = null or else Source.Data'Last < 1 then
return 0;
end if;
return (Source.Data'Last - 1) * Source.Chunk_Size
+ Source.Data (Source.Data'Last)'Last;
end Allocated_Size;
function Chunks_For (Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive)
return Natural is
begin
pragma Unreferenced (Allocation_Unit);
return (Size + Chunk_Size - 1) / Chunk_Size;
end Chunks_For;
procedure Free (Data : in out Chunk_Array_Access) is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Chunk_Array, Chunk_Array_Access);
begin
if Data = null then
return;
end if;
for J in Data'Range loop
Free (Data (J));
end loop;
Deallocate (Data);
end Free;
procedure Resize_Chunk (Chunk : in out String_Access;
Size : in Positive)
is
New_Chunk : String_Access;
begin
if Size /= Chunk'Length then
New_Chunk := new String (1 .. Size);
if Size < Chunk'Length then
New_Chunk.all := Chunk (Chunk'First .. Chunk'First + Size - 1);
else
New_Chunk.all (1 .. Chunk'Length) := Chunk.all;
end if;
Free (Chunk);
Chunk := New_Chunk;
end if;
end Resize_Chunk;
procedure Resize_Chunks (Data : in out Chunk_Array_Access;
Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive;
Can_Shrink : in Boolean := True)
is
procedure Deallocate is
new Ada.Unchecked_Deallocation (Chunk_Array, Chunk_Array_Access);
Chunk_Nb : constant Natural
:= Chunks_For (Size, Chunk_Size, Allocation_Unit);
Last_Chunk_Size : constant Natural
:= Units_For (Size, Chunk_Size, Allocation_Unit) * Allocation_Unit;
begin
if Size = 0 then
if Can_Shrink then
Free (Data);
end if;
return;
end if;
pragma Assert (Chunk_Nb > 0);
if Data = null or else Data'Length < Chunk_Nb then
declare
First_New : Positive := 1;
New_Data : constant Chunk_Array_Access
:= new Chunk_Array (1 .. Chunk_Nb);
begin
if Data /= null then
Resize_Chunk (Data (Data'Last), Chunk_Size);
New_Data (1 .. Data'Last) := Data.all;
First_New := Data'Last + 1;
Deallocate (Data);
end if;
Data := New_Data;
for J in First_New .. Data'Last - 1 loop
Data (J) := new String (1 .. Chunk_Size);
end loop;
Data (Data'Last) := new String (1 .. Last_Chunk_Size);
end;
elsif Data'Length > Chunk_Nb then
if Can_Shrink then
declare
New_Data : constant Chunk_Array_Access
:= new Chunk_Array (1 .. Chunk_Nb);
begin
Resize_Chunk (Data (Chunk_Nb), Last_Chunk_Size);
for J in Chunk_Nb + 1 .. Data'Last loop
Free (Data (J));
end loop;
New_Data.all := Data (1 .. Chunk_Nb);
Data := New_Data;
end;
end if;
else -- Data'Length = Chunk_Nb
if Last_Chunk_Size > Data (Data'Last).all'Last or Can_Shrink then
Resize_Chunk (Data (Data'Last), Last_Chunk_Size);
end if;
end if;
end Resize_Chunks;
function Units_For (Size : in Natural;
Chunk_Size : in Positive;
Allocation_Unit : in Positive)
return Natural is
begin
return (((Size + Chunk_Size - 1) mod Chunk_Size + 1)
+ Allocation_Unit - 1) / Allocation_Unit;
end Units_For;
---------------------------
-- Low-level subprograms --
---------------------------
function Compare
(Left : in Chunk_Array;
Left_Size : in Natural;
Right : in Chunk_Array;
Right_Size : in Natural)
return Relation
is
L_Chunk : Positive := Left'First;
L_Pos : Positive := Left (L_Chunk).all'First;
L_Remain : Natural := Left_Size;
R_Chunk : Positive := Right'First;
R_Pos : Positive := Right (R_Chunk).all'First;
R_Remain : Natural := Right_Size;
Step : Positive;
begin
loop
Step := Positive'Min
(Natural'Min (Left (L_Chunk).all'Last - L_Pos + 1,
L_Remain),
Natural'Min (Right (R_Chunk).all'Last - R_Pos + 1,
R_Remain));
declare
L_Part : String
renames Left (L_Chunk).all (L_Pos .. L_Pos + Step - 1);
R_Part : String
renames Right (R_Chunk).all (R_Pos .. R_Pos + Step - 1);
begin
if L_Part < R_Part then
return Lesser;
elsif L_Part > R_Part then
return Greater;
end if;
end;
L_Remain := L_Remain - Step;
R_Remain := R_Remain - Step;
if L_Remain = 0 and R_Remain = 0 then
return Equal;
elsif L_Remain = 0 then
return Lesser;
elsif R_Remain = 0 then
return Greater;
end if;
L_Pos := L_Pos + Step;
R_Pos := R_Pos + Step;
if L_Pos > Left (L_Chunk).all'Last then
-- L_Chunk cannot be Left'Last because L_Remain > 0
L_Chunk := L_Chunk + 1;
L_Pos := Left (L_Chunk).all'First;
end if;
if R_Pos > Right (R_Chunk).all'Last then
-- R_Chunk cannot be Right'Last because R_Remain > 0
R_Chunk := R_Chunk + 1;
R_Pos := Right (R_Chunk).all'First;
end if;
end loop;
end Compare;
function Compare
(Left : in Chunk_Array_Access;
Left_Size : in Natural;
Right : in Chunk_Array_Access;
Right_Size : in Natural)
return Relation is
begin
if Left = null or Left_Size = 0 then
if Right = null or Right_Size = 0 then
return Equal;
else
return Lesser;
end if;
else
if Right = null or Right_Size = 0 then
return Greater;
else
return Compare (Left.all, Left_Size, Right.all, Right_Size);
end if;
end if;
end Compare;
function Compare
(Left : in Chunk_Array;
Left_Size : in Natural;
Right : in String)
return Relation
is
Chunk : Positive := Left'First;
L_Pos : Positive := Left (Chunk).all'First;
L_Remain : Natural := Left_Size;
R_Pos : Positive := Right'First;
Step : Positive;
begin
loop
Step
:= Positive'Min (Positive'Min (Left (Chunk).all'Last - L_Pos + 1,
L_Remain),
Right'Last - R_Pos + 1);
declare
L_Part : String
renames Left (Chunk).all (L_Pos .. L_Pos + Step - 1);
R_Part : String
renames Right (R_Pos .. R_Pos + Step - 1);
begin
if L_Part < R_Part then
return Lesser;
elsif L_Part > R_Part then
return Greater;
end if;
end;
L_Remain := L_Remain - Step;
if L_Remain = 0 then
if R_Pos + Step > Right'Last then
return Equal;
else
return Lesser;
end if;
end if;
L_Pos := L_Pos + Step;
R_Pos := R_Pos + Step;
if L_Pos > Left (Chunk).all'Last then
-- _Chunk cannot be Left'Last because L_Remain > 0
Chunk := Chunk + 1;
L_Pos := Left (Chunk).all'First;
end if;
if R_Pos > Right'Last then
return Greater;
end if;
end loop;
end Compare;
function Compare
(Left : in Chunk_Array_Access;
Left_Size : in Natural;
Right : in String)
return Relation is
begin
if Left = null or Left_Size = 0 then
if Right'Length = 0 then
return Equal;
else
return Lesser;
end if;
else
if Right'Length = 0 then
return Greater;
else
return Compare (Left.all, Left_Size, Right);
end if;
end if;
end Compare;
procedure Fill (Data : in out Chunk_Array;
From : in Positive;
Count : in Natural;
C : in Character;
Chunk_Size : in Positive)
is
Chunk : Positive := (From - 1) / Chunk_Size + 1;
Offset : Positive := (From - 1) mod Chunk_Size + 1;
Done : Natural := 0;
Step : Positive;
begin
while Done < Count loop
Step := Positive'Min (Count - Done,
Data (Chunk).all'Last - Offset + 1);
Data (Chunk).all (Offset .. Offset + Step - 1)
:= Ada.Strings.Fixed."*" (Step, C);
Chunk := Chunk + 1;
Offset := 1;
Done := Done + Step;
end loop;
end Fill;
function Is_Valid (Source : in Chunked_String) return Boolean is
begin
-- Null data is only acceptable when the string is empty.
if Source.Data = null then
return Source.Size = 0;
end if;
-- Data array must contain non-null chunks of even size
declare
D : Chunk_Array renames Source.Data.all;
begin
if D'First /= 1 then
return False;
end if;
for J in D'Range loop
if D (J) = null then
return False;
end if;
if D (J).all'First /= 1 or
(J < D'Last and D (J).all'Last /= Source.Chunk_Size)
then
return False;
end if;
end loop;
end;
-- Real size must be smaller than allocated size
if Source.Size > Allocated_Size (Source) then
return False;
end if;
return True;
end Is_Valid;
procedure Move (Target : in out Chunk_Array;
Target_Position : in Positive;
Source : in out Chunk_Array;
Source_Position : in Positive;
Length : in Natural)
is
Count : Natural := 0;
S_Chunk : Positive;
S_Pos : Positive;
T_Chunk : Positive;
T_Pos : Positive;
begin
S_Chunk := Target'First;
S_Pos := 1;
while S_Pos + Source (S_Chunk).all'Length <= Source_Position loop
S_Pos := S_Pos + Source (S_Chunk).all'Length;
S_Chunk := S_Chunk + 1;
end loop;
S_Pos := Source_Position + 1 - S_Pos;
T_Chunk := Target'First;
T_Pos := 1;
while T_Pos + Target (T_Chunk).all'Length <= Target_Position loop
T_Pos := T_Pos + Target (T_Chunk).all'Length;
T_Chunk := T_Chunk + 1;
end loop;
T_Pos := Target_Position + 1 - T_Pos;
while Count < Length loop
declare
S_String : String renames Source (S_Chunk).all;
T_String : String renames Target (T_Chunk).all;
Step_C : constant Positive := Length - Count;
Step_S : constant Positive := S_String'Last - S_Pos + 1;
Step_T : constant Positive := T_String'Last - T_Pos + 1;
Step : constant Positive
:= Positive'Min (Step_C, Positive'Min (Step_S, Step_T));
begin
T_String (T_Pos .. T_Pos + Step - 1)
:= S_String (S_Pos .. S_Pos + Step - 1);
Count := Count + Step;
exit when Count >= Length;
S_Pos := S_Pos + Step;
T_Pos := T_Pos + Step;
if S_Pos > S_String'Last then
S_Chunk := S_Chunk + 1;
S_Pos := Source (S_Chunk).all'First;
end if;
if T_Pos > T_String'Last then
T_Chunk := T_Chunk + 1;
T_Pos := Target (T_Chunk).all'First;
end if;
end;
end loop;
end Move;
procedure Move (Target : in out Chunk_Array;
Source : in String;
Position : in Positive;
Chunk_Size : in Positive)
is
Last_Position : constant Positive := Position + Source'Length - 1;
First_Chunk : constant Positive := (Position - 1) / Chunk_Size + 1;
First_Offset : constant Positive := (Position - 1) mod Chunk_Size + 1;
Last_Chunk : constant Positive
:= (Last_Position - 1) / Chunk_Size + 1;
Last_Offset : constant Positive
:= (Last_Position - 1) mod Chunk_Size + 1;
Current : Positive;
begin
if First_Chunk = Last_Chunk then
Target (First_Chunk).all (First_Offset .. Last_Offset) := Source;
else
Current := Source'First + Chunk_Size - First_Offset + 1;
Target (First_Chunk).all (First_Offset .. Chunk_Size)
:= Source (Source'First .. Current - 1);
for J in First_Chunk + 1 .. Last_Chunk - 1 loop
Target (J).all := Source (Current .. Current + Chunk_Size - 1);
Current := Current + Chunk_Size;
end loop;
Target (Last_Chunk).all (1 .. Last_Offset)
:= Source (Current .. Source'Last);
end if;
end Move;
procedure Move (Target : out String;
Source : in Chunk_Array;
From : in Positive)
is
T_Pos : Positive := Target'First;
S_Pos : Positive := 1;
Chunk : Positive := 1;
Step : Positive;
begin
while S_Pos + Source (Chunk).all'Length <= From loop
S_Pos := S_Pos + Source (Chunk).all'Length;
Chunk := Chunk + 1;
end loop;
S_Pos := From - S_Pos + 1;
Step := Source (Chunk).all'Last - S_Pos + 1;
if Target'Length <= Step then
Target := Source (Chunk).all (S_Pos .. S_Pos + Target'Length - 1);
return;
end if;
Target (T_Pos .. T_Pos + Step - 1)
:= Source (Chunk).all (S_Pos .. Source (Chunk).all'Last);
T_Pos := T_Pos + Step;
Chunk := Chunk + 1;
while T_Pos <= Target'Last loop
Step := Positive'Min (Source (Chunk).all'Length,
Target'Last - T_Pos + 1);
Target (T_Pos .. T_Pos + Step - 1)
:= Source (Chunk).all (1 .. Step);
T_Pos := T_Pos + Step;
Chunk := Chunk + 1;
end loop;
end Move;
procedure Move (Data : in out Chunk_Array;
Target_Position : in Positive;
Source_Position : in Positive;
Length : in Positive;
Chunk_Size : in Positive) is
begin
if Target_Position < Source_Position then
declare
S_Chunk : Positive := (Source_Position - 1) / Chunk_Size + 1;
S_Pos : Positive := (Source_Position - 1) mod Chunk_Size + 1;
T_Chunk : Positive := (Target_Position - 1) / Chunk_Size + 1;
T_Pos : Positive := (Target_Position - 1) mod Chunk_Size + 1;
Count : Natural := 0;
Step : Positive;
begin
while Count < Length loop
Step := Positive'Min
(Positive'Min (Data (S_Chunk).all'Last - S_Pos + 1,
Data (T_Chunk).all'Last - T_Pos + 1),
Length - Count);
Data (T_Chunk).all (T_Pos .. T_Pos + Step - 1)
:= Data (S_Chunk).all (S_Pos .. S_Pos + Step - 1);
Count := Count + Step;
S_Pos := S_Pos + Step;
if S_Pos > Chunk_Size then
S_Chunk := S_Chunk + 1;
S_Pos := 1;
end if;
T_Pos := T_Pos + Step;
if T_Pos > Chunk_Size then
T_Chunk := T_Chunk + 1;
T_Pos := 1;
end if;
end loop;
end;
elsif Target_Position > Source_Position then
declare
S_End : constant Positive := Source_Position + Length - 1;
T_End : constant Positive := Target_Position + Length - 1;
S_Chunk : Positive := (S_End - 1) / Chunk_Size + 1;
S_Pos : Positive := (S_End - 1) mod Chunk_Size + 1;
T_Chunk : Positive := (T_End - 1) / Chunk_Size + 1;
T_Pos : Positive := (T_End - 1) mod Chunk_Size + 1;
Count : Natural := 0;
Step : Positive;
begin
loop
Step := Positive'Min (Positive'Min (S_Pos, T_Pos),
Length - Count);
Data (T_Chunk).all (T_Pos - Step + 1 .. T_Pos)
:= Data (S_Chunk).all (S_Pos - Step + 1 .. S_Pos);
Count := Count + Step;
exit when Count = Length;
pragma Assert (Count < Length);
if S_Pos <= Step then
S_Chunk := S_Chunk - 1;
S_Pos := Chunk_Size;
else
S_Pos := S_Pos - Step;
end if;
if T_Pos <= Step then
T_Chunk := T_Chunk - 1;
T_Pos := Chunk_Size;
else
T_Pos := T_Pos - Step;
end if;
end loop;
end;
end if;
end Move;
--------------------------------------------------
-- Public interface specific to Chunked_Strings --
--------------------------------------------------
function Build (Depth : Positive)
return Natools.Accumulators.String_Accumulator'Class
is
pragma Unreferenced (Depth);
begin
return Null_Chunked_String;
end Build;
function Duplicate (Source : in Chunked_String) return Chunked_String is
Data : Chunk_Array_Access := null;
begin
if Source.Data /= null then
Data := new Chunk_Array (Source.Data'Range);
for J in Source.Data'Range loop
Data (J) := new String'(Source.Data (J).all);
end loop;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Source.Chunk_Size,
Allocation_Unit => Source.Allocation_Unit,
Size => Source.Size,
Data => Data);
end Duplicate;
procedure Hard_Reset (Str : in out Chunked_String) is
begin
Str.Size := 0;
Free (Str.Data);
end Hard_Reset;
procedure Soft_Reset (Str : in out Chunked_String) is
begin
Str.Size := 0;
end Soft_Reset;
procedure To_String (Source : Chunked_String; Output : out String) is
Position : Positive := Output'First;
Step : Positive;
begin
if Source.Size > 0 then
for J in Source.Data'Range loop
Step := Positive'Min (Source.Data (J).all'Length,
Source.Size - Position + 1);
Output (Position .. Position + Step - 1)
:= Source.Data (J).all (1 .. Step);
Position := Position + Step;
exit when Position > Source.Size;
end loop;
pragma Assert (Position = Source.Size + 1);
end if;
end To_String;
-------------------------------------------
-- String_Accumulator specific interface --
-------------------------------------------
function Tail (Source : in Chunked_String; Size : in Natural)
return String
is
Actual_Size : constant Natural := Natural'Min (Size, Source.Size);
begin
return Slice (Source, Source.Size - Actual_Size + 1, Source.Size);
end Tail;
procedure Unappend (From : in out Chunked_String; Text : in String) is
begin
if Text'Length <= From.Size
and then String'(Tail (From, Text'Length)) = Text
then
From.Size := From.Size - Text'Length;
end if;
end Unappend;
------------------------
-- Standard interface --
------------------------
function Length (Source : in Chunked_String) return Natural is
begin
return Source.Size;
end Length;
procedure Deallocate is
new Ada.Unchecked_Deallocation (String, String_Access);
procedure Free (X : in out String_Access) is
begin
Deallocate (X);
end Free;
procedure Free_Extra_Memory (From : in out Chunked_String) is
begin
Resize_Chunks (From.Data, From.Size,
From.Chunk_Size, From.Allocation_Unit,
Can_Shrink => True);
end Free_Extra_Memory;
procedure Preallocate (Str : in out Chunked_String; Size : Natural) is
begin
Resize_Chunks (Str.Data, Size, Str.Chunk_Size, Str.Allocation_Unit,
Can_Shrink => False);
end Preallocate;
function To_Chunked_String
(Source : in String;
Chunk_Size : in Positive := Default_Chunk_Size;
Allocation_Unit : in Positive := Default_Allocation_Unit)
return Chunked_String
is
Data : Chunk_Array_Access := null;
begin
if Source'Length > 0 then
Resize_Chunks (Data, Source'Length, Chunk_Size, Allocation_Unit);
Move (Data.all, Source, 1, Chunk_Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Source'Length,
Data => Data);
end To_Chunked_String;
function To_Chunked_String
(Length : in Natural;
Chunk_Size : in Positive := Default_Chunk_Size;
Allocation_Unit : in Positive := Default_Allocation_Unit)
return Chunked_String
is
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Length, Chunk_Size, Allocation_Unit);
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Length,
Data => Data);
end To_Chunked_String;
function To_String (Source : in Chunked_String) return String is
Value : String (1 .. Source.Size);
begin
To_String (Source, Value);
return Value;
end To_String;
procedure Set_Chunked_String
(Target : out Chunked_String;
Source : in String;
Chunk_Size : in Positive := Default_Chunk_Size;
Allocation_Unit : in Positive := Default_Allocation_Unit) is
begin
Resize_Chunks (Target.Data, Source'Length,
Chunk_Size, Allocation_Unit,
Can_Shrink => True);
Target.Chunk_Size := Chunk_Size;
Target.Allocation_Unit := Allocation_Unit;
Target.Size := Source'Length;
if Target.Size > 0 then
Move (Target.Data.all, Source, 1, Chunk_Size);
end if;
end Set_Chunked_String;
procedure Append (Source : in out Chunked_String;
New_Item : in Chunked_String)
is
New_Size : constant Natural := Source.Size + New_Item.Size;
begin
Resize_Chunks (Source.Data, New_Size,
Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
Move (Source.Data.all, Source.Size + 1,
New_Item.Data.all, 1,
New_Item.Size);
Source.Size := New_Size;
end Append;
procedure Append (Source : in out Chunked_String;
New_Item : in String)
is
New_Size : constant Natural := Source.Size + New_Item'Length;
begin
Resize_Chunks (Source.Data, New_Size,
Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
Move (Source.Data.all, New_Item, Source.Size + 1, Source.Chunk_Size);
Source.Size := New_Size;
end Append;
procedure Append (Source : in out Chunked_String;
New_Item : in Character)
is
S : constant String (1 .. 1) := (1 => New_Item);
begin
Append (Source, S);
end Append;
function "&" (Left, Right : in Chunked_String)
return Chunked_String
is
Size : constant Natural := Left.Size + Right.Size;
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Size, Default_Chunk_Size, Default_Allocation_Unit);
if Left.Size > 0 then
Move (Data.all, 1, Left.Data.all, 1, Left.Size);
end if;
if Right.Size > 0 then
Move (Data.all, 1 + Left.Size, Right.Data.all, 1, Right.Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Default_Chunk_Size,
Allocation_Unit => Default_Allocation_Unit,
Size => Size,
Data => Data);
end "&";
function "&" (Left : in Chunked_String; Right : in String)
return Chunked_String
is
Size : constant Natural := Left.Size + Right'Length;
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Size, Default_Chunk_Size, Default_Allocation_Unit);
if Left.Size > 0 then
Move (Data.all, 1, Left.Data.all, 1, Left.Size);
end if;
if Right'Length > 0 then
Move (Data.all, Right, 1 + Left.Size, Default_Chunk_Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Default_Chunk_Size,
Allocation_Unit => Default_Allocation_Unit,
Size => Size,
Data => Data);
end "&";
function "&" (Left : in String; Right : in Chunked_String)
return Chunked_String
is
Size : constant Natural := Left'Length + Right.Size;
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Size, Default_Chunk_Size, Default_Allocation_Unit);
if Left'Length > 0 then
Move (Data.all, Left, 1, Default_Chunk_Size);
end if;
if Right.Size > 0 then
Move (Data.all, 1 + Left'Length, Right.Data.all, 1, Right.Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Default_Chunk_Size,
Allocation_Unit => Default_Allocation_Unit,
Size => Size,
Data => Data);
end "&";
function "&" (Left : in Chunked_String; Right : in Character)
return Chunked_String
is
Size : constant Natural := Left.Size + 1;
Allocation_Unit : constant Positive := Default_Allocation_Unit;
Chunk_Size : constant Positive := Default_Chunk_Size;
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Size, Chunk_Size, Allocation_Unit);
if Left.Size > 0 then
Move (Data.all, 1, Left.Data.all, 1, Left.Size);
end if;
declare
Position : constant Positive := Left.Size + 1;
Chunk : constant Positive := (Position - 1) / Chunk_Size + 1;
Offset : constant Positive := (Position - 1) mod Chunk_Size + 1;
begin
Data (Chunk).all (Offset) := Right;
end;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Size,
Data => Data);
end "&";
function "&" (Left : in Character; Right : in Chunked_String)
return Chunked_String
is
Size : constant Natural := 1 + Right.Size;
Data : Chunk_Array_Access := null;
begin
Resize_Chunks (Data, Size, Default_Chunk_Size, Default_Allocation_Unit);
Data (1).all (1) := Left;
if Right.Size > 0 then
Move (Data.all, 2, Right.Data.all, 1, Right.Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Default_Chunk_Size,
Allocation_Unit => Default_Allocation_Unit,
Size => Size,
Data => Data);
end "&";
function Element (Source : in Chunked_String;
Index : in Positive)
return Character
is
Chunk : constant Positive := (Index - 1) / Source.Chunk_Size + 1;
Offset : constant Positive := (Index - 1) mod Source.Chunk_Size + 1;
begin
if Index > Source.Size then
raise Ada.Strings.Index_Error;
end if;
return Source.Data (Chunk).all (Offset);
end Element;
procedure Replace_Element (Source : in out Chunked_String;
Index : in Positive;
By : in Character)
is
Chunk : constant Positive := (Index - 1) / Source.Chunk_Size + 1;
Offset : constant Positive := (Index - 1) mod Source.Chunk_Size + 1;
begin
if Index > Source.Size then
raise Ada.Strings.Index_Error;
end if;
Source.Data (Chunk).all (Offset) := By;
end Replace_Element;
function Slice (Source : in Chunked_String;
Low : in Positive;
High : in Natural)
return String
is
Returned : String (Low .. High);
begin
if Low > Source.Size + 1 or High > Source.Size then
raise Ada.Strings.Index_Error;
end if;
if High >= Low then
Move (Returned, Source.Data.all, Low);
end if;
return Returned;
end Slice;
function Chunked_Slice
(Source : in Chunked_String;
Low : in Positive;
High : in Natural;
Chunk_Size : in Positive := Default_Chunk_Size;
Allocation_Unit : in Positive := Default_Allocation_Unit)
return Chunked_String
is
Data : Chunk_Array_Access := null;
Size : Natural := 0;
begin
if Low > Source.Size + 1 or High > Source.Size then
raise Ada.Strings.Index_Error;
end if;
if Low <= High then
Size := High - Low + 1;
Resize_Chunks (Data, Size, Chunk_Size, Allocation_Unit);
Move (Data.all, 1, Source.Data.all, Low, Size);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Size,
Data => Data);
end Chunked_Slice;
procedure Chunked_Slice
(Source : in Chunked_String;
Target : out Chunked_String;
Low : in Positive;
High : in Natural;
Chunk_Size : in Positive := Default_Chunk_Size;
Allocation_Unit : in Positive := Default_Allocation_Unit) is
begin
if Low > Source.Size + 1 or High > Source.Size then
raise Ada.Strings.Index_Error;
end if;
Target.Chunk_Size := Chunk_Size;
Target.Allocation_Unit := Allocation_Unit;
if Low <= High then
Target.Size := High - Low + 1;
Resize_Chunks (Target.Data, Target.Size,
Chunk_Size, Allocation_Unit,
Can_Shrink => True);
Move (Target.Data.all, 1, Source.Data.all, Low, Target.Size);
else
Target.Size := 0;
Target.Data := null;
end if;
end Chunked_Slice;
function "=" (Left, Right : in Chunked_String) return Boolean is
begin
return Compare (Left.Data, Left.Size, Right.Data, Right.Size) = Equal;
end "=";
function "=" (Left : in Chunked_String; Right : in String)
return Boolean is
begin
return Compare (Left.Data, Left.Size, Right) = Equal;
end "=";
function "=" (Left : in String; Right : in Chunked_String)
return Boolean is
begin
return Compare (Right.Data, Right.Size, Left) = Equal;
end "=";
function "<" (Left, Right : in Chunked_String) return Boolean is
begin
return Compare (Left.Data, Left.Size, Right.Data, Right.Size) = Lesser;
end "<";
function "<" (Left : in Chunked_String; Right : in String)
return Boolean is
begin
return Compare (Left.Data, Left.Size, Right) = Lesser;
end "<";
function "<" (Left : in String; Right : in Chunked_String)
return Boolean is
begin
return Compare (Right.Data, Right.Size, Left) = Greater;
end "<";
function "<=" (Left, Right : in Chunked_String) return Boolean is
begin
return Compare (Left.Data, Left.Size, Right.Data, Right.Size) /= Greater;
end "<=";
function "<=" (Left : in Chunked_String; Right : in String)
return Boolean is
begin
return Compare (Left.Data, Left.Size, Right) /= Greater;
end "<=";
function "<=" (Left : in String; Right : in Chunked_String)
return Boolean is
begin
return Compare (Right.Data, Right.Size, Left) /= Lesser;
end "<=";
function ">" (Left, Right : in Chunked_String) return Boolean is
begin
return Compare (Left.Data, Left.Size, Right.Data, Right.Size) = Greater;
end ">";
function ">" (Left : in Chunked_String; Right : in String)
return Boolean is
begin
return Compare (Left.Data, Left.Size, Right) = Greater;
end ">";
function ">" (Left : in String; Right : in Chunked_String)
return Boolean is
begin
return Compare (Right.Data, Right.Size, Left) = Lesser;
end ">";
function ">=" (Left, Right : in Chunked_String) return Boolean is
begin
return Compare (Left.Data, Left.Size, Right.Data, Right.Size) /= Lesser;
end ">=";
function ">=" (Left : in Chunked_String; Right : in String)
return Boolean is
begin
return Compare (Left.Data, Left.Size, Right) /= Lesser;
end ">=";
function ">=" (Left : in String; Right : in Chunked_String)
return Boolean is
begin
return Compare (Right.Data, Right.Size, Left) /= Greater;
end ">=";
function Index_Gen
(Source : Chunked_String;
Pattern : String;
From : Positive;
Going : Ada.Strings.Direction;
Map : Map_Type)
return Natural is
begin
if Pattern = "" then
raise Ada.Strings.Pattern_Error;
end if;
if Source.Size = 0 and From = 1 then
return 0;
end if;
if From > Source.Size then
raise Ada.Strings.Index_Error;
end if;
declare
Chunk : Positive := (From - 1) / Source.Chunk_Size + 1;
Offset : Positive := (From - 1) mod Source.Chunk_Size + 1;
Buffer : String (1 .. Source.Chunk_Size + Pattern'Length - 1);
Result : Natural;
Span : Positive;
begin
case (Going) is
when Ada.Strings.Forward =>
while (Chunk - 1) * Source.Chunk_Size + Pattern'Length
<= Source.Size
loop
Span := Positive'Min
(Source.Chunk_Size + Pattern'Length - 1,
Source.Size - (Chunk - 1) * Source.Chunk_Size);
Move (Buffer (1 .. Span),
Source.Data.all,
(Chunk - 1) * Source.Chunk_Size + 1);
Result := Index (Buffer (1 .. Span),
Pattern, Offset, Going, Map);
if Result /= 0 then
return (Chunk - 1) * Source.Chunk_Size + Result;
end if;
Chunk := Chunk + 1;
Offset := 1;
end loop;
return 0;
when Ada.Strings.Backward =>
loop
Span := Positive'Min
(Source.Chunk_Size + Pattern'Length - 1,
Source.Size - (Chunk - 1) * Source.Chunk_Size);
Move (Buffer (1 .. Span),
Source.Data.all,
(Chunk - 1) * Source.Chunk_Size + 1);
Result := Index (Buffer (1 .. Span),
Pattern, Offset, Going, Map);
if Result /= 0 then
return (Chunk - 1) * Source.Chunk_Size + Result;
end if;
exit when Chunk = 1;
Chunk := Chunk - 1;
Offset := Positive'Min (Source.Chunk_Size + Pattern'Length - 1,
Source.Chunk_Size + Offset);
end loop;
return 0;
end case;
end;
end Index_Gen;
function Index_Mapping is
new Index_Gen (Maps.Character_Mapping, Ada.Strings.Fixed.Index);
function Index (Source : in Chunked_String;
Pattern : in String;
From : in Positive;
Going : in Ada.Strings.Direction := Ada.Strings.Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
renames Index_Mapping;
function Index_Mapping_Function is
new Index_Gen (Maps.Character_Mapping_Function, Ada.Strings.Fixed.Index);
function Index (Source : in Chunked_String;
Pattern : in String;
From : in Positive;
Going : in Ada.Strings.Direction := Ada.Strings.Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural
renames Index_Mapping_Function;
function Index (Source : in Chunked_String;
Pattern : in String;
Going : in Ada.Strings.Direction := Ada.Strings.Forward;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural is
begin
case (Going) is
when Ada.Strings.Forward =>
return Index (Source, Pattern, 1, Going, Mapping);
when Ada.Strings.Backward =>
return Index (Source, Pattern, Source.Size, Going, Mapping);
end case;
end Index;
function Index (Source : in Chunked_String;
Pattern : in String;
Going : in Ada.Strings.Direction := Ada.Strings.Forward;
Mapping : in Maps.Character_Mapping_Function)
return Natural is
begin
case (Going) is
when Ada.Strings.Forward =>
return Index (Source, Pattern, 1, Going, Mapping);
when Ada.Strings.Backward =>
return Index (Source, Pattern, Source.Size, Going, Mapping);
end case;
end Index;
function Index (Source : in Chunked_String;
Set : in Maps.Character_Set;
From : in Positive;
Test : in Ada.Strings.Membership := Ada.Strings.Inside;
Going : in Ada.Strings.Direction := Ada.Strings.Forward)
return Natural
is
Chunk : Positive := (From - 1) / Source.Chunk_Size + 1;
Offset : Positive := (From - 1) mod Source.Chunk_Size + 1;
Result : Natural;
begin
if From > Source.Size then
raise Ada.Strings.Index_Error;
end if;
case (Going) is
when Ada.Strings.Forward =>
loop
Result := Ada.Strings.Fixed.Index
(Source.Data (Chunk).all
(1 .. Positive'Min (Source.Size
- (Chunk - 1) * Source.Chunk_Size,
Source.Chunk_Size)),
Set, Offset, Test, Going);
if Result /= 0 then
return (Chunk - 1) * Source.Chunk_Size + Result;
end if;
if Chunk = Source.Data'Last then
return 0;
end if;
Chunk := Chunk + 1;
Offset := 1;
end loop;
when Ada.Strings.Backward =>
loop
Result := Ada.Strings.Fixed.Index
(Source.Data (Chunk).all
(1 .. Positive'Min (Source.Size
- (Chunk - 1) * Source.Chunk_Size,
Source.Chunk_Size)),
Set, Offset, Test, Going);
if Result /= 0 then
return (Chunk - 1) * Source.Chunk_Size + Result;
end if;
if Chunk = Source.Data'First then
return 0;
end if;
Chunk := Chunk - 1;
Offset := Source.Chunk_Size;
end loop;
end case;
end Index;
function Index (Source : in Chunked_String;
Set : in Maps.Character_Set;
Test : in Ada.Strings.Membership := Ada.Strings.Inside;
Going : in Ada.Strings.Direction := Ada.Strings.Forward)
return Natural is
begin
case Going is
when Ada.Strings.Forward =>
return Index (Source, Set, 1, Test, Going);
when Ada.Strings.Backward =>
return Index (Source, Set, Source.Size, Test, Going);
end case;
end Index;
function Index_Non_Blank (Source : in Chunked_String;
From : in Positive;
Going : in Ada.Strings.Direction
:= Ada.Strings.Forward)
return Natural is
begin
return Index (Source,
Maps.To_Set (Ada.Strings.Space),
From,
Ada.Strings.Outside,
Going);
end Index_Non_Blank;
function Index_Non_Blank (Source : in Chunked_String;
Going : in Ada.Strings.Direction
:= Ada.Strings.Forward)
return Natural is
begin
return Index (Source,
Maps.To_Set (Ada.Strings.Space),
Ada.Strings.Outside,
Going);
end Index_Non_Blank;
function Count_Gen (Source : in Chunked_String;
Pattern : in String;
Mapping : in Map_Type)
return Natural
is
Buffer : String (1 .. Source.Chunk_Size + Pattern'Length - 1);
Result : Natural := 0;
Step : Positive;
begin
if Pattern = "" then
raise Ada.Strings.Pattern_Error;
end if;
if Source.Size < Pattern'Length then
return 0;
end if;
for J in Source.Data'Range loop
Step := Positive'Min (Source.Size - (J - 1) * Source.Chunk_Size,
Source.Chunk_Size + Pattern'Length - 1);
Move (Buffer (1 .. Step),
Source.Data.all,
(J - 1) * Source.Chunk_Size + 1);
Result := Result + Count (Buffer (1 .. Step),
Pattern,
Mapping);
end loop;
return Result;
end Count_Gen;
function Count_Mapping is
new Count_Gen (Maps.Character_Mapping, Ada.Strings.Fixed.Count);
function Count (Source : in Chunked_String;
Pattern : in String;
Mapping : in Maps.Character_Mapping := Maps.Identity)
return Natural
renames Count_Mapping;
function Count_Mapping_Function is
new Count_Gen (Maps.Character_Mapping_Function, Ada.Strings.Fixed.Count);
function Count (Source : in Chunked_String;
Pattern : in String;
Mapping : in Maps.Character_Mapping_Function)
return Natural
renames Count_Mapping_Function;
function Count (Source : in Chunked_String;
Set : in Maps.Character_Set)
return Natural
is
Result : Natural := 0;
Done : Natural := 0;
begin
if Source.Size > 0 then
for C in Source.Data'Range loop
declare
Chunk : String renames Source.Data (C).all;
Step : constant Natural
:= Natural'Min (Source.Size - Done, Chunk'Length);
begin
Result := Result + Ada.Strings.Fixed.Count
(Chunk (Chunk'First .. Chunk'First + Step - 1), Set);
Done := Done + Step;
end;
end loop;
end if;
return Result;
end Count;
procedure Find_Token (Source : in Chunked_String;
Set : in Maps.Character_Set;
Test : in Ada.Strings.Membership;
First : out Positive;
Last : out Natural)
is
Invert : constant array (Ada.Strings.Membership)
of Ada.Strings.Membership
:= (Ada.Strings.Inside => Ada.Strings.Outside,
Ada.Strings.Outside => Ada.Strings.Inside);
N : Natural;
begin
N := Index (Source, Set, Test);
if N = 0 then
First := 1;
Last := 0;
else
First := N;
N := Index (Source, Set, First, Invert (Test));
if N = 0 then
Last := Source.Size;
else
Last := N - 1;
end if;
end if;
end Find_Token;
-- String translation subprograms
function Translate (Source : in Chunked_String;
Mapping : in Maps.Character_Mapping)
return Chunked_String
is
Data : Chunk_Array_Access := null;
begin
if Source.Data /= null then
Data := new Chunk_Array (Source.Data'Range);
for J in Source.Data'Range loop
Data (J) := new String (Source.Data (J).all'Range);
Data (J).all := Fixed.Translate (Source.Data (J).all, Mapping);
end loop;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Source.Chunk_Size,
Allocation_Unit => Source.Allocation_Unit,
Size => Source.Size,
Data => Data);
end Translate;
procedure Translate (Source : in out Chunked_String;
Mapping : in Maps.Character_Mapping) is
begin
if Source.Data /= null then
for J in Source.Data'Range loop
Fixed.Translate (Source.Data (J).all, Mapping);
end loop;
end if;
end Translate;
function Translate (Source : in Chunked_String;
Mapping : in Maps.Character_Mapping_Function)
return Chunked_String
is
Data : Chunk_Array_Access := null;
begin
if Source.Data /= null then
Data := new Chunk_Array (Source.Data'Range);
for J in Source.Data'Range loop
Data (J) := new String (Source.Data (J).all'Range);
Data (J).all := Fixed.Translate (Source.Data (J).all, Mapping);
end loop;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Source.Chunk_Size,
Allocation_Unit => Source.Allocation_Unit,
Size => Source.Size,
Data => Data);
end Translate;
procedure Translate (Source : in out Chunked_String;
Mapping : in Maps.Character_Mapping_Function) is
begin
if Source.Data /= null then
for J in Source.Data'Range loop
Fixed.Translate (Source.Data (J).all, Mapping);
end loop;
end if;
end Translate;
-- String transformation subprograms
function Replace_Slice (Source : in Chunked_String;
Low : in Positive;
High : in Natural;
By : in String)
return Chunked_String
is
Size : Natural := 0;
Data : Chunk_Array_Access := null;
Hi : Natural := High;
begin
if Low > Source.Size + 1 then
raise Ada.Strings.Index_Error;
end if;
if High < Low then
Hi := Low - 1;
end if;
Size := (Low - 1) + By'Length + (Source.Size - Hi);
Resize_Chunks (Data, Size, Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
if Low > 1 then
Move (Data.all, 1, Source.Data.all, 1, Low - 1);
end if;
if By'Length > 0 then
Move (Data.all, By, Low, Source.Chunk_Size);
end if;
if Hi < Source.Size then
Move (Data.all, Low + By'Length, Source.Data.all, Hi + 1,
Source.Size - Hi);
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Source.Chunk_Size,
Allocation_Unit => Source.Allocation_Unit,
Size => Size,
Data => Data);
end Replace_Slice;
procedure Replace_Slice (Source : in out Chunked_String;
Low : in Positive;
High : in Natural;
By : in String)
is
Size : Natural := 0;
Hi : Natural := High;
begin
if Low > Source.Size + 1 then
raise Ada.Strings.Index_Error;
end if;
if High < Low then
Hi := Low - 1;
end if;
Size := (Low - 1) + By'Length + (Source.Size - Hi);
Resize_Chunks (Source.Data, Size,
Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
if Hi < Source.Size and Low + By'Length /= Hi + 1 then
Move (Data => Source.Data.all,
Target_Position => Low + By'Length,
Source_Position => Hi + 1,
Length => Source.Size - Hi,
Chunk_Size => Source.Chunk_Size);
end if;
if By'Length > 0 then
Move (Source.Data.all, By, Low, Source.Chunk_Size);
end if;
Source.Size := Size;
end Replace_Slice;
function Insert (Source : in Chunked_String;
Before : in Positive;
New_Item : in String)
return Chunked_String is
begin
return Replace_Slice (Source, Before, Before - 1, New_Item);
end Insert;
procedure Insert (Source : in out Chunked_String;
Before : in Positive;
New_Item : in String) is
begin
Replace_Slice (Source, Before, Before - 1, New_Item);
end Insert;
function Overwrite (Source : in Chunked_String;
Position : in Positive;
New_Item : in String)
return Chunked_String is
begin
return Replace_Slice (Source, Position, Source.Size, New_Item);
end Overwrite;
procedure Overwrite (Source : in out Chunked_String;
Position : in Positive;
New_Item : in String) is
begin
Replace_Slice (Source,
Low => Position,
High => Natural'Min (Source.Size,
Position + New_Item'Length - 1),
By => New_Item);
end Overwrite;
function Delete (Source : in Chunked_String;
From : in Positive;
Through : in Natural)
return Chunked_String is
begin
if From <= Through then
return Replace_Slice (Source, From, Through, "");
else
return Duplicate (Source);
end if;
end Delete;
procedure Delete (Source : in out Chunked_String;
From : in Positive;
Through : in Natural) is
begin
if From <= Through then
Replace_Slice (Source, From, Through, "");
end if;
end Delete;
function Trim (Source : in Chunked_String;
Side : in Ada.Strings.Trim_End)
return Chunked_String is
begin
case Side is
when Ada.Strings.Left =>
return Trim (Source,
Maps.To_Set (Ada.Strings.Space),
Maps.Null_Set);
when Ada.Strings.Right =>
return Trim (Source,
Maps.Null_Set,
Maps.To_Set (Ada.Strings.Space));
when Ada.Strings.Both =>
return Trim (Source,
Maps.To_Set (Ada.Strings.Space),
Maps.To_Set (Ada.Strings.Space));
end case;
end Trim;
procedure Trim (Source : in out Chunked_String;
Side : in Ada.Strings.Trim_End) is
begin
case Side is
when Ada.Strings.Left =>
Trim (Source,
Maps.To_Set (Ada.Strings.Space),
Maps.Null_Set);
when Ada.Strings.Right =>
Trim (Source,
Maps.Null_Set,
Maps.To_Set (Ada.Strings.Space));
when Ada.Strings.Both =>
Trim (Source,
Maps.To_Set (Ada.Strings.Space),
Maps.To_Set (Ada.Strings.Space));
end case;
end Trim;
procedure Trim_Bounds (Source : in Chunked_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set;
Low : out Positive;
High : out Natural)
is
Chunk : Positive;
begin
Low := 1;
High := Source.Size;
Chunk := 1;
while Low <= High and then
Maps.Is_In (Source.Data (Chunk).all
(Low - (Chunk - 1) * Source.Chunk_Size),
Left)
loop
Low := Low + 1;
if Low mod Source.Chunk_Size = 1 then
Chunk := Chunk + 1;
end if;
end loop;
if High > 0 then
Chunk := (High - 1) / Source.Chunk_Size + 1;
while Low <= High and then
Maps.Is_In (Source.Data (Chunk).all
(High - (Chunk - 1) * Source.Chunk_Size),
Right)
loop
High := High - 1;
if High mod Source.Chunk_Size = 0 then
Chunk := Chunk - 1;
end if;
end loop;
end if;
end Trim_Bounds;
function Trim (Source : in Chunked_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
return Chunked_String
is
Low : Positive;
High : Natural;
begin
Trim_Bounds (Source, Left, Right, Low, High);
return Chunked_Slice (Source, Low, High,
Source.Chunk_Size, Source.Allocation_Unit);
end Trim;
procedure Trim (Source : in out Chunked_String;
Left : in Maps.Character_Set;
Right : in Maps.Character_Set)
is
Low : Positive;
High : Natural;
begin
Trim_Bounds (Source, Left, Right, Low, High);
if Low > 1 then
Move (Data => Source.Data.all,
Target_Position => 1,
Source_Position => Low,
Length => High - Low + 1,
Chunk_Size => Source.Chunk_Size);
end if;
Source.Size := High - Low + 1;
end Trim;
function Head (Source : in Chunked_String;
Count : in Natural;
Pad : in Character := Ada.Strings.Space;
Chunk_Size : in Natural := 0; -- use value from Source
Allocation_Unit : in Natural := 0) -- use value from Source
return Chunked_String
is
Real_Chunk_Size : Positive := Default_Chunk_Size;
Real_Unit : Positive := Default_Allocation_Unit;
Data : Chunk_Array_Access := null;
begin
if Chunk_Size > 0 then
Real_Chunk_Size := Chunk_Size;
end if;
if Allocation_Unit > 0 then
Real_Unit := Allocation_Unit;
end if;
if Count > 0 then
Resize_Chunks (Data, Count, Real_Chunk_Size, Real_Unit);
if Count > Source.Size then
Move (Data.all, 1, Source.Data.all, 1, Source.Size);
Fill (Data.all, Source.Size + 1,
Count - Source.Size, Pad, Real_Chunk_Size);
else
Move (Data.all, 1, Source.Data.all, 1, Count);
end if;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Real_Chunk_Size,
Allocation_Unit => Real_Unit,
Size => Count,
Data => Data);
end Head;
procedure Head (Source : in out Chunked_String;
Count : in Natural;
Pad : in Character := Ada.Strings.Space) is
begin
if Count > Source.Size then
Resize_Chunks (Source.Data, Count,
Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
Fill (Source.Data.all, Source.Size + 1, Count - Source.Size, Pad,
Source.Chunk_Size);
end if;
Source.Size := Count;
end Head;
function Tail (Source : in Chunked_String;
Count : in Natural;
Pad : in Character := Ada.Strings.Space;
Chunk_Size : in Natural := 0; -- use value from Source
Allocation_Unit : in Natural := 0) -- use value from Source
return Chunked_String
is
Real_Chunk_Size : Positive := Default_Chunk_Size;
Real_Unit : Positive := Default_Allocation_Unit;
Data : Chunk_Array_Access := null;
begin
if Chunk_Size > 0 then
Real_Chunk_Size := Chunk_Size;
end if;
if Allocation_Unit > 0 then
Real_Unit := Allocation_Unit;
end if;
if Count > 0 then
Resize_Chunks (Data, Count, Real_Chunk_Size, Real_Unit);
if Count > Source.Size then
Fill (Data.all, 1, Count - Source.Size, Pad, Real_Chunk_Size);
Move (Data.all, Count - Source.Size + 1,
Source.Data.all, 1, Source.Size);
else
Move (Data.all, 1,
Source.Data.all, Source.Size - Count + 1, Count);
end if;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Real_Chunk_Size,
Allocation_Unit => Real_Unit,
Size => Count,
Data => Data);
end Tail;
procedure Tail (Source : in out Chunked_String;
Count : in Natural;
Pad : in Character := Ada.Strings.Space) is
begin
Resize_Chunks (Source.Data, Count,
Source.Chunk_Size, Source.Allocation_Unit,
Can_Shrink => False);
if Count > Source.Size then
if Source.Size > 0 then
Move (Data => Source.Data.all,
Target_Position => Count - Source.Size + 1,
Source_Position => 1,
Length => Source.Size,
Chunk_Size => Source.Chunk_Size);
end if;
Fill (Source.Data.all, 1, Count - Source.Size, Pad,
Source.Chunk_Size);
elsif Count > 0 then
Move (Data => Source.Data.all,
Target_Position => 1,
Source_Position => Source.Size - Count + 1,
Length => Count,
Chunk_Size => Source.Chunk_Size);
end if;
Source.Size := Count;
end Tail;
function "*" (Left : in Natural;
Right : in Character)
return Chunked_String
is
Chunk_Size : constant Positive := Default_Chunk_Size;
Allocation_Unit : constant Positive := Default_Allocation_Unit;
Size : constant Natural := Left;
Chunk_Nb : constant Natural
:= Chunks_For (Size, Chunk_Size, Allocation_Unit);
Last_Chunk_Size : constant Natural
:= Units_For (Size, Chunk_Size, Allocation_Unit) * Allocation_Unit;
Data : Chunk_Array_Access := null;
begin
if Size > 0 then
Data := new Chunk_Array (1 .. Chunk_Nb);
for J in 1 .. Chunk_Nb - 1 loop
Data (J) := new String'(Ada.Strings.Fixed."*" (Chunk_Size, Right));
end loop;
Data (Chunk_Nb) := new
String'(Ada.Strings.Fixed."*" (Last_Chunk_Size, Right));
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Size,
Data => Data);
end "*";
function "*" (Left : in Natural;
Right : in String)
return Chunked_String
is
Chunk_Size : constant Positive := Default_Chunk_Size;
Allocation_Unit : constant Positive := Default_Allocation_Unit;
Size : constant Natural := Left * Right'Length;
Chunk_Nb : constant Natural
:= Chunks_For (Size, Chunk_Size, Allocation_Unit);
Last_Chunk_Size : constant Natural
:= Units_For (Size, Chunk_Size, Allocation_Unit) * Allocation_Unit;
Data : Chunk_Array_Access := null;
begin
if Size > 0 then
if Chunk_Size mod Right'Length = 0 then
Data := new Chunk_Array (1 .. Chunk_Nb);
for J in 1 .. Chunk_Nb - 1 loop
Data (J) := new String'(Ada.Strings.Fixed."*"
(Chunk_Size / Right'Length, Right));
end loop;
Data (Chunk_Nb) := new String'(Ada.Strings.Fixed."*"
(Last_Chunk_Size / Right'Length, Right));
else
Resize_Chunks (Data, Size, Chunk_Size, Allocation_Unit);
for J in 1 .. Left loop
Move (Data.all, Right, (J - 1) * Right'Length + 1, Chunk_Size);
end loop;
end if;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Size,
Data => Data);
end "*";
function "*" (Left : in Natural;
Right : in Chunked_String)
return Chunked_String
is
Chunk_Size : constant Positive := Default_Chunk_Size;
Allocation_Unit : constant Positive := Default_Allocation_Unit;
Size : constant Natural := Left * Right.Size;
Data : Chunk_Array_Access := null;
begin
if Size > 0 then
Resize_Chunks (Data, Size, Chunk_Size, Allocation_Unit);
for J in 1 .. Left loop
Move (Data.all, (J - 1) * Right.Size + 1,
Right.Data.all, 1, Right.Size);
end loop;
end if;
return Chunked_String'(Ada.Finalization.Controlled with
Chunk_Size => Chunk_Size,
Allocation_Unit => Allocation_Unit,
Size => Size,
Data => Data);
end "*";
-- Controlled object methods
overriding procedure Initialize (Object : in out Chunked_String) is
begin
Object.Size := 0;
Object.Data := null;
end Initialize;
overriding procedure Adjust (Object : in out Chunked_String) is
New_Data : Chunk_Array_Access;
begin
if Object.Data /= null then
New_Data := new Chunk_Array (Object.Data'Range);
for J in Object.Data'Range loop
New_Data (J) := new String'(Object.Data (J).all);
end loop;
Object.Data := New_Data;
end if;
end Adjust;
overriding procedure Finalize (Object : in out Chunked_String) is
begin
Free (Object.Data);
end Finalize;
end Natools.Chunked_Strings;
|
src/svd/sam_svd-tpi.ads | Fabien-Chouteau/samd51-hal | 1 | 1981 | pragma Style_Checks (Off);
-- This spec has been automatically generated from ATSAMD51G19A.svd
pragma Restrictions (No_Elaboration_Code);
with HAL;
with System;
package SAM_SVD.TPI is
pragma Preelaborate;
---------------
-- Registers --
---------------
subtype TPI_ACPR_PRESCALER_Field is HAL.UInt13;
-- Asynchronous Clock Prescaler Register
type TPI_ACPR_Register is record
PRESCALER : TPI_ACPR_PRESCALER_Field := 16#0#;
-- unspecified
Reserved_13_31 : HAL.UInt19 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_ACPR_Register use record
PRESCALER at 0 range 0 .. 12;
Reserved_13_31 at 0 range 13 .. 31;
end record;
subtype TPI_SPPR_TXMODE_Field is HAL.UInt2;
-- Selected Pin Protocol Register
type TPI_SPPR_Register is record
TXMODE : TPI_SPPR_TXMODE_Field := 16#0#;
-- unspecified
Reserved_2_31 : HAL.UInt30 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_SPPR_Register use record
TXMODE at 0 range 0 .. 1;
Reserved_2_31 at 0 range 2 .. 31;
end record;
-- Formatter and Flush Status Register
type TPI_FFSR_Register is record
-- Read-only.
FlInProg : Boolean;
-- Read-only.
FtStopped : Boolean;
-- Read-only.
TCPresent : Boolean;
-- Read-only.
FtNonStop : Boolean;
-- unspecified
Reserved_4_31 : HAL.UInt28;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_FFSR_Register use record
FlInProg at 0 range 0 .. 0;
FtStopped at 0 range 1 .. 1;
TCPresent at 0 range 2 .. 2;
FtNonStop at 0 range 3 .. 3;
Reserved_4_31 at 0 range 4 .. 31;
end record;
-- Formatter and Flush Control Register
type TPI_FFCR_Register is record
-- unspecified
Reserved_0_0 : HAL.Bit := 16#0#;
EnFCont : Boolean := False;
-- unspecified
Reserved_2_7 : HAL.UInt6 := 16#0#;
TrigIn : Boolean := False;
-- unspecified
Reserved_9_31 : HAL.UInt23 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_FFCR_Register use record
Reserved_0_0 at 0 range 0 .. 0;
EnFCont at 0 range 1 .. 1;
Reserved_2_7 at 0 range 2 .. 7;
TrigIn at 0 range 8 .. 8;
Reserved_9_31 at 0 range 9 .. 31;
end record;
-- TRIGGER
type TPI_TRIGGER_Register is record
-- Read-only.
TRIGGER : Boolean;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_TRIGGER_Register use record
TRIGGER at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- TPI_FIFO0_ETM array element
subtype TPI_FIFO0_ETM_Element is HAL.UInt8;
-- TPI_FIFO0_ETM array
type TPI_FIFO0_ETM_Field_Array is array (0 .. 2) of TPI_FIFO0_ETM_Element
with Component_Size => 8, Size => 24;
-- Type definition for TPI_FIFO0_ETM
type TPI_FIFO0_ETM_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ETM as a value
Val : HAL.UInt24;
when True =>
-- ETM as an array
Arr : TPI_FIFO0_ETM_Field_Array;
end case;
end record
with Unchecked_Union, Size => 24;
for TPI_FIFO0_ETM_Field use record
Val at 0 range 0 .. 23;
Arr at 0 range 0 .. 23;
end record;
subtype TPI_FIFO0_ETM_bytecount_Field is HAL.UInt2;
subtype TPI_FIFO0_ITM_bytecount_Field is HAL.UInt2;
-- Integration ETM Data
type TPI_FIFO0_Register is record
-- Read-only.
ETM : TPI_FIFO0_ETM_Field;
-- Read-only.
ETM_bytecount : TPI_FIFO0_ETM_bytecount_Field;
-- Read-only.
ETM_ATVALID : Boolean;
-- Read-only.
ITM_bytecount : TPI_FIFO0_ITM_bytecount_Field;
-- Read-only.
ITM_ATVALID : Boolean;
-- unspecified
Reserved_30_31 : HAL.UInt2;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_FIFO0_Register use record
ETM at 0 range 0 .. 23;
ETM_bytecount at 0 range 24 .. 25;
ETM_ATVALID at 0 range 26 .. 26;
ITM_bytecount at 0 range 27 .. 28;
ITM_ATVALID at 0 range 29 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-- ITATBCTR2
type ITATBCTR_Register is record
-- Read-only.
ATREADY : Boolean;
-- unspecified
Reserved_1_31 : HAL.UInt31;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for ITATBCTR_Register use record
ATREADY at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
-- TPI_FIFO1_ITM array element
subtype TPI_FIFO1_ITM_Element is HAL.UInt8;
-- TPI_FIFO1_ITM array
type TPI_FIFO1_ITM_Field_Array is array (0 .. 2) of TPI_FIFO1_ITM_Element
with Component_Size => 8, Size => 24;
-- Type definition for TPI_FIFO1_ITM
type TPI_FIFO1_ITM_Field
(As_Array : Boolean := False)
is record
case As_Array is
when False =>
-- ITM as a value
Val : HAL.UInt24;
when True =>
-- ITM as an array
Arr : TPI_FIFO1_ITM_Field_Array;
end case;
end record
with Unchecked_Union, Size => 24;
for TPI_FIFO1_ITM_Field use record
Val at 0 range 0 .. 23;
Arr at 0 range 0 .. 23;
end record;
subtype TPI_FIFO1_ETM_bytecount_Field is HAL.UInt2;
subtype TPI_FIFO1_ITM_bytecount_Field is HAL.UInt2;
-- Integration ITM Data
type TPI_FIFO1_Register is record
-- Read-only.
ITM : TPI_FIFO1_ITM_Field;
-- Read-only.
ETM_bytecount : TPI_FIFO1_ETM_bytecount_Field;
-- Read-only.
ETM_ATVALID : Boolean;
-- Read-only.
ITM_bytecount : TPI_FIFO1_ITM_bytecount_Field;
-- Read-only.
ITM_ATVALID : Boolean;
-- unspecified
Reserved_30_31 : HAL.UInt2;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_FIFO1_Register use record
ITM at 0 range 0 .. 23;
ETM_bytecount at 0 range 24 .. 25;
ETM_ATVALID at 0 range 26 .. 26;
ITM_bytecount at 0 range 27 .. 28;
ITM_ATVALID at 0 range 29 .. 29;
Reserved_30_31 at 0 range 30 .. 31;
end record;
-- Integration Mode Control
type TPI_ITCTRL_Register is record
Mode : Boolean := False;
-- unspecified
Reserved_1_31 : HAL.UInt31 := 16#0#;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_ITCTRL_Register use record
Mode at 0 range 0 .. 0;
Reserved_1_31 at 0 range 1 .. 31;
end record;
subtype TPI_DEVID_MinBufSz_Field is HAL.UInt3;
-- TPIU_DEVID
type TPI_DEVID_Register is record
-- Read-only.
NrTraceInput : Boolean;
-- unspecified
Reserved_1_4 : HAL.UInt4;
-- Read-only.
AsynClkIn : Boolean;
-- Read-only.
MinBufSz : TPI_DEVID_MinBufSz_Field;
-- Read-only.
PTINVALID : Boolean;
-- Read-only.
MANCVALID : Boolean;
-- Read-only.
NRZVALID : Boolean;
-- unspecified
Reserved_12_31 : HAL.UInt20;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_DEVID_Register use record
NrTraceInput at 0 range 0 .. 0;
Reserved_1_4 at 0 range 1 .. 4;
AsynClkIn at 0 range 5 .. 5;
MinBufSz at 0 range 6 .. 8;
PTINVALID at 0 range 9 .. 9;
MANCVALID at 0 range 10 .. 10;
NRZVALID at 0 range 11 .. 11;
Reserved_12_31 at 0 range 12 .. 31;
end record;
subtype TPI_DEVTYPE_SubType_Field is HAL.UInt4;
subtype TPI_DEVTYPE_MajorType_Field is HAL.UInt4;
-- TPIU_DEVTYPE
type TPI_DEVTYPE_Register is record
-- Read-only.
SubType_k : TPI_DEVTYPE_SubType_Field;
-- Read-only.
MajorType : TPI_DEVTYPE_MajorType_Field;
-- unspecified
Reserved_8_31 : HAL.UInt24;
end record
with Volatile_Full_Access, Object_Size => 32,
Bit_Order => System.Low_Order_First;
for TPI_DEVTYPE_Register use record
SubType_k at 0 range 0 .. 3;
MajorType at 0 range 4 .. 7;
Reserved_8_31 at 0 range 8 .. 31;
end record;
-----------------
-- Peripherals --
-----------------
-- Trace Port Interface Register
type TPI_Peripheral is record
-- Supported Parallel Port Size Register
SSPSR : aliased HAL.UInt32;
-- Current Parallel Port Size Register
CSPSR : aliased HAL.UInt32;
-- Asynchronous Clock Prescaler Register
ACPR : aliased TPI_ACPR_Register;
-- Selected Pin Protocol Register
SPPR : aliased TPI_SPPR_Register;
-- Formatter and Flush Status Register
FFSR : aliased TPI_FFSR_Register;
-- Formatter and Flush Control Register
FFCR : aliased TPI_FFCR_Register;
-- Formatter Synchronization Counter Register
FSCR : aliased HAL.UInt32;
-- TRIGGER
TRIGGER : aliased TPI_TRIGGER_Register;
-- Integration ETM Data
FIFO0 : aliased TPI_FIFO0_Register;
-- ITATBCTR2
ITATBCTR2 : aliased ITATBCTR_Register;
-- ITATBCTR0
ITATBCTR0 : aliased ITATBCTR_Register;
-- Integration ITM Data
FIFO1 : aliased TPI_FIFO1_Register;
-- Integration Mode Control
ITCTRL : aliased TPI_ITCTRL_Register;
-- Claim tag set
CLAIMSET : aliased HAL.UInt32;
-- Claim tag clear
CLAIMCLR : aliased HAL.UInt32;
-- TPIU_DEVID
DEVID : aliased TPI_DEVID_Register;
-- TPIU_DEVTYPE
DEVTYPE : aliased TPI_DEVTYPE_Register;
end record
with Volatile;
for TPI_Peripheral use record
SSPSR at 16#0# range 0 .. 31;
CSPSR at 16#4# range 0 .. 31;
ACPR at 16#10# range 0 .. 31;
SPPR at 16#F0# range 0 .. 31;
FFSR at 16#300# range 0 .. 31;
FFCR at 16#304# range 0 .. 31;
FSCR at 16#308# range 0 .. 31;
TRIGGER at 16#EE8# range 0 .. 31;
FIFO0 at 16#EEC# range 0 .. 31;
ITATBCTR2 at 16#EF0# range 0 .. 31;
ITATBCTR0 at 16#EF8# range 0 .. 31;
FIFO1 at 16#EFC# range 0 .. 31;
ITCTRL at 16#F00# range 0 .. 31;
CLAIMSET at 16#FA0# range 0 .. 31;
CLAIMCLR at 16#FA4# range 0 .. 31;
DEVID at 16#FC8# range 0 .. 31;
DEVTYPE at 16#FCC# range 0 .. 31;
end record;
-- Trace Port Interface Register
TPI_Periph : aliased TPI_Peripheral
with Import, Address => TPI_Base;
end SAM_SVD.TPI;
|
oeis/228/A228597.asm | neoneye/loda-programs | 11 | 91316 | ; A228597: The Wiener index of the graph obtained by applying Mycielski's construction to a benzenoid consisting of a linear chain of n hexagons.
; 141,445,941,1629,2509,3581,4845,6301,7949,9789,11821,14045,16461,19069,21869,24861,28045,31421,34989,38749,42701,46845,51181,55709,60429,65341,70445,75741,81229,86909,92781,98845,105101,111549,118189,125021,132045,139261,146669,154269,162061,170045,178221,186589,195149,203901,212845,221981,231309,240829,250541,260445,270541,280829,291309,301981,312845,323901,335149,346589,358221,370045,382061,394269,406669,419261,432045,445021,458189,471549,485101,498845,512781,526909,541229,555741,570445
mul $0,6
mov $1,$0
add $1,13
mul $0,$1
div $0,6
mul $0,16
add $0,141
|
0.PARTE-I/A2.EX8PUSHBUTTON/AULA.asm | ronchifabricio/progparamicroprocessadores | 2 | 5877 | <filename>0.PARTE-I/A2.EX8PUSHBUTTON/AULA.asm
_main:
;AULA.c,42 :: void main() { // ABRE FUNCAO PRINCIPAL: MAIN
;AULA.c,43 :: ADCON1 = 0x06; // CONFIGURA ENTRADAS AN COMO E/S DIGITAIS
MOVLW 6
MOVWF ADCON1+0
;AULA.c,44 :: CMCON = 7; // DESLIGA COMPARADORES
MOVLW 7
MOVWF CMCON+0
;AULA.c,46 :: TRISA = 0b00000000; PORTA = 0b00000000;
CLRF TRISA+0
CLRF PORTA+0
;AULA.c,47 :: TRISB = 0b11111111; // PORTB = 0b00000000;
MOVLW 255
MOVWF TRISB+0
;AULA.c,48 :: TRISC = 0b00000000; PORTC = 0b00000000;
CLRF TRISC+0
CLRF PORTC+0
;AULA.c,49 :: TRISD = 0b00000000; PORTD = 0b00000000;
CLRF TRISD+0
CLRF PORTD+0
;AULA.c,50 :: TRISE = 0b00000000; PORTE = 0b00000000;
CLRF TRISE+0
CLRF PORTE+0
;AULA.c,52 :: RELE_1 = 0; RELE_2 = 0;
BCF PORTC+0, 0
BCF PORTE+0, 0
;AULA.c,53 :: VENT = 0; BUZZER = 1;
BCF PORTC+0, 2
BSF PORTC+0, 1
;AULA.c,54 :: LEDD0 = 0; LEDD1 = 0; LEDD2 = 0; LEDD3 = 0;
BCF PORTD+0, 0
BCF PORTD+0, 1
BCF PORTD+0, 2
BCF PORTD+0, 3
;AULA.c,55 :: LEDD4 = 0; LEDD5 = 0; LEDD6 = 0; LEDD7 = 0;
BCF PORTD+0, 4
BCF PORTD+0, 5
BCF PORTD+0, 6
BCF PORTD+0, 7
;AULA.c,56 :: while (1){
L_main0:
;AULA.c,57 :: RELE_1 = !INT0; // PRESSIONA LIGA
BTFSC PORTB+0, 0
GOTO L__main4
BSF PORTC+0, 0
GOTO L__main5
L__main4:
BCF PORTC+0, 0
L__main5:
;AULA.c,58 :: RELE_2 = !INT1; // PRESSIONA LIGA
BTFSC PORTB+0, 1
GOTO L__main6
BSF PORTE+0, 0
GOTO L__main7
L__main6:
BCF PORTE+0, 0
L__main7:
;AULA.c,59 :: VENT = !INT2; // PRESSIONA LIGA
BTFSC PORTB+0, 2
GOTO L__main8
BSF PORTC+0, 2
GOTO L__main9
L__main8:
BCF PORTC+0, 2
L__main9:
;AULA.c,60 :: BUZZER = INT3; // PRESSIONA LIGA
BTFSC PORTB+0, 3
GOTO L__main10
BCF PORTC+0, 1
GOTO L__main11
L__main10:
BSF PORTC+0, 1
L__main11:
;AULA.c,61 :: LEDD0 = !INT4; // PRESSIONA LIGA
BTFSC PORTB+0, 4
GOTO L__main12
BSF PORTD+0, 0
GOTO L__main13
L__main12:
BCF PORTD+0, 0
L__main13:
;AULA.c,62 :: LEDD1 = INT5; // PRESSIONA DESLIGA
BTFSC PORTB+0, 5
GOTO L__main14
BCF PORTD+0, 1
GOTO L__main15
L__main14:
BSF PORTD+0, 1
L__main15:
;AULA.c,63 :: LEDD2 = !INT4; // PRESSIONA LIGA
BTFSC PORTB+0, 4
GOTO L__main16
BSF PORTD+0, 2
GOTO L__main17
L__main16:
BCF PORTD+0, 2
L__main17:
;AULA.c,64 :: LEDD3 = INT5; // PRESSIONA DESLIGA
BTFSC PORTB+0, 5
GOTO L__main18
BCF PORTD+0, 3
GOTO L__main19
L__main18:
BSF PORTD+0, 3
L__main19:
;AULA.c,65 :: LEDD4 = !INT4; // PRESSIONA LIGA
BTFSC PORTB+0, 4
GOTO L__main20
BSF PORTD+0, 4
GOTO L__main21
L__main20:
BCF PORTD+0, 4
L__main21:
;AULA.c,66 :: LEDD5 = INT5; // PRESSIONA DESLIGA
BTFSC PORTB+0, 5
GOTO L__main22
BCF PORTD+0, 5
GOTO L__main23
L__main22:
BSF PORTD+0, 5
L__main23:
;AULA.c,67 :: LEDD6 = !INT4; // PRESSIONA LIGA
BTFSC PORTB+0, 4
GOTO L__main24
BSF PORTD+0, 6
GOTO L__main25
L__main24:
BCF PORTD+0, 6
L__main25:
;AULA.c,68 :: LEDD7 = INT5; // PRESSIONA DESLIGA
BTFSC PORTB+0, 5
GOTO L__main26
BCF PORTD+0, 7
GOTO L__main27
L__main26:
BSF PORTD+0, 7
L__main27:
;AULA.c,69 :: Delay_ms(50);}}
MOVLW 130
MOVWF R12+0
MOVLW 221
MOVWF R13+0
L_main2:
DECFSZ R13+0, 1
GOTO L_main2
DECFSZ R12+0, 1
GOTO L_main2
NOP
NOP
GOTO L_main0
L_end_main:
GOTO $+0
; end of _main
|
src/arm_const_structs_h.ads | JeremyGrosser/arm_cmsis_dsp | 0 | 19659 | <filename>src/arm_const_structs_h.ads
pragma Ada_2012;
pragma Style_Checks (Off);
pragma Warnings ("U");
with Interfaces.C; use Interfaces.C;
with transform_functions_h;
package arm_const_structs_h is
arm_cfft_sR_f64_len16 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:41
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len16";
arm_cfft_sR_f64_len32 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:42
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len32";
arm_cfft_sR_f64_len64 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:43
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len64";
arm_cfft_sR_f64_len128 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:44
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len128";
arm_cfft_sR_f64_len256 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:45
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len256";
arm_cfft_sR_f64_len512 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:46
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len512";
arm_cfft_sR_f64_len1024 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:47
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len1024";
arm_cfft_sR_f64_len2048 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:48
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len2048";
arm_cfft_sR_f64_len4096 : aliased constant transform_functions_h.arm_cfft_instance_f64 -- DSP/Include/arm_const_structs.h:49
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f64_len4096";
arm_cfft_sR_f32_len16 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:51
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len16";
arm_cfft_sR_f32_len32 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:52
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len32";
arm_cfft_sR_f32_len64 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:53
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len64";
arm_cfft_sR_f32_len128 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:54
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len128";
arm_cfft_sR_f32_len256 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:55
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len256";
arm_cfft_sR_f32_len512 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:56
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len512";
arm_cfft_sR_f32_len1024 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:57
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len1024";
arm_cfft_sR_f32_len2048 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:58
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len2048";
arm_cfft_sR_f32_len4096 : aliased constant transform_functions_h.arm_cfft_instance_f32 -- DSP/Include/arm_const_structs.h:59
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_f32_len4096";
arm_cfft_sR_q31_len16 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:61
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len16";
arm_cfft_sR_q31_len32 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:62
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len32";
arm_cfft_sR_q31_len64 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:63
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len64";
arm_cfft_sR_q31_len128 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:64
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len128";
arm_cfft_sR_q31_len256 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:65
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len256";
arm_cfft_sR_q31_len512 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:66
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len512";
arm_cfft_sR_q31_len1024 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:67
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len1024";
arm_cfft_sR_q31_len2048 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:68
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len2048";
arm_cfft_sR_q31_len4096 : aliased constant transform_functions_h.arm_cfft_instance_q31 -- DSP/Include/arm_const_structs.h:69
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q31_len4096";
arm_cfft_sR_q15_len16 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:71
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len16";
arm_cfft_sR_q15_len32 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:72
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len32";
arm_cfft_sR_q15_len64 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:73
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len64";
arm_cfft_sR_q15_len128 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:74
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len128";
arm_cfft_sR_q15_len256 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:75
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len256";
arm_cfft_sR_q15_len512 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:76
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len512";
arm_cfft_sR_q15_len1024 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:77
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len1024";
arm_cfft_sR_q15_len2048 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:78
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len2048";
arm_cfft_sR_q15_len4096 : aliased constant transform_functions_h.arm_cfft_instance_q15 -- DSP/Include/arm_const_structs.h:79
with Import => True,
Convention => C,
External_Name => "arm_cfft_sR_q15_len4096";
end arm_const_structs_h;
|
src/main/kotlin/io/kixi/kd/KDParser.g4 | dleuck/Ki.Kotlin.KD | 2 | 5420 | parser grammar KDParser;
options { tokenVocab = KDLexer; }
/**
* KD Parser
*
* @author <NAME>
*/
tagList: NL* (tag NL*)*;
tag:
( ( (annotationList NL*)? nsName valueList? ) | (valueList) ) attributeList? (';' | NL | ('{' tagList '}'))?;
value:
// Strings
stringLiteral | CharLiteral | ID
// Numbers
| IntegerLiteral | HexLiteral | BinLiteral | LongLiteral
| FloatLiteral | DoubleLiteral | DecimalLiteral
| TRUE | FALSE
| NULL
// Data Structures
| list | map | call
// Date, DateTime and Duration
| dateTime
| duration
| quantity
// etc
| URL
| range
| Version
// Encodings
| blob
;
// String
stringLiteral:
SimpleString |
RawString |
blockString |
blockRawString |
blockRawAltString;
blockString: BlockStringStart BlockStringChunk* BlockStringEnd;
blockRawString: BlockRawStringStart BlockRawStringChunk* BlockRawStringEnd;
blockRawAltString: BlockRawAltStringStart BlockRawAltStringChunk* BlockRawAltStringEnd;
// Duration
duration: CompoundDuration | DayDuration | HourDuration | MinuteDuration | SecondDuration | MillisecondDuration
| NanosecondDuration;
// Quantity
quantity: IntegerQuantityLiteral | DecimalQuantityLiteral;
// Range --- ---
rangeOp: InclusiveRangeOp | ExclusiveRangeOp | ExclusiveLeftOp | ExclusiveRightOp;
intRange: ('_' rangeOp IntegerLiteral) | (IntegerLiteral rangeOp '_') | (IntegerLiteral rangeOp IntegerLiteral);
longRange: ('_' rangeOp LongLiteral) | (LongLiteral rangeOp '_') | (LongLiteral rangeOp LongLiteral);
floatRange: ('_' rangeOp FloatLiteral) | (FloatLiteral rangeOp '_') | (FloatLiteral rangeOp FloatLiteral);
doubleRange: ('_' rangeOp DoubleLiteral) | (DoubleLiteral rangeOp '_') | (DoubleLiteral rangeOp DoubleLiteral);
decimalRange: ('_' rangeOp DecimalLiteral) | (DecimalLiteral rangeOp '_') | (DecimalLiteral rangeOp DecimalLiteral);
durationRange: ('_' rangeOp duration) | (duration rangeOp '_') | (duration rangeOp duration);
dateTimeRange: ('_' rangeOp dateTime) | (dateTime rangeOp '_') | (dateTime rangeOp dateTime);
versionRange: ('_' rangeOp Version) | (Version rangeOp '_') | (Version rangeOp Version);
charRange: ('_' rangeOp CharLiteral) | (CharLiteral rangeOp '_') | (CharLiteral rangeOp CharLiteral);
stringRange: ('_' rangeOp stringLiteral) | (stringLiteral rangeOp '_') | (stringLiteral rangeOp stringLiteral);
quantityRange: ('_' rangeOp quantity) | (quantity rangeOp '_') | (quantity rangeOp quantity);
range: intRange | longRange | floatRange | doubleRange | decimalRange | durationRange | dateTimeRange | versionRange
| charRange | stringRange | quantityRange;
blob: BLOB_START BLOB_DATA* BLOB_END;
// Tag Parts --- ---
valueList: value+;
attribute: nsName '=' value;
attributeList: attribute+;
// Tag name or attribute key, optionally prefixed by a namespace
nsName: (ID ':')? ID;
// DATA STRUCTURES --- ---
list: ('[' NL* value (COMMA? NL* value)* NL* ']') | ('[' ']');
pair: NL* value '=' NL* value NL*;
map: ('[' NL* pair (COMMA? NL* pair)* NL* ']') | ('[' '=' ']');
// Call --- ---
callValueList: NL* value (COMMA? NL* value)* NL*;
callPair: NL* ID '=' NL* value NL*;
callAttributeList: NL* callPair (COMMA? NL* callPair)* NL*;
call: ID LPAREN callValueList? (COMMA? callAttributeList)? RPAREN;
// ANNOTATIONS
annotation: '@' nsName (LPAREN valueList? attributeList? RPAREN)?;
annotationList: annotation (NL* annotation)*;
// ETC
dateTime: Date Time?; // Date (Time TimeZone?)?; |
legend-pure-m3-dsl-graph/src/main/antlr4/org/finos/legend/pure/m3/inlinedsl/graph/serialization/grammar/GraphParser.g4 | hausea/legend-pure | 37 | 4150 | parser grammar GraphParser;
options
{
tokenVocab = GraphLexer;
}
identifier: VALID_STRING
;
qualifiedName: packagePath? identifier
;
packagePath: (identifier PATH_SEPARATOR)+
;
definition: CURLY_BRACKET_OPEN
qualifiedName
graphDefinition
CURLY_BRACKET_CLOSE
EOF
;
graphDefinition: CURLY_BRACKET_OPEN
graphPaths
CURLY_BRACKET_CLOSE
;
graphPaths: graphPath (COMMA graphPath)*
;
graphPath: alias? identifier propertyParameters? subtype? graphDefinition?
;
alias: STRING COLON
;
propertyParameters: GROUP_OPEN (parameter (COMMA parameter)*)? GROUP_CLOSE
;
subtype: SUBTYPE_START qualifiedName GROUP_CLOSE
;
parameter: scalarParameter | collectionParameter
;
scalarParameter: LATEST_DATE | instanceLiteral | variable | enumReference
;
collectionParameter: BRACKET_OPEN
(scalarParameter (COMMA scalarParameter)*)?
BRACKET_CLOSE
;
instanceLiteral: instanceLiteralToken | (MINUS INTEGER) | (MINUS FLOAT) | (MINUS DECIMAL) | (PLUS INTEGER) | (PLUS FLOAT) | (PLUS DECIMAL)
;
instanceLiteralToken: STRING | INTEGER | FLOAT | DECIMAL | DATE | BOOLEAN
;
variable: DOLLAR identifier
;
enumReference: qualifiedName DOT identifier
;
|
kill.asm | danilocapkob/xv6plus | 1 | 169792 |
_kill: file format elf32-i386-freebsd
Disassembly of section .text:
00000000 <main>:
#include "user.h"
int
main(int argc, char **argv)
{
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl 0xfffffffc(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 51 push %ecx
e: 83 ec 24 sub $0x24,%esp
11: 89 4d e8 mov %ecx,0xffffffe8(%ebp)
int i;
if(argc < 1){
14: 8b 45 e8 mov 0xffffffe8(%ebp),%eax
17: 83 38 00 cmpl $0x0,(%eax)
1a: 7f 19 jg 35 <main+0x35>
printf(2, "usage: kill pid...\n");
1c: c7 44 24 04 94 10 00 movl $0x1094,0x4(%esp)
23: 00
24: c7 04 24 02 00 00 00 movl $0x2,(%esp)
2b: e8 e0 04 00 00 call 510 <printf>
exit();
30: e8 cf 02 00 00 call 304 <exit>
}
for(i=1; i<argc; i++)
35: c7 45 f8 01 00 00 00 movl $0x1,0xfffffff8(%ebp)
3c: eb 22 jmp 60 <main+0x60>
kill(atoi(argv[i]));
3e: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
41: c1 e0 02 shl $0x2,%eax
44: 8b 55 e8 mov 0xffffffe8(%ebp),%edx
47: 03 42 04 add 0x4(%edx),%eax
4a: 8b 00 mov (%eax),%eax
4c: 89 04 24 mov %eax,(%esp)
4f: e8 1c 02 00 00 call 270 <atoi>
54: 89 04 24 mov %eax,(%esp)
57: e8 d8 02 00 00 call 334 <kill>
5c: 83 45 f8 01 addl $0x1,0xfffffff8(%ebp)
60: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
63: 8b 55 e8 mov 0xffffffe8(%ebp),%edx
66: 3b 02 cmp (%edx),%eax
68: 7c d4 jl 3e <main+0x3e>
exit();
6a: e8 95 02 00 00 call 304 <exit>
6f: 90 nop
00000070 <strcpy>:
#include "user.h"
char*
strcpy(char *s, char *t)
{
70: 55 push %ebp
71: 89 e5 mov %esp,%ebp
73: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
76: 8b 45 08 mov 0x8(%ebp),%eax
79: 89 45 fc mov %eax,0xfffffffc(%ebp)
while((*s++ = *t++) != 0)
7c: 8b 45 0c mov 0xc(%ebp),%eax
7f: 0f b6 10 movzbl (%eax),%edx
82: 8b 45 08 mov 0x8(%ebp),%eax
85: 88 10 mov %dl,(%eax)
87: 8b 45 08 mov 0x8(%ebp),%eax
8a: 0f b6 00 movzbl (%eax),%eax
8d: 84 c0 test %al,%al
8f: 0f 95 c0 setne %al
92: 83 45 08 01 addl $0x1,0x8(%ebp)
96: 83 45 0c 01 addl $0x1,0xc(%ebp)
9a: 84 c0 test %al,%al
9c: 75 de jne 7c <strcpy+0xc>
;
return os;
9e: 8b 45 fc mov 0xfffffffc(%ebp),%eax
}
a1: c9 leave
a2: c3 ret
a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
a9: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
000000b0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
b0: 55 push %ebp
b1: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
b3: eb 08 jmp bd <strcmp+0xd>
p++, q++;
b5: 83 45 08 01 addl $0x1,0x8(%ebp)
b9: 83 45 0c 01 addl $0x1,0xc(%ebp)
bd: 8b 45 08 mov 0x8(%ebp),%eax
c0: 0f b6 00 movzbl (%eax),%eax
c3: 84 c0 test %al,%al
c5: 74 10 je d7 <strcmp+0x27>
c7: 8b 45 08 mov 0x8(%ebp),%eax
ca: 0f b6 10 movzbl (%eax),%edx
cd: 8b 45 0c mov 0xc(%ebp),%eax
d0: 0f b6 00 movzbl (%eax),%eax
d3: 38 c2 cmp %al,%dl
d5: 74 de je b5 <strcmp+0x5>
return (uchar)*p - (uchar)*q;
d7: 8b 45 08 mov 0x8(%ebp),%eax
da: 0f b6 00 movzbl (%eax),%eax
dd: 0f b6 d0 movzbl %al,%edx
e0: 8b 45 0c mov 0xc(%ebp),%eax
e3: 0f b6 00 movzbl (%eax),%eax
e6: 0f b6 c0 movzbl %al,%eax
e9: 89 d1 mov %edx,%ecx
eb: 29 c1 sub %eax,%ecx
ed: 89 c8 mov %ecx,%eax
}
ef: 5d pop %ebp
f0: c3 ret
f1: eb 0d jmp 100 <strlen>
f3: 90 nop
f4: 90 nop
f5: 90 nop
f6: 90 nop
f7: 90 nop
f8: 90 nop
f9: 90 nop
fa: 90 nop
fb: 90 nop
fc: 90 nop
fd: 90 nop
fe: 90 nop
ff: 90 nop
00000100 <strlen>:
uint
strlen(char *s)
{
100: 55 push %ebp
101: 89 e5 mov %esp,%ebp
103: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
106: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
10d: eb 04 jmp 113 <strlen+0x13>
10f: 83 45 fc 01 addl $0x1,0xfffffffc(%ebp)
113: 8b 45 fc mov 0xfffffffc(%ebp),%eax
116: 03 45 08 add 0x8(%ebp),%eax
119: 0f b6 00 movzbl (%eax),%eax
11c: 84 c0 test %al,%al
11e: 75 ef jne 10f <strlen+0xf>
;
return n;
120: 8b 45 fc mov 0xfffffffc(%ebp),%eax
}
123: c9 leave
124: c3 ret
125: 8d 74 26 00 lea 0x0(%esi),%esi
129: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
00000130 <memset>:
void*
memset(void *dst, int c, uint n)
{
130: 55 push %ebp
131: 89 e5 mov %esp,%ebp
133: 83 ec 10 sub $0x10,%esp
char *d;
d = dst;
136: 8b 45 08 mov 0x8(%ebp),%eax
139: 89 45 fc mov %eax,0xfffffffc(%ebp)
while(n-- > 0)
13c: eb 0e jmp 14c <memset+0x1c>
*d++ = c;
13e: 8b 45 0c mov 0xc(%ebp),%eax
141: 89 c2 mov %eax,%edx
143: 8b 45 fc mov 0xfffffffc(%ebp),%eax
146: 88 10 mov %dl,(%eax)
148: 83 45 fc 01 addl $0x1,0xfffffffc(%ebp)
14c: 83 6d 10 01 subl $0x1,0x10(%ebp)
150: 83 7d 10 ff cmpl $0xffffffff,0x10(%ebp)
154: 75 e8 jne 13e <memset+0xe>
return dst;
156: 8b 45 08 mov 0x8(%ebp),%eax
}
159: c9 leave
15a: c3 ret
15b: 90 nop
15c: 8d 74 26 00 lea 0x0(%esi),%esi
00000160 <strchr>:
char*
strchr(const char *s, char c)
{
160: 55 push %ebp
161: 89 e5 mov %esp,%ebp
163: 83 ec 08 sub $0x8,%esp
166: 8b 45 0c mov 0xc(%ebp),%eax
169: 88 45 fc mov %al,0xfffffffc(%ebp)
for(; *s; s++)
16c: eb 17 jmp 185 <strchr+0x25>
if(*s == c)
16e: 8b 45 08 mov 0x8(%ebp),%eax
171: 0f b6 00 movzbl (%eax),%eax
174: 3a 45 fc cmp 0xfffffffc(%ebp),%al
177: 75 08 jne 181 <strchr+0x21>
return (char*) s;
179: 8b 45 08 mov 0x8(%ebp),%eax
17c: 89 45 f8 mov %eax,0xfffffff8(%ebp)
17f: eb 15 jmp 196 <strchr+0x36>
181: 83 45 08 01 addl $0x1,0x8(%ebp)
185: 8b 45 08 mov 0x8(%ebp),%eax
188: 0f b6 00 movzbl (%eax),%eax
18b: 84 c0 test %al,%al
18d: 75 df jne 16e <strchr+0xe>
return 0;
18f: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
196: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
}
199: c9 leave
19a: c3 ret
19b: 90 nop
19c: 8d 74 26 00 lea 0x0(%esi),%esi
000001a0 <gets>:
char*
gets(char *buf, int max)
{
1a0: 55 push %ebp
1a1: 89 e5 mov %esp,%ebp
1a3: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
1a6: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
1ad: eb 46 jmp 1f5 <gets+0x55>
cc = read(0, &c, 1);
1af: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
1b6: 00
1b7: 8d 45 f7 lea 0xfffffff7(%ebp),%eax
1ba: 89 44 24 04 mov %eax,0x4(%esp)
1be: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1c5: e8 52 01 00 00 call 31c <read>
1ca: 89 45 fc mov %eax,0xfffffffc(%ebp)
if(cc < 1)
1cd: 83 7d fc 00 cmpl $0x0,0xfffffffc(%ebp)
1d1: 7e 2d jle 200 <gets+0x60>
break;
buf[i++] = c;
1d3: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
1d6: 89 c2 mov %eax,%edx
1d8: 03 55 08 add 0x8(%ebp),%edx
1db: 0f b6 45 f7 movzbl 0xfffffff7(%ebp),%eax
1df: 88 02 mov %al,(%edx)
1e1: 83 45 f8 01 addl $0x1,0xfffffff8(%ebp)
if(c == '\n' || c == '\r')
1e5: 0f b6 45 f7 movzbl 0xfffffff7(%ebp),%eax
1e9: 3c 0a cmp $0xa,%al
1eb: 74 13 je 200 <gets+0x60>
1ed: 0f b6 45 f7 movzbl 0xfffffff7(%ebp),%eax
1f1: 3c 0d cmp $0xd,%al
1f3: 74 0b je 200 <gets+0x60>
1f5: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
1f8: 83 c0 01 add $0x1,%eax
1fb: 3b 45 0c cmp 0xc(%ebp),%eax
1fe: 7c af jl 1af <gets+0xf>
break;
}
buf[i] = '\0';
200: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
203: 03 45 08 add 0x8(%ebp),%eax
206: c6 00 00 movb $0x0,(%eax)
return buf;
209: 8b 45 08 mov 0x8(%ebp),%eax
}
20c: c9 leave
20d: c3 ret
20e: 89 f6 mov %esi,%esi
00000210 <stat>:
int
stat(char *n, struct stat *st)
{
210: 55 push %ebp
211: 89 e5 mov %esp,%ebp
213: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
216: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
21d: 00
21e: 8b 45 08 mov 0x8(%ebp),%eax
221: 89 04 24 mov %eax,(%esp)
224: e8 1b 01 00 00 call 344 <open>
229: 89 45 f8 mov %eax,0xfffffff8(%ebp)
if(fd < 0)
22c: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
230: 79 09 jns 23b <stat+0x2b>
return -1;
232: c7 45 ec ff ff ff ff movl $0xffffffff,0xffffffec(%ebp)
239: eb 26 jmp 261 <stat+0x51>
r = fstat(fd, st);
23b: 8b 45 0c mov 0xc(%ebp),%eax
23e: 89 44 24 04 mov %eax,0x4(%esp)
242: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
245: 89 04 24 mov %eax,(%esp)
248: e8 0f 01 00 00 call 35c <fstat>
24d: 89 45 fc mov %eax,0xfffffffc(%ebp)
close(fd);
250: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
253: 89 04 24 mov %eax,(%esp)
256: e8 d1 00 00 00 call 32c <close>
return r;
25b: 8b 45 fc mov 0xfffffffc(%ebp),%eax
25e: 89 45 ec mov %eax,0xffffffec(%ebp)
261: 8b 45 ec mov 0xffffffec(%ebp),%eax
}
264: c9 leave
265: c3 ret
266: 8d 76 00 lea 0x0(%esi),%esi
269: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
00000270 <atoi>:
int
atoi(const char *s)
{
270: 55 push %ebp
271: 89 e5 mov %esp,%ebp
273: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
276: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
while('0' <= *s && *s <= '9')
27d: eb 24 jmp 2a3 <atoi+0x33>
n = n*10 + *s++ - '0';
27f: 8b 55 fc mov 0xfffffffc(%ebp),%edx
282: 89 d0 mov %edx,%eax
284: c1 e0 02 shl $0x2,%eax
287: 01 d0 add %edx,%eax
289: 01 c0 add %eax,%eax
28b: 89 c2 mov %eax,%edx
28d: 8b 45 08 mov 0x8(%ebp),%eax
290: 0f b6 00 movzbl (%eax),%eax
293: 0f be c0 movsbl %al,%eax
296: 8d 04 02 lea (%edx,%eax,1),%eax
299: 83 e8 30 sub $0x30,%eax
29c: 89 45 fc mov %eax,0xfffffffc(%ebp)
29f: 83 45 08 01 addl $0x1,0x8(%ebp)
2a3: 8b 45 08 mov 0x8(%ebp),%eax
2a6: 0f b6 00 movzbl (%eax),%eax
2a9: 3c 2f cmp $0x2f,%al
2ab: 7e 0a jle 2b7 <atoi+0x47>
2ad: 8b 45 08 mov 0x8(%ebp),%eax
2b0: 0f b6 00 movzbl (%eax),%eax
2b3: 3c 39 cmp $0x39,%al
2b5: 7e c8 jle 27f <atoi+0xf>
return n;
2b7: 8b 45 fc mov 0xfffffffc(%ebp),%eax
}
2ba: c9 leave
2bb: c3 ret
2bc: 8d 74 26 00 lea 0x0(%esi),%esi
000002c0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
2c0: 55 push %ebp
2c1: 89 e5 mov %esp,%ebp
2c3: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
2c6: 8b 45 08 mov 0x8(%ebp),%eax
2c9: 89 45 f8 mov %eax,0xfffffff8(%ebp)
src = vsrc;
2cc: 8b 45 0c mov 0xc(%ebp),%eax
2cf: 89 45 fc mov %eax,0xfffffffc(%ebp)
while(n-- > 0)
2d2: eb 13 jmp 2e7 <memmove+0x27>
*dst++ = *src++;
2d4: 8b 45 fc mov 0xfffffffc(%ebp),%eax
2d7: 0f b6 10 movzbl (%eax),%edx
2da: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
2dd: 88 10 mov %dl,(%eax)
2df: 83 45 f8 01 addl $0x1,0xfffffff8(%ebp)
2e3: 83 45 fc 01 addl $0x1,0xfffffffc(%ebp)
2e7: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
2eb: 0f 9f c0 setg %al
2ee: 83 6d 10 01 subl $0x1,0x10(%ebp)
2f2: 84 c0 test %al,%al
2f4: 75 de jne 2d4 <memmove+0x14>
return vdst;
2f6: 8b 45 08 mov 0x8(%ebp),%eax
}
2f9: c9 leave
2fa: c3 ret
2fb: 90 nop
000002fc <fork>:
2fc: b8 01 00 00 00 mov $0x1,%eax
301: cd 30 int $0x30
303: c3 ret
00000304 <exit>:
304: b8 02 00 00 00 mov $0x2,%eax
309: cd 30 int $0x30
30b: c3 ret
0000030c <wait>:
30c: b8 03 00 00 00 mov $0x3,%eax
311: cd 30 int $0x30
313: c3 ret
00000314 <pipe>:
314: b8 04 00 00 00 mov $0x4,%eax
319: cd 30 int $0x30
31b: c3 ret
0000031c <read>:
31c: b8 06 00 00 00 mov $0x6,%eax
321: cd 30 int $0x30
323: c3 ret
00000324 <write>:
324: b8 05 00 00 00 mov $0x5,%eax
329: cd 30 int $0x30
32b: c3 ret
0000032c <close>:
32c: b8 07 00 00 00 mov $0x7,%eax
331: cd 30 int $0x30
333: c3 ret
00000334 <kill>:
334: b8 08 00 00 00 mov $0x8,%eax
339: cd 30 int $0x30
33b: c3 ret
0000033c <exec>:
33c: b8 09 00 00 00 mov $0x9,%eax
341: cd 30 int $0x30
343: c3 ret
00000344 <open>:
344: b8 0a 00 00 00 mov $0xa,%eax
349: cd 30 int $0x30
34b: c3 ret
0000034c <mknod>:
34c: b8 0b 00 00 00 mov $0xb,%eax
351: cd 30 int $0x30
353: c3 ret
00000354 <unlink>:
354: b8 0c 00 00 00 mov $0xc,%eax
359: cd 30 int $0x30
35b: c3 ret
0000035c <fstat>:
35c: b8 0d 00 00 00 mov $0xd,%eax
361: cd 30 int $0x30
363: c3 ret
00000364 <link>:
364: b8 0e 00 00 00 mov $0xe,%eax
369: cd 30 int $0x30
36b: c3 ret
0000036c <mkdir>:
36c: b8 0f 00 00 00 mov $0xf,%eax
371: cd 30 int $0x30
373: c3 ret
00000374 <chdir>:
374: b8 10 00 00 00 mov $0x10,%eax
379: cd 30 int $0x30
37b: c3 ret
0000037c <dup>:
37c: b8 11 00 00 00 mov $0x11,%eax
381: cd 30 int $0x30
383: c3 ret
00000384 <getpid>:
384: b8 12 00 00 00 mov $0x12,%eax
389: cd 30 int $0x30
38b: c3 ret
0000038c <sbrk>:
38c: b8 13 00 00 00 mov $0x13,%eax
391: cd 30 int $0x30
393: c3 ret
00000394 <sleep>:
394: b8 14 00 00 00 mov $0x14,%eax
399: cd 30 int $0x30
39b: c3 ret
0000039c <upmsec>:
39c: b8 15 00 00 00 mov $0x15,%eax
3a1: cd 30 int $0x30
3a3: c3 ret
000003a4 <socket>:
3a4: b8 16 00 00 00 mov $0x16,%eax
3a9: cd 30 int $0x30
3ab: c3 ret
000003ac <bind>:
3ac: b8 17 00 00 00 mov $0x17,%eax
3b1: cd 30 int $0x30
3b3: c3 ret
000003b4 <listen>:
3b4: b8 18 00 00 00 mov $0x18,%eax
3b9: cd 30 int $0x30
3bb: c3 ret
000003bc <accept>:
3bc: b8 19 00 00 00 mov $0x19,%eax
3c1: cd 30 int $0x30
3c3: c3 ret
000003c4 <recv>:
3c4: b8 1a 00 00 00 mov $0x1a,%eax
3c9: cd 30 int $0x30
3cb: c3 ret
000003cc <recvfrom>:
3cc: b8 1b 00 00 00 mov $0x1b,%eax
3d1: cd 30 int $0x30
3d3: c3 ret
000003d4 <send>:
3d4: b8 1c 00 00 00 mov $0x1c,%eax
3d9: cd 30 int $0x30
3db: c3 ret
000003dc <sendto>:
3dc: b8 1d 00 00 00 mov $0x1d,%eax
3e1: cd 30 int $0x30
3e3: c3 ret
000003e4 <shutdown>:
3e4: b8 1e 00 00 00 mov $0x1e,%eax
3e9: cd 30 int $0x30
3eb: c3 ret
000003ec <getsockopt>:
3ec: b8 1f 00 00 00 mov $0x1f,%eax
3f1: cd 30 int $0x30
3f3: c3 ret
000003f4 <setsockopt>:
3f4: b8 20 00 00 00 mov $0x20,%eax
3f9: cd 30 int $0x30
3fb: c3 ret
000003fc <sockclose>:
3fc: b8 21 00 00 00 mov $0x21,%eax
401: cd 30 int $0x30
403: c3 ret
00000404 <connect>:
404: b8 22 00 00 00 mov $0x22,%eax
409: cd 30 int $0x30
40b: c3 ret
0000040c <getpeername>:
40c: b8 23 00 00 00 mov $0x23,%eax
411: cd 30 int $0x30
413: c3 ret
00000414 <getsockname>:
414: b8 24 00 00 00 mov $0x24,%eax
419: cd 30 int $0x30
41b: c3 ret
41c: 90 nop
41d: 90 nop
41e: 90 nop
41f: 90 nop
00000420 <putc>:
#include "user.h"
void
putc(int fd, char c)
{
420: 55 push %ebp
421: 89 e5 mov %esp,%ebp
423: 83 ec 18 sub $0x18,%esp
426: 8b 45 0c mov 0xc(%ebp),%eax
429: 88 45 fc mov %al,0xfffffffc(%ebp)
write(fd, &c, 1);
42c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
433: 00
434: 8d 45 fc lea 0xfffffffc(%ebp),%eax
437: 89 44 24 04 mov %eax,0x4(%esp)
43b: 8b 45 08 mov 0x8(%ebp),%eax
43e: 89 04 24 mov %eax,(%esp)
441: e8 de fe ff ff call 324 <write>
}
446: c9 leave
447: c3 ret
448: 90 nop
449: 8d b4 26 00 00 00 00 lea 0x0(%esi),%esi
00000450 <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
450: 55 push %ebp
451: 89 e5 mov %esp,%ebp
453: 53 push %ebx
454: 83 ec 34 sub $0x34,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
457: c7 45 f4 00 00 00 00 movl $0x0,0xfffffff4(%ebp)
if(sgn && xx < 0){
45e: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
462: 74 17 je 47b <printint+0x2b>
464: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
468: 79 11 jns 47b <printint+0x2b>
neg = 1;
46a: c7 45 f4 01 00 00 00 movl $0x1,0xfffffff4(%ebp)
x = -xx;
471: 8b 45 0c mov 0xc(%ebp),%eax
474: f7 d8 neg %eax
476: 89 45 f8 mov %eax,0xfffffff8(%ebp)
479: eb 06 jmp 481 <printint+0x31>
} else {
x = xx;
47b: 8b 45 0c mov 0xc(%ebp),%eax
47e: 89 45 f8 mov %eax,0xfffffff8(%ebp)
}
i = 0;
481: c7 45 f0 00 00 00 00 movl $0x0,0xfffffff0(%ebp)
do{
buf[i++] = digits[x % base];
488: 8b 4d f0 mov 0xfffffff0(%ebp),%ecx
48b: 8b 55 10 mov 0x10(%ebp),%edx
48e: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
491: 89 d3 mov %edx,%ebx
493: ba 00 00 00 00 mov $0x0,%edx
498: f7 f3 div %ebx
49a: 89 d0 mov %edx,%eax
49c: 0f b6 80 c4 10 00 00 movzbl 0x10c4(%eax),%eax
4a3: 88 44 0d e0 mov %al,0xffffffe0(%ebp,%ecx,1)
4a7: 83 45 f0 01 addl $0x1,0xfffffff0(%ebp)
}while((x /= base) != 0);
4ab: 8b 55 10 mov 0x10(%ebp),%edx
4ae: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
4b1: 89 d1 mov %edx,%ecx
4b3: ba 00 00 00 00 mov $0x0,%edx
4b8: f7 f1 div %ecx
4ba: 89 45 f8 mov %eax,0xfffffff8(%ebp)
4bd: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
4c1: 75 c5 jne 488 <printint+0x38>
if(neg)
4c3: 83 7d f4 00 cmpl $0x0,0xfffffff4(%ebp)
4c7: 74 28 je 4f1 <printint+0xa1>
buf[i++] = '-';
4c9: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
4cc: c6 44 05 e0 2d movb $0x2d,0xffffffe0(%ebp,%eax,1)
4d1: 83 45 f0 01 addl $0x1,0xfffffff0(%ebp)
while(--i >= 0)
4d5: eb 1a jmp 4f1 <printint+0xa1>
putc(fd, buf[i]);
4d7: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
4da: 0f b6 44 05 e0 movzbl 0xffffffe0(%ebp,%eax,1),%eax
4df: 0f be c0 movsbl %al,%eax
4e2: 89 44 24 04 mov %eax,0x4(%esp)
4e6: 8b 45 08 mov 0x8(%ebp),%eax
4e9: 89 04 24 mov %eax,(%esp)
4ec: e8 2f ff ff ff call 420 <putc>
4f1: 83 6d f0 01 subl $0x1,0xfffffff0(%ebp)
4f5: 83 7d f0 00 cmpl $0x0,0xfffffff0(%ebp)
4f9: 79 dc jns 4d7 <printint+0x87>
}
4fb: 83 c4 34 add $0x34,%esp
4fe: 5b pop %ebx
4ff: 5d pop %ebp
500: c3 ret
501: eb 0d jmp 510 <printf>
503: 90 nop
504: 90 nop
505: 90 nop
506: 90 nop
507: 90 nop
508: 90 nop
509: 90 nop
50a: 90 nop
50b: 90 nop
50c: 90 nop
50d: 90 nop
50e: 90 nop
50f: 90 nop
00000510 <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
510: 55 push %ebp
511: 89 e5 mov %esp,%ebp
513: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
516: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
ap = (uint*)(void*)&fmt + 1;
51d: 8d 45 0c lea 0xc(%ebp),%eax
520: 83 c0 04 add $0x4,%eax
523: 89 45 fc mov %eax,0xfffffffc(%ebp)
for(i = 0; fmt[i]; i++){
526: c7 45 f4 00 00 00 00 movl $0x0,0xfffffff4(%ebp)
52d: e9 7b 01 00 00 jmp 6ad <printf+0x19d>
c = fmt[i] & 0xff;
532: 8b 55 0c mov 0xc(%ebp),%edx
535: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
538: 8d 04 02 lea (%edx,%eax,1),%eax
53b: 0f b6 00 movzbl (%eax),%eax
53e: 0f be c0 movsbl %al,%eax
541: 25 ff 00 00 00 and $0xff,%eax
546: 89 45 f0 mov %eax,0xfffffff0(%ebp)
if(state == 0){
549: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
54d: 75 2c jne 57b <printf+0x6b>
if(c == '%'){
54f: 83 7d f0 25 cmpl $0x25,0xfffffff0(%ebp)
553: 75 0c jne 561 <printf+0x51>
state = '%';
555: c7 45 f8 25 00 00 00 movl $0x25,0xfffffff8(%ebp)
55c: e9 48 01 00 00 jmp 6a9 <printf+0x199>
} else {
putc(fd, c);
561: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
564: 0f be c0 movsbl %al,%eax
567: 89 44 24 04 mov %eax,0x4(%esp)
56b: 8b 45 08 mov 0x8(%ebp),%eax
56e: 89 04 24 mov %eax,(%esp)
571: e8 aa fe ff ff call 420 <putc>
576: e9 2e 01 00 00 jmp 6a9 <printf+0x199>
}
} else if(state == '%'){
57b: 83 7d f8 25 cmpl $0x25,0xfffffff8(%ebp)
57f: 0f 85 24 01 00 00 jne 6a9 <printf+0x199>
if(c == 'd'){
585: 83 7d f0 64 cmpl $0x64,0xfffffff0(%ebp)
589: 75 2d jne 5b8 <printf+0xa8>
printint(fd, *ap, 10, 1);
58b: 8b 45 fc mov 0xfffffffc(%ebp),%eax
58e: 8b 00 mov (%eax),%eax
590: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
597: 00
598: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
59f: 00
5a0: 89 44 24 04 mov %eax,0x4(%esp)
5a4: 8b 45 08 mov 0x8(%ebp),%eax
5a7: 89 04 24 mov %eax,(%esp)
5aa: e8 a1 fe ff ff call 450 <printint>
ap++;
5af: 83 45 fc 04 addl $0x4,0xfffffffc(%ebp)
5b3: e9 ea 00 00 00 jmp 6a2 <printf+0x192>
} else if(c == 'x' || c == 'p'){
5b8: 83 7d f0 78 cmpl $0x78,0xfffffff0(%ebp)
5bc: 74 06 je 5c4 <printf+0xb4>
5be: 83 7d f0 70 cmpl $0x70,0xfffffff0(%ebp)
5c2: 75 2d jne 5f1 <printf+0xe1>
printint(fd, *ap, 16, 0);
5c4: 8b 45 fc mov 0xfffffffc(%ebp),%eax
5c7: 8b 00 mov (%eax),%eax
5c9: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
5d0: 00
5d1: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
5d8: 00
5d9: 89 44 24 04 mov %eax,0x4(%esp)
5dd: 8b 45 08 mov 0x8(%ebp),%eax
5e0: 89 04 24 mov %eax,(%esp)
5e3: e8 68 fe ff ff call 450 <printint>
ap++;
5e8: 83 45 fc 04 addl $0x4,0xfffffffc(%ebp)
5ec: e9 b1 00 00 00 jmp 6a2 <printf+0x192>
} else if(c == 's'){
5f1: 83 7d f0 73 cmpl $0x73,0xfffffff0(%ebp)
5f5: 75 43 jne 63a <printf+0x12a>
s = (char*)*ap;
5f7: 8b 45 fc mov 0xfffffffc(%ebp),%eax
5fa: 8b 00 mov (%eax),%eax
5fc: 89 45 ec mov %eax,0xffffffec(%ebp)
ap++;
5ff: 83 45 fc 04 addl $0x4,0xfffffffc(%ebp)
if(s == 0)
603: 83 7d ec 00 cmpl $0x0,0xffffffec(%ebp)
607: 75 25 jne 62e <printf+0x11e>
s = "(null)";
609: c7 45 ec a8 10 00 00 movl $0x10a8,0xffffffec(%ebp)
while(*s != 0){
610: eb 1c jmp 62e <printf+0x11e>
putc(fd, *s);
612: 8b 45 ec mov 0xffffffec(%ebp),%eax
615: 0f b6 00 movzbl (%eax),%eax
618: 0f be c0 movsbl %al,%eax
61b: 89 44 24 04 mov %eax,0x4(%esp)
61f: 8b 45 08 mov 0x8(%ebp),%eax
622: 89 04 24 mov %eax,(%esp)
625: e8 f6 fd ff ff call 420 <putc>
s++;
62a: 83 45 ec 01 addl $0x1,0xffffffec(%ebp)
62e: 8b 45 ec mov 0xffffffec(%ebp),%eax
631: 0f b6 00 movzbl (%eax),%eax
634: 84 c0 test %al,%al
636: 75 da jne 612 <printf+0x102>
638: eb 68 jmp 6a2 <printf+0x192>
}
} else if(c == 'c'){
63a: 83 7d f0 63 cmpl $0x63,0xfffffff0(%ebp)
63e: 75 1d jne 65d <printf+0x14d>
putc(fd, *ap);
640: 8b 45 fc mov 0xfffffffc(%ebp),%eax
643: 8b 00 mov (%eax),%eax
645: 0f be c0 movsbl %al,%eax
648: 89 44 24 04 mov %eax,0x4(%esp)
64c: 8b 45 08 mov 0x8(%ebp),%eax
64f: 89 04 24 mov %eax,(%esp)
652: e8 c9 fd ff ff call 420 <putc>
ap++;
657: 83 45 fc 04 addl $0x4,0xfffffffc(%ebp)
65b: eb 45 jmp 6a2 <printf+0x192>
} else if(c == '%'){
65d: 83 7d f0 25 cmpl $0x25,0xfffffff0(%ebp)
661: 75 17 jne 67a <printf+0x16a>
putc(fd, c);
663: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
666: 0f be c0 movsbl %al,%eax
669: 89 44 24 04 mov %eax,0x4(%esp)
66d: 8b 45 08 mov 0x8(%ebp),%eax
670: 89 04 24 mov %eax,(%esp)
673: e8 a8 fd ff ff call 420 <putc>
678: eb 28 jmp 6a2 <printf+0x192>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
67a: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
681: 00
682: 8b 45 08 mov 0x8(%ebp),%eax
685: 89 04 24 mov %eax,(%esp)
688: e8 93 fd ff ff call 420 <putc>
putc(fd, c);
68d: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
690: 0f be c0 movsbl %al,%eax
693: 89 44 24 04 mov %eax,0x4(%esp)
697: 8b 45 08 mov 0x8(%ebp),%eax
69a: 89 04 24 mov %eax,(%esp)
69d: e8 7e fd ff ff call 420 <putc>
}
state = 0;
6a2: c7 45 f8 00 00 00 00 movl $0x0,0xfffffff8(%ebp)
6a9: 83 45 f4 01 addl $0x1,0xfffffff4(%ebp)
6ad: 8b 55 0c mov 0xc(%ebp),%edx
6b0: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
6b3: 8d 04 02 lea (%edx,%eax,1),%eax
6b6: 0f b6 00 movzbl (%eax),%eax
6b9: 84 c0 test %al,%al
6bb: 0f 85 71 fe ff ff jne 532 <printf+0x22>
}
}
}
6c1: c9 leave
6c2: c3 ret
6c3: 90 nop
6c4: 90 nop
6c5: 90 nop
6c6: 90 nop
6c7: 90 nop
6c8: 90 nop
6c9: 90 nop
6ca: 90 nop
6cb: 90 nop
6cc: 90 nop
6cd: 90 nop
6ce: 90 nop
6cf: 90 nop
000006d0 <free>:
static Header *freep;
void
free(void *ap)
{
6d0: 55 push %ebp
6d1: 89 e5 mov %esp,%ebp
6d3: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*) ap - 1;
6d6: 8b 45 08 mov 0x8(%ebp),%eax
6d9: 83 e8 08 sub $0x8,%eax
6dc: 89 45 f8 mov %eax,0xfffffff8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
6df: a1 e0 10 00 00 mov 0x10e0,%eax
6e4: 89 45 fc mov %eax,0xfffffffc(%ebp)
6e7: eb 24 jmp 70d <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
6e9: 8b 45 fc mov 0xfffffffc(%ebp),%eax
6ec: 8b 00 mov (%eax),%eax
6ee: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
6f1: 77 12 ja 705 <free+0x35>
6f3: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
6f6: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
6f9: 77 24 ja 71f <free+0x4f>
6fb: 8b 45 fc mov 0xfffffffc(%ebp),%eax
6fe: 8b 00 mov (%eax),%eax
700: 3b 45 f8 cmp 0xfffffff8(%ebp),%eax
703: 77 1a ja 71f <free+0x4f>
705: 8b 45 fc mov 0xfffffffc(%ebp),%eax
708: 8b 00 mov (%eax),%eax
70a: 89 45 fc mov %eax,0xfffffffc(%ebp)
70d: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
710: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
713: 76 d4 jbe 6e9 <free+0x19>
715: 8b 45 fc mov 0xfffffffc(%ebp),%eax
718: 8b 00 mov (%eax),%eax
71a: 3b 45 f8 cmp 0xfffffff8(%ebp),%eax
71d: 76 ca jbe 6e9 <free+0x19>
break;
if(bp + bp->s.size == p->s.ptr){
71f: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
722: 8b 40 04 mov 0x4(%eax),%eax
725: c1 e0 03 shl $0x3,%eax
728: 89 c2 mov %eax,%edx
72a: 03 55 f8 add 0xfffffff8(%ebp),%edx
72d: 8b 45 fc mov 0xfffffffc(%ebp),%eax
730: 8b 00 mov (%eax),%eax
732: 39 c2 cmp %eax,%edx
734: 75 24 jne 75a <free+0x8a>
bp->s.size += p->s.ptr->s.size;
736: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
739: 8b 50 04 mov 0x4(%eax),%edx
73c: 8b 45 fc mov 0xfffffffc(%ebp),%eax
73f: 8b 00 mov (%eax),%eax
741: 8b 40 04 mov 0x4(%eax),%eax
744: 01 c2 add %eax,%edx
746: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
749: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
74c: 8b 45 fc mov 0xfffffffc(%ebp),%eax
74f: 8b 00 mov (%eax),%eax
751: 8b 10 mov (%eax),%edx
753: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
756: 89 10 mov %edx,(%eax)
758: eb 0a jmp 764 <free+0x94>
} else
bp->s.ptr = p->s.ptr;
75a: 8b 45 fc mov 0xfffffffc(%ebp),%eax
75d: 8b 10 mov (%eax),%edx
75f: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
762: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
764: 8b 45 fc mov 0xfffffffc(%ebp),%eax
767: 8b 40 04 mov 0x4(%eax),%eax
76a: c1 e0 03 shl $0x3,%eax
76d: 03 45 fc add 0xfffffffc(%ebp),%eax
770: 3b 45 f8 cmp 0xfffffff8(%ebp),%eax
773: 75 20 jne 795 <free+0xc5>
p->s.size += bp->s.size;
775: 8b 45 fc mov 0xfffffffc(%ebp),%eax
778: 8b 50 04 mov 0x4(%eax),%edx
77b: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
77e: 8b 40 04 mov 0x4(%eax),%eax
781: 01 c2 add %eax,%edx
783: 8b 45 fc mov 0xfffffffc(%ebp),%eax
786: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
789: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
78c: 8b 10 mov (%eax),%edx
78e: 8b 45 fc mov 0xfffffffc(%ebp),%eax
791: 89 10 mov %edx,(%eax)
793: eb 08 jmp 79d <free+0xcd>
} else
p->s.ptr = bp;
795: 8b 55 fc mov 0xfffffffc(%ebp),%edx
798: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
79b: 89 02 mov %eax,(%edx)
freep = p;
79d: 8b 45 fc mov 0xfffffffc(%ebp),%eax
7a0: a3 e0 10 00 00 mov %eax,0x10e0
}
7a5: c9 leave
7a6: c3 ret
7a7: 89 f6 mov %esi,%esi
7a9: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
000007b0 <morecore>:
static Header*
morecore(uint nu)
{
7b0: 55 push %ebp
7b1: 89 e5 mov %esp,%ebp
7b3: 83 ec 18 sub $0x18,%esp
char *p;
Header *hp;
int size;
#ifdef UMALLOC_DEBUG
printf(1, "morecore: %d\n", nu);
#endif
#ifdef UMALLOC_NOALIGN
if(nu < PAGE)
nu = PAGE;
#else
size = nu * sizeof(Header);
7b6: 8b 45 08 mov 0x8(%ebp),%eax
7b9: c1 e0 03 shl $0x3,%eax
7bc: 89 45 fc mov %eax,0xfffffffc(%ebp)
size += PAGE - size % PAGE;
7bf: 8b 55 fc mov 0xfffffffc(%ebp),%edx
7c2: 89 d0 mov %edx,%eax
7c4: c1 f8 1f sar $0x1f,%eax
7c7: 89 c1 mov %eax,%ecx
7c9: c1 e9 14 shr $0x14,%ecx
7cc: 8d 04 0a lea (%edx,%ecx,1),%eax
7cf: 25 ff 0f 00 00 and $0xfff,%eax
7d4: 29 c8 sub %ecx,%eax
7d6: 89 c2 mov %eax,%edx
7d8: b8 00 10 00 00 mov $0x1000,%eax
7dd: 29 d0 sub %edx,%eax
7df: 01 45 fc add %eax,0xfffffffc(%ebp)
#endif
#ifdef UMALLOC_DEBUG
printf(1, "size: %d\n", size);
#endif
p = sbrk(size);
7e2: 8b 45 fc mov 0xfffffffc(%ebp),%eax
7e5: 89 04 24 mov %eax,(%esp)
7e8: e8 9f fb ff ff call 38c <sbrk>
7ed: 89 45 f4 mov %eax,0xfffffff4(%ebp)
if(p == (char*) -1)
7f0: 83 7d f4 ff cmpl $0xffffffff,0xfffffff4(%ebp)
7f4: 75 09 jne 7ff <morecore+0x4f>
return 0;
7f6: c7 45 ec 00 00 00 00 movl $0x0,0xffffffec(%ebp)
7fd: eb 2a jmp 829 <morecore+0x79>
hp = (Header*)p;
7ff: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
802: 89 45 f8 mov %eax,0xfffffff8(%ebp)
#ifdef UMALLOC_NOALIGN
hp->s.size = nu;
#else
hp->s.size = size / sizeof(Header);
805: 8b 45 fc mov 0xfffffffc(%ebp),%eax
808: 89 c2 mov %eax,%edx
80a: c1 ea 03 shr $0x3,%edx
80d: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
810: 89 50 04 mov %edx,0x4(%eax)
#endif
free((void*)(hp + 1));
813: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
816: 83 c0 08 add $0x8,%eax
819: 89 04 24 mov %eax,(%esp)
81c: e8 af fe ff ff call 6d0 <free>
return freep;
821: a1 e0 10 00 00 mov 0x10e0,%eax
826: 89 45 ec mov %eax,0xffffffec(%ebp)
829: 8b 45 ec mov 0xffffffec(%ebp),%eax
}
82c: c9 leave
82d: c3 ret
82e: 89 f6 mov %esi,%esi
00000830 <malloc>:
void*
malloc(uint nbytes)
{
830: 55 push %ebp
831: 89 e5 mov %esp,%ebp
833: 83 ec 18 sub $0x18,%esp
Header *p, *prevp;
uint nunits;
#ifdef UMALLOC_DEBUG
printf(1, "malloc: %d bytes\n", nbytes);
printf(1, "size of Header: %d\n", sizeof(Header));
#endif
if (PAGE % sizeof(Header))
printf(2, "Warning! align failed! Need UMALLOC_NOALIGN\n");
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
836: 8b 45 08 mov 0x8(%ebp),%eax
839: 83 c0 07 add $0x7,%eax
83c: c1 e8 03 shr $0x3,%eax
83f: 83 c0 01 add $0x1,%eax
842: 89 45 fc mov %eax,0xfffffffc(%ebp)
if((prevp = freep) == 0){
845: a1 e0 10 00 00 mov 0x10e0,%eax
84a: 89 45 f8 mov %eax,0xfffffff8(%ebp)
84d: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
851: 75 23 jne 876 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
853: c7 45 f8 d8 10 00 00 movl $0x10d8,0xfffffff8(%ebp)
85a: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
85d: a3 e0 10 00 00 mov %eax,0x10e0
862: a1 e0 10 00 00 mov 0x10e0,%eax
867: a3 d8 10 00 00 mov %eax,0x10d8
base.s.size = 0;
86c: c7 05 dc 10 00 00 00 movl $0x0,0x10dc
873: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
876: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
879: 8b 00 mov (%eax),%eax
87b: 89 45 f4 mov %eax,0xfffffff4(%ebp)
if(p->s.size >= nunits){
87e: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
881: 8b 40 04 mov 0x4(%eax),%eax
884: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
887: 72 50 jb 8d9 <malloc+0xa9>
if(p->s.size == nunits)
889: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
88c: 8b 40 04 mov 0x4(%eax),%eax
88f: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
892: 75 0c jne 8a0 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
894: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
897: 8b 10 mov (%eax),%edx
899: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
89c: 89 10 mov %edx,(%eax)
89e: eb 26 jmp 8c6 <malloc+0x96>
else {
p->s.size -= nunits;
8a0: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
8a3: 8b 40 04 mov 0x4(%eax),%eax
8a6: 89 c2 mov %eax,%edx
8a8: 2b 55 fc sub 0xfffffffc(%ebp),%edx
8ab: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
8ae: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
8b1: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
8b4: 8b 40 04 mov 0x4(%eax),%eax
8b7: c1 e0 03 shl $0x3,%eax
8ba: 01 45 f4 add %eax,0xfffffff4(%ebp)
p->s.size = nunits;
8bd: 8b 55 f4 mov 0xfffffff4(%ebp),%edx
8c0: 8b 45 fc mov 0xfffffffc(%ebp),%eax
8c3: 89 42 04 mov %eax,0x4(%edx)
}
freep = prevp;
8c6: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
8c9: a3 e0 10 00 00 mov %eax,0x10e0
return (void*) (p + 1);
8ce: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
8d1: 83 c0 08 add $0x8,%eax
8d4: 89 45 ec mov %eax,0xffffffec(%ebp)
8d7: eb 3a jmp 913 <malloc+0xe3>
}
if(p == freep)
8d9: a1 e0 10 00 00 mov 0x10e0,%eax
8de: 39 45 f4 cmp %eax,0xfffffff4(%ebp)
8e1: 75 1d jne 900 <malloc+0xd0>
if((p = morecore(nunits)) == 0)
8e3: 8b 45 fc mov 0xfffffffc(%ebp),%eax
8e6: 89 04 24 mov %eax,(%esp)
8e9: e8 c2 fe ff ff call 7b0 <morecore>
8ee: 89 45 f4 mov %eax,0xfffffff4(%ebp)
8f1: 83 7d f4 00 cmpl $0x0,0xfffffff4(%ebp)
8f5: 75 09 jne 900 <malloc+0xd0>
return 0;
8f7: c7 45 ec 00 00 00 00 movl $0x0,0xffffffec(%ebp)
8fe: eb 13 jmp 913 <malloc+0xe3>
900: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
903: 89 45 f8 mov %eax,0xfffffff8(%ebp)
906: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
909: 8b 00 mov (%eax),%eax
90b: 89 45 f4 mov %eax,0xfffffff4(%ebp)
}
90e: e9 6b ff ff ff jmp 87e <malloc+0x4e>
913: 8b 45 ec mov 0xffffffec(%ebp),%eax
}
916: c9 leave
917: c3 ret
918: 90 nop
919: 90 nop
91a: 90 nop
91b: 90 nop
91c: 90 nop
91d: 90 nop
91e: 90 nop
91f: 90 nop
00000920 <lwip_chksum>:
static u16_t
lwip_chksum(void *dataptr, int len)
{
920: 55 push %ebp
921: 89 e5 mov %esp,%ebp
923: 83 ec 18 sub $0x18,%esp
u32_t acc;
LWIP_DEBUGF(INET_DEBUG, ("lwip_chksum(%p, %d)\n", (void *)dataptr, len));
for(acc = 0; len > 1; len -= 2) {
926: c7 45 fc 00 00 00 00 movl $0x0,0xfffffffc(%ebp)
92d: eb 19 jmp 948 <lwip_chksum+0x28>
/* acc = acc + *((u16_t *)dataptr)++;*/
acc += *(u16_t *)dataptr;
92f: 8b 45 08 mov 0x8(%ebp),%eax
932: 0f b7 00 movzwl (%eax),%eax
935: 0f b7 c0 movzwl %ax,%eax
938: 01 45 fc add %eax,0xfffffffc(%ebp)
dataptr = (void *)((u16_t *)dataptr + 1);
93b: 8b 45 08 mov 0x8(%ebp),%eax
93e: 83 c0 02 add $0x2,%eax
941: 89 45 08 mov %eax,0x8(%ebp)
944: 83 6d 0c 02 subl $0x2,0xc(%ebp)
948: 83 7d 0c 01 cmpl $0x1,0xc(%ebp)
94c: 7f e1 jg 92f <lwip_chksum+0xf>
}
/* add up any odd byte */
if (len == 1) {
94e: 83 7d 0c 01 cmpl $0x1,0xc(%ebp)
952: 75 1d jne 971 <lwip_chksum+0x51>
acc += htons((u16_t)((*(u8_t *)dataptr) & 0xff) << 8);
954: 8b 45 08 mov 0x8(%ebp),%eax
957: 0f b6 00 movzbl (%eax),%eax
95a: 0f b6 c0 movzbl %al,%eax
95d: c1 e0 08 shl $0x8,%eax
960: 0f b7 c0 movzwl %ax,%eax
963: 89 04 24 mov %eax,(%esp)
966: e8 85 06 00 00 call ff0 <htons>
96b: 0f b7 c0 movzwl %ax,%eax
96e: 01 45 fc add %eax,0xfffffffc(%ebp)
LWIP_DEBUGF(INET_DEBUG, ("inet: chksum: odd byte %d\n", (unsigned int)(*(u8_t *)dataptr)));
} else {
LWIP_DEBUGF(INET_DEBUG, ("inet: chksum: no odd byte\n"));
}
acc = (acc >> 16) + (acc & 0xffffUL);
971: 8b 45 fc mov 0xfffffffc(%ebp),%eax
974: 89 c2 mov %eax,%edx
976: c1 ea 10 shr $0x10,%edx
979: 0f b7 45 fc movzwl 0xfffffffc(%ebp),%eax
97d: 8d 04 02 lea (%edx,%eax,1),%eax
980: 89 45 fc mov %eax,0xfffffffc(%ebp)
if ((acc & 0xffff0000) != 0) {
983: 8b 45 fc mov 0xfffffffc(%ebp),%eax
986: 66 b8 00 00 mov $0x0,%ax
98a: 85 c0 test %eax,%eax
98c: 74 12 je 9a0 <lwip_chksum+0x80>
acc = (acc >> 16) + (acc & 0xffffUL);
98e: 8b 45 fc mov 0xfffffffc(%ebp),%eax
991: 89 c2 mov %eax,%edx
993: c1 ea 10 shr $0x10,%edx
996: 0f b7 45 fc movzwl 0xfffffffc(%ebp),%eax
99a: 8d 04 02 lea (%edx,%eax,1),%eax
99d: 89 45 fc mov %eax,0xfffffffc(%ebp)
}
return (u16_t)acc;
9a0: 8b 45 fc mov 0xfffffffc(%ebp),%eax
9a3: 0f b7 c0 movzwl %ax,%eax
}
9a6: c9 leave
9a7: c3 ret
9a8: 90 nop
9a9: 8d b4 26 00 00 00 00 lea 0x0(%esi),%esi
000009b0 <inet_chksum_pseudo>:
/* inet_chksum_pseudo:
*
* Calculates the pseudo Internet checksum used by TCP and UDP for a pbuf chain.
*/
u16_t
inet_chksum_pseudo(struct pbuf *p,
struct ip_addr *src, struct ip_addr *dest,
u8_t proto, u16_t proto_len)
{
9b0: 55 push %ebp
9b1: 89 e5 mov %esp,%ebp
9b3: 83 ec 28 sub $0x28,%esp
9b6: 8b 45 14 mov 0x14(%ebp),%eax
9b9: 8b 55 18 mov 0x18(%ebp),%edx
9bc: 88 45 ec mov %al,0xffffffec(%ebp)
9bf: 66 89 55 e8 mov %dx,0xffffffe8(%ebp)
u32_t acc;
struct pbuf *q;
u8_t swapped;
acc = 0;
9c3: c7 45 f4 00 00 00 00 movl $0x0,0xfffffff4(%ebp)
swapped = 0;
9ca: c6 45 ff 00 movb $0x0,0xffffffff(%ebp)
/* iterate through all pbuf in chain */
for(q = p; q != NULL; q = q->next) {
9ce: 8b 45 08 mov 0x8(%ebp),%eax
9d1: 89 45 f8 mov %eax,0xfffffff8(%ebp)
9d4: eb 7b jmp a51 <inet_chksum_pseudo+0xa1>
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): checksumming pbuf %p (has next %p) \n",
(void *)q, (void *)q->next));
acc += lwip_chksum(q->payload, q->len);
9d6: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
9d9: 0f b7 40 0a movzwl 0xa(%eax),%eax
9dd: 0f b7 d0 movzwl %ax,%edx
9e0: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
9e3: 8b 40 04 mov 0x4(%eax),%eax
9e6: 89 54 24 04 mov %edx,0x4(%esp)
9ea: 89 04 24 mov %eax,(%esp)
9ed: e8 2e ff ff ff call 920 <lwip_chksum>
9f2: 0f b7 c0 movzwl %ax,%eax
9f5: 01 45 f4 add %eax,0xfffffff4(%ebp)
/*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): unwrapped lwip_chksum()=%lx \n", acc));*/
while (acc >> 16) {
9f8: eb 10 jmp a0a <inet_chksum_pseudo+0x5a>
acc = (acc & 0xffffUL) + (acc >> 16);
9fa: 0f b7 55 f4 movzwl 0xfffffff4(%ebp),%edx
9fe: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
a01: c1 e8 10 shr $0x10,%eax
a04: 8d 04 02 lea (%edx,%eax,1),%eax
a07: 89 45 f4 mov %eax,0xfffffff4(%ebp)
a0a: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
a0d: c1 e8 10 shr $0x10,%eax
a10: 85 c0 test %eax,%eax
a12: 75 e6 jne 9fa <inet_chksum_pseudo+0x4a>
}
if (q->len % 2 != 0) {
a14: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
a17: 0f b7 40 0a movzwl 0xa(%eax),%eax
a1b: 0f b7 c0 movzwl %ax,%eax
a1e: 83 e0 01 and $0x1,%eax
a21: 84 c0 test %al,%al
a23: 74 24 je a49 <inet_chksum_pseudo+0x99>
swapped = 1 - swapped;
a25: b8 01 00 00 00 mov $0x1,%eax
a2a: 2a 45 ff sub 0xffffffff(%ebp),%al
a2d: 88 45 ff mov %al,0xffffffff(%ebp)
acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
a30: 0f b6 45 f4 movzbl 0xfffffff4(%ebp),%eax
a34: 89 c2 mov %eax,%edx
a36: c1 e2 08 shl $0x8,%edx
a39: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
a3c: 25 00 ff 00 00 and $0xff00,%eax
a41: c1 e8 08 shr $0x8,%eax
a44: 09 d0 or %edx,%eax
a46: 89 45 f4 mov %eax,0xfffffff4(%ebp)
a49: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
a4c: 8b 00 mov (%eax),%eax
a4e: 89 45 f8 mov %eax,0xfffffff8(%ebp)
a51: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
a55: 0f 85 7b ff ff ff jne 9d6 <inet_chksum_pseudo+0x26>
}
/*LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): wrapped lwip_chksum()=%lx \n", acc));*/
}
if (swapped) {
a5b: 80 7d ff 00 cmpb $0x0,0xffffffff(%ebp)
a5f: 74 19 je a7a <inet_chksum_pseudo+0xca>
acc = ((acc & 0xff) << 8) | ((acc & 0xff00UL) >> 8);
a61: 0f b6 45 f4 movzbl 0xfffffff4(%ebp),%eax
a65: 89 c2 mov %eax,%edx
a67: c1 e2 08 shl $0x8,%edx
a6a: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
a6d: 25 00 ff 00 00 and $0xff00,%eax
a72: c1 e8 08 shr $0x8,%eax
a75: 09 d0 or %edx,%eax
a77: 89 45 f4 mov %eax,0xfffffff4(%ebp)
}
acc += (src->addr & 0xffffUL);
a7a: 8b 45 0c mov 0xc(%ebp),%eax
a7d: 8b 00 mov (%eax),%eax
a7f: 25 ff ff 00 00 and $0xffff,%eax
a84: 01 45 f4 add %eax,0xfffffff4(%ebp)
acc += ((src->addr >> 16) & 0xffffUL);
a87: 8b 45 0c mov 0xc(%ebp),%eax
a8a: 8b 00 mov (%eax),%eax
a8c: c1 e8 10 shr $0x10,%eax
a8f: 25 ff ff 00 00 and $0xffff,%eax
a94: 01 45 f4 add %eax,0xfffffff4(%ebp)
acc += (dest->addr & 0xffffUL);
a97: 8b 45 10 mov 0x10(%ebp),%eax
a9a: 8b 00 mov (%eax),%eax
a9c: 25 ff ff 00 00 and $0xffff,%eax
aa1: 01 45 f4 add %eax,0xfffffff4(%ebp)
acc += ((dest->addr >> 16) & 0xffffUL);
aa4: 8b 45 10 mov 0x10(%ebp),%eax
aa7: 8b 00 mov (%eax),%eax
aa9: c1 e8 10 shr $0x10,%eax
aac: 25 ff ff 00 00 and $0xffff,%eax
ab1: 01 45 f4 add %eax,0xfffffff4(%ebp)
acc += (u32_t)htons((u16_t)proto);
ab4: 0f b6 45 ec movzbl 0xffffffec(%ebp),%eax
ab8: 89 04 24 mov %eax,(%esp)
abb: e8 30 05 00 00 call ff0 <htons>
ac0: 0f b7 c0 movzwl %ax,%eax
ac3: 01 45 f4 add %eax,0xfffffff4(%ebp)
acc += (u32_t)htons(proto_len);
ac6: 0f b7 45 e8 movzwl 0xffffffe8(%ebp),%eax
aca: 89 04 24 mov %eax,(%esp)
acd: e8 1e 05 00 00 call ff0 <htons>
ad2: 0f b7 c0 movzwl %ax,%eax
ad5: 01 45 f4 add %eax,0xfffffff4(%ebp)
while (acc >> 16) {
ad8: eb 10 jmp aea <inet_chksum_pseudo+0x13a>
acc = (acc & 0xffffUL) + (acc >> 16);
ada: 0f b7 55 f4 movzwl 0xfffffff4(%ebp),%edx
ade: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
ae1: c1 e8 10 shr $0x10,%eax
ae4: 8d 04 02 lea (%edx,%eax,1),%eax
ae7: 89 45 f4 mov %eax,0xfffffff4(%ebp)
aea: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
aed: c1 e8 10 shr $0x10,%eax
af0: 85 c0 test %eax,%eax
af2: 75 e6 jne ada <inet_chksum_pseudo+0x12a>
}
LWIP_DEBUGF(INET_DEBUG, ("inet_chksum_pseudo(): pbuf chain lwip_chksum()=%lx\n", acc));
return ~(acc & 0xffffUL);
af4: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
af7: f7 d0 not %eax
af9: 0f b7 c0 movzwl %ax,%eax
}
afc: c9 leave
afd: c3 ret
afe: 89 f6 mov %esi,%esi
00000b00 <inet_chksum>:
/* inet_chksum:
*
* Calculates the Internet checksum over a portion of memory. Used primarely for IP
* and ICMP.
*/
u16_t
inet_chksum(void *dataptr, u16_t len)
{
b00: 55 push %ebp
b01: 89 e5 mov %esp,%ebp
b03: 83 ec 28 sub $0x28,%esp
b06: 8b 45 0c mov 0xc(%ebp),%eax
b09: 66 89 45 ec mov %ax,0xffffffec(%ebp)
u32_t acc;
acc = lwip_chksum(dataptr, len);
b0d: 0f b7 45 ec movzwl 0xffffffec(%ebp),%eax
b11: 89 44 24 04 mov %eax,0x4(%esp)
b15: 8b 45 08 mov 0x8(%ebp),%eax
b18: 89 04 24 mov %eax,(%esp)
b1b: e8 00 fe ff ff call 920 <lwip_chksum>
b20: 0f b7 c0 movzwl %ax,%eax
b23: 89 45 fc mov %eax,0xfffffffc(%ebp)
while (acc >> 16) {
b26: eb 10 jmp b38 <inet_chksum+0x38>
acc = (acc & 0xffff) + (acc >> 16);
b28: 0f b7 55 fc movzwl 0xfffffffc(%ebp),%edx
b2c: 8b 45 fc mov 0xfffffffc(%ebp),%eax
b2f: c1 e8 10 shr $0x10,%eax
b32: 8d 04 02 lea (%edx,%eax,1),%eax
b35: 89 45 fc mov %eax,0xfffffffc(%ebp)
b38: 8b 45 fc mov 0xfffffffc(%ebp),%eax
b3b: c1 e8 10 shr $0x10,%eax
b3e: 85 c0 test %eax,%eax
b40: 75 e6 jne b28 <inet_chksum+0x28>
}
return ~(acc & 0xffff);
b42: 8b 45 fc mov 0xfffffffc(%ebp),%eax
b45: f7 d0 not %eax
b47: 0f b7 c0 movzwl %ax,%eax
}
b4a: c9 leave
b4b: c3 ret
b4c: 8d 74 26 00 lea 0x0(%esi),%esi
00000b50 <inet_chksum_pbuf>:
u16_t
inet_chksum_pbuf(struct pbuf *p)
{
b50: 55 push %ebp
b51: 89 e5 mov %esp,%ebp
b53: 83 ec 18 sub $0x18,%esp
u32_t acc;
struct pbuf *q;
u8_t swapped;
acc = 0;
b56: c7 45 f4 00 00 00 00 movl $0x0,0xfffffff4(%ebp)
swapped = 0;
b5d: c6 45 ff 00 movb $0x0,0xffffffff(%ebp)
for(q = p; q != NULL; q = q->next) {
b61: 8b 45 08 mov 0x8(%ebp),%eax
b64: 89 45 f8 mov %eax,0xfffffff8(%ebp)
b67: eb 69 jmp bd2 <inet_chksum_pbuf+0x82>
acc += lwip_chksum(q->payload, q->len);
b69: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
b6c: 0f b7 40 0a movzwl 0xa(%eax),%eax
b70: 0f b7 d0 movzwl %ax,%edx
b73: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
b76: 8b 40 04 mov 0x4(%eax),%eax
b79: 89 54 24 04 mov %edx,0x4(%esp)
b7d: 89 04 24 mov %eax,(%esp)
b80: e8 9b fd ff ff call 920 <lwip_chksum>
b85: 0f b7 c0 movzwl %ax,%eax
b88: 01 45 f4 add %eax,0xfffffff4(%ebp)
while (acc >> 16) {
b8b: eb 10 jmp b9d <inet_chksum_pbuf+0x4d>
acc = (acc & 0xffffUL) + (acc >> 16);
b8d: 0f b7 55 f4 movzwl 0xfffffff4(%ebp),%edx
b91: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
b94: c1 e8 10 shr $0x10,%eax
b97: 8d 04 02 lea (%edx,%eax,1),%eax
b9a: 89 45 f4 mov %eax,0xfffffff4(%ebp)
b9d: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
ba0: c1 e8 10 shr $0x10,%eax
ba3: 85 c0 test %eax,%eax
ba5: 75 e6 jne b8d <inet_chksum_pbuf+0x3d>
}
if (q->len % 2 != 0) {
ba7: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
baa: 0f b7 40 0a movzwl 0xa(%eax),%eax
bae: 0f b7 c0 movzwl %ax,%eax
bb1: 83 e0 01 and $0x1,%eax
bb4: 84 c0 test %al,%al
bb6: 74 12 je bca <inet_chksum_pbuf+0x7a>
swapped = 1 - swapped;
bb8: b8 01 00 00 00 mov $0x1,%eax
bbd: 2a 45 ff sub 0xffffffff(%ebp),%al
bc0: 88 45 ff mov %al,0xffffffff(%ebp)
acc = (acc & 0x00ffUL << 8) | (acc & 0xff00UL >> 8);
bc3: 81 65 f4 ff ff 00 00 andl $0xffff,0xfffffff4(%ebp)
bca: 8b 45 f8 mov 0xfffffff8(%ebp),%eax
bcd: 8b 00 mov (%eax),%eax
bcf: 89 45 f8 mov %eax,0xfffffff8(%ebp)
bd2: 83 7d f8 00 cmpl $0x0,0xfffffff8(%ebp)
bd6: 75 91 jne b69 <inet_chksum_pbuf+0x19>
}
}
if (swapped) {
bd8: 80 7d ff 00 cmpb $0x0,0xffffffff(%ebp)
bdc: 74 19 je bf7 <inet_chksum_pbuf+0xa7>
acc = ((acc & 0x00ffUL) << 8) | ((acc & 0xff00UL) >> 8);
bde: 0f b6 45 f4 movzbl 0xfffffff4(%ebp),%eax
be2: 89 c2 mov %eax,%edx
be4: c1 e2 08 shl $0x8,%edx
be7: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
bea: 25 00 ff 00 00 and $0xff00,%eax
bef: c1 e8 08 shr $0x8,%eax
bf2: 09 d0 or %edx,%eax
bf4: 89 45 f4 mov %eax,0xfffffff4(%ebp)
}
return ~(acc & 0xffffUL);
bf7: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
bfa: f7 d0 not %eax
bfc: 0f b7 c0 movzwl %ax,%eax
}
bff: c9 leave
c00: c3 ret
c01: eb 0d jmp c10 <inet_addr>
c03: 90 nop
c04: 90 nop
c05: 90 nop
c06: 90 nop
c07: 90 nop
c08: 90 nop
c09: 90 nop
c0a: 90 nop
c0b: 90 nop
c0c: 90 nop
c0d: 90 nop
c0e: 90 nop
c0f: 90 nop
00000c10 <inet_addr>:
/* Here for now until needed in other places in lwIP */
#ifndef isascii
#define in_range(c, lo, up) ((u8_t)c >= lo && (u8_t)c <= up)
#define isascii(c) in_range(c, 0x20, 0x7f)
#define isdigit(c) in_range(c, '0', '9')
#define isxdigit(c) (isdigit(c) || in_range(c, 'a', 'f') || in_range(c, 'A', 'F'))
#define islower(c) in_range(c, 'a', 'z')
#define isspace(c) (c == ' ' || c == '\f' || c == '\n' || c == '\r' || c == '\t' || c == '\v')
#endif
/*
* Ascii internet address interpretation routine.
* The value returned is in network order.
*/
/* */
/* inet_addr */
u32_t inet_addr(const char *cp)
{
c10: 55 push %ebp
c11: 89 e5 mov %esp,%ebp
c13: 83 ec 28 sub $0x28,%esp
struct in_addr val;
if (inet_aton(cp, &val)) {
c16: 8d 45 fc lea 0xfffffffc(%ebp),%eax
c19: 89 44 24 04 mov %eax,0x4(%esp)
c1d: 8b 45 08 mov 0x8(%ebp),%eax
c20: 89 04 24 mov %eax,(%esp)
c23: e8 18 00 00 00 call c40 <inet_aton>
c28: 85 c0 test %eax,%eax
c2a: 74 08 je c34 <inet_addr+0x24>
return (val.s_addr);
c2c: 8b 45 fc mov 0xfffffffc(%ebp),%eax
c2f: 89 45 ec mov %eax,0xffffffec(%ebp)
c32: eb 07 jmp c3b <inet_addr+0x2b>
}
return (INADDR_NONE);
c34: c7 45 ec ff ff ff ff movl $0xffffffff,0xffffffec(%ebp)
c3b: 8b 45 ec mov 0xffffffec(%ebp),%eax
}
c3e: c9 leave
c3f: c3 ret
00000c40 <inet_aton>:
/*
* Check whether "cp" is a valid ascii representation
* of an Internet address and convert to a binary address.
* Returns 1 if the address is valid, 0 if not.
* This replaces inet_addr, the return value from which
* cannot distinguish between failure and a local broadcast address.
*/
/* */
/* inet_aton */
int inet_aton(const char *cp, struct in_addr *addr)
{
c40: 55 push %ebp
c41: 89 e5 mov %esp,%ebp
c43: 83 ec 48 sub $0x48,%esp
u32_t val;
int base, n;
char c;
u32_t parts[4];
u32_t* pp = parts;
c46: 8d 45 dc lea 0xffffffdc(%ebp),%eax
c49: 89 45 fc mov %eax,0xfffffffc(%ebp)
c = *cp;
c4c: 8b 45 08 mov 0x8(%ebp),%eax
c4f: 0f b6 00 movzbl (%eax),%eax
c52: 88 45 fb mov %al,0xfffffffb(%ebp)
for (;;) {
/*
* Collect number up to ``.''.
* Values are specified as for C:
* 0x=hex, 0=octal, isdigit=decimal.
*/
if (!isdigit(c))
c55: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
c59: 3c 2f cmp $0x2f,%al
c5b: 76 08 jbe c65 <inet_aton+0x25>
c5d: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
c61: 3c 39 cmp $0x39,%al
c63: 76 0c jbe c71 <inet_aton+0x31>
return (0);
c65: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
c6c: e9 78 02 00 00 jmp ee9 <inet_aton+0x2a9>
val = 0; base = 10;
c71: c7 45 ec 00 00 00 00 movl $0x0,0xffffffec(%ebp)
c78: c7 45 f0 0a 00 00 00 movl $0xa,0xfffffff0(%ebp)
if (c == '0') {
c7f: 80 7d fb 30 cmpb $0x30,0xfffffffb(%ebp)
c83: 75 36 jne cbb <inet_aton+0x7b>
c = *++cp;
c85: 83 45 08 01 addl $0x1,0x8(%ebp)
c89: 8b 45 08 mov 0x8(%ebp),%eax
c8c: 0f b6 00 movzbl (%eax),%eax
c8f: 88 45 fb mov %al,0xfffffffb(%ebp)
if (c == 'x' || c == 'X')
c92: 80 7d fb 78 cmpb $0x78,0xfffffffb(%ebp)
c96: 74 06 je c9e <inet_aton+0x5e>
c98: 80 7d fb 58 cmpb $0x58,0xfffffffb(%ebp)
c9c: 75 16 jne cb4 <inet_aton+0x74>
base = 16, c = *++cp;
c9e: c7 45 f0 10 00 00 00 movl $0x10,0xfffffff0(%ebp)
ca5: 83 45 08 01 addl $0x1,0x8(%ebp)
ca9: 8b 45 08 mov 0x8(%ebp),%eax
cac: 0f b6 00 movzbl (%eax),%eax
caf: 88 45 fb mov %al,0xfffffffb(%ebp)
cb2: eb 07 jmp cbb <inet_aton+0x7b>
else
base = 8;
cb4: c7 45 f0 08 00 00 00 movl $0x8,0xfffffff0(%ebp)
}
for (;;) {
if (isascii(c) && isdigit(c)) {
cbb: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
cbf: 3c 1f cmp $0x1f,%al
cc1: 76 3b jbe cfe <inet_aton+0xbe>
cc3: 80 7d fb 00 cmpb $0x0,0xfffffffb(%ebp)
cc7: 78 35 js cfe <inet_aton+0xbe>
cc9: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
ccd: 3c 2f cmp $0x2f,%al
ccf: 76 2d jbe cfe <inet_aton+0xbe>
cd1: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
cd5: 3c 39 cmp $0x39,%al
cd7: 77 25 ja cfe <inet_aton+0xbe>
val = (val * base) + (c - '0');
cd9: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
cdc: 89 c2 mov %eax,%edx
cde: 0f af 55 ec imul 0xffffffec(%ebp),%edx
ce2: 0f be 45 fb movsbl 0xfffffffb(%ebp),%eax
ce6: 8d 04 02 lea (%edx,%eax,1),%eax
ce9: 83 e8 30 sub $0x30,%eax
cec: 89 45 ec mov %eax,0xffffffec(%ebp)
c = *++cp;
cef: 83 45 08 01 addl $0x1,0x8(%ebp)
cf3: 8b 45 08 mov 0x8(%ebp),%eax
cf6: 0f b6 00 movzbl (%eax),%eax
cf9: 88 45 fb mov %al,0xfffffffb(%ebp)
cfc: eb bd jmp cbb <inet_aton+0x7b>
} else if (base == 16 && isascii(c) && isxdigit(c)) {
cfe: 83 7d f0 10 cmpl $0x10,0xfffffff0(%ebp)
d02: 0f 85 99 00 00 00 jne da1 <inet_aton+0x161>
d08: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d0c: 3c 1f cmp $0x1f,%al
d0e: 0f 86 8d 00 00 00 jbe da1 <inet_aton+0x161>
d14: 80 7d fb 00 cmpb $0x0,0xfffffffb(%ebp)
d18: 0f 88 83 00 00 00 js da1 <inet_aton+0x161>
d1e: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d22: 3c 2f cmp $0x2f,%al
d24: 76 08 jbe d2e <inet_aton+0xee>
d26: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d2a: 3c 39 cmp $0x39,%al
d2c: 76 20 jbe d4e <inet_aton+0x10e>
d2e: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d32: 3c 60 cmp $0x60,%al
d34: 76 08 jbe d3e <inet_aton+0xfe>
d36: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d3a: 3c 66 cmp $0x66,%al
d3c: 76 10 jbe d4e <inet_aton+0x10e>
d3e: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d42: 3c 40 cmp $0x40,%al
d44: 76 5b jbe da1 <inet_aton+0x161>
d46: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d4a: 3c 46 cmp $0x46,%al
d4c: 77 53 ja da1 <inet_aton+0x161>
val = (val << 4) |
d4e: 8b 45 ec mov 0xffffffec(%ebp),%eax
d51: 89 c2 mov %eax,%edx
d53: c1 e2 04 shl $0x4,%edx
d56: 89 55 c4 mov %edx,0xffffffc4(%ebp)
d59: 0f be 45 fb movsbl 0xfffffffb(%ebp),%eax
d5d: 83 c0 0a add $0xa,%eax
d60: 89 45 c8 mov %eax,0xffffffc8(%ebp)
d63: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d67: 3c 60 cmp $0x60,%al
d69: 76 11 jbe d7c <inet_aton+0x13c>
d6b: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
d6f: 3c 7a cmp $0x7a,%al
d71: 77 09 ja d7c <inet_aton+0x13c>
d73: c7 45 cc 61 00 00 00 movl $0x61,0xffffffcc(%ebp)
d7a: eb 07 jmp d83 <inet_aton+0x143>
d7c: c7 45 cc 41 00 00 00 movl $0x41,0xffffffcc(%ebp)
d83: 8b 45 c8 mov 0xffffffc8(%ebp),%eax
d86: 2b 45 cc sub 0xffffffcc(%ebp),%eax
d89: 0b 45 c4 or 0xffffffc4(%ebp),%eax
d8c: 89 45 ec mov %eax,0xffffffec(%ebp)
(c + 10 - (islower(c) ? 'a' : 'A'));
c = *++cp;
d8f: 83 45 08 01 addl $0x1,0x8(%ebp)
d93: 8b 45 08 mov 0x8(%ebp),%eax
d96: 0f b6 00 movzbl (%eax),%eax
d99: 88 45 fb mov %al,0xfffffffb(%ebp)
} else
break;
}
d9c: e9 1a ff ff ff jmp cbb <inet_aton+0x7b>
if (c == '.') {
da1: 80 7d fb 2e cmpb $0x2e,0xfffffffb(%ebp)
da5: 75 35 jne ddc <inet_aton+0x19c>
/*
* Internet format:
* a.b.c.d
* a.b.c (with c treated as 16 bits)
* a.b (with b treated as 24 bits)
*/
if (pp >= parts + 3)
da7: 8d 45 dc lea 0xffffffdc(%ebp),%eax
daa: 83 c0 0c add $0xc,%eax
dad: 3b 45 fc cmp 0xfffffffc(%ebp),%eax
db0: 77 0c ja dbe <inet_aton+0x17e>
return (0);
db2: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
db9: e9 2b 01 00 00 jmp ee9 <inet_aton+0x2a9>
*pp++ = val;
dbe: 8b 55 fc mov 0xfffffffc(%ebp),%edx
dc1: 8b 45 ec mov 0xffffffec(%ebp),%eax
dc4: 89 02 mov %eax,(%edx)
dc6: 83 45 fc 04 addl $0x4,0xfffffffc(%ebp)
c = *++cp;
dca: 83 45 08 01 addl $0x1,0x8(%ebp)
dce: 8b 45 08 mov 0x8(%ebp),%eax
dd1: 0f b6 00 movzbl (%eax),%eax
dd4: 88 45 fb mov %al,0xfffffffb(%ebp)
} else
break;
}
dd7: e9 79 fe ff ff jmp c55 <inet_aton+0x15>
/*
* Check for trailing characters.
*/
if (c != '\0' && (!isascii(c) || !isspace(c)))
ddc: 80 7d fb 00 cmpb $0x0,0xfffffffb(%ebp)
de0: 74 3e je e20 <inet_aton+0x1e0>
de2: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
de6: 3c 1f cmp $0x1f,%al
de8: 76 2a jbe e14 <inet_aton+0x1d4>
dea: 80 7d fb 00 cmpb $0x0,0xfffffffb(%ebp)
dee: 78 24 js e14 <inet_aton+0x1d4>
df0: 80 7d fb 20 cmpb $0x20,0xfffffffb(%ebp)
df4: 74 2a je e20 <inet_aton+0x1e0>
df6: 80 7d fb 0c cmpb $0xc,0xfffffffb(%ebp)
dfa: 74 24 je e20 <inet_aton+0x1e0>
dfc: 80 7d fb 0a cmpb $0xa,0xfffffffb(%ebp)
e00: 74 1e je e20 <inet_aton+0x1e0>
e02: 80 7d fb 0d cmpb $0xd,0xfffffffb(%ebp)
e06: 74 18 je e20 <inet_aton+0x1e0>
e08: 80 7d fb 09 cmpb $0x9,0xfffffffb(%ebp)
e0c: 74 12 je e20 <inet_aton+0x1e0>
e0e: 80 7d fb 0b cmpb $0xb,0xfffffffb(%ebp)
e12: 74 0c je e20 <inet_aton+0x1e0>
return (0);
e14: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
e1b: e9 c9 00 00 00 jmp ee9 <inet_aton+0x2a9>
/*
* Concoct the address according to
* the number of parts specified.
*/
n = pp - parts + 1;
e20: 8b 55 fc mov 0xfffffffc(%ebp),%edx
e23: 8d 45 dc lea 0xffffffdc(%ebp),%eax
e26: 89 d1 mov %edx,%ecx
e28: 29 c1 sub %eax,%ecx
e2a: 89 c8 mov %ecx,%eax
e2c: c1 f8 02 sar $0x2,%eax
e2f: 83 c0 01 add $0x1,%eax
e32: 89 45 f4 mov %eax,0xfffffff4(%ebp)
switch (n) {
e35: 83 7d f4 04 cmpl $0x4,0xfffffff4(%ebp)
e39: 0f 87 8b 00 00 00 ja eca <inet_aton+0x28a>
e3f: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
e42: c1 e0 02 shl $0x2,%eax
e45: 8b 80 b0 10 00 00 mov 0x10b0(%eax),%eax
e4b: ff e0 jmp *%eax
case 0:
return (0); /* initial nondigit */
e4d: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
e54: e9 90 00 00 00 jmp ee9 <inet_aton+0x2a9>
case 1: /* a -- 32 bits */
break;
case 2: /* a.b -- 8.24 bits */
if (val > 0xffffff)
e59: 81 7d ec ff ff ff 00 cmpl $0xffffff,0xffffffec(%ebp)
e60: 76 09 jbe e6b <inet_aton+0x22b>
return (0);
e62: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
e69: eb 7e jmp ee9 <inet_aton+0x2a9>
val |= parts[0] << 24;
e6b: 8b 45 dc mov 0xffffffdc(%ebp),%eax
e6e: c1 e0 18 shl $0x18,%eax
e71: 09 45 ec or %eax,0xffffffec(%ebp)
break;
e74: eb 54 jmp eca <inet_aton+0x28a>
case 3: /* a.b.c -- 8.8.16 bits */
if (val > 0xffff)
e76: 81 7d ec ff ff 00 00 cmpl $0xffff,0xffffffec(%ebp)
e7d: 76 09 jbe e88 <inet_aton+0x248>
return (0);
e7f: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
e86: eb 61 jmp ee9 <inet_aton+0x2a9>
val |= (parts[0] << 24) | (parts[1] << 16);
e88: 8b 45 dc mov 0xffffffdc(%ebp),%eax
e8b: 89 c2 mov %eax,%edx
e8d: c1 e2 18 shl $0x18,%edx
e90: 8b 45 e0 mov 0xffffffe0(%ebp),%eax
e93: c1 e0 10 shl $0x10,%eax
e96: 09 d0 or %edx,%eax
e98: 09 45 ec or %eax,0xffffffec(%ebp)
break;
e9b: eb 2d jmp eca <inet_aton+0x28a>
case 4: /* a.b.c.d -- 8.8.8.8 bits */
if (val > 0xff)
e9d: 81 7d ec ff 00 00 00 cmpl $0xff,0xffffffec(%ebp)
ea4: 76 09 jbe eaf <inet_aton+0x26f>
return (0);
ea6: c7 45 c0 00 00 00 00 movl $0x0,0xffffffc0(%ebp)
ead: eb 3a jmp ee9 <inet_aton+0x2a9>
val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8);
eaf: 8b 45 dc mov 0xffffffdc(%ebp),%eax
eb2: 89 c2 mov %eax,%edx
eb4: c1 e2 18 shl $0x18,%edx
eb7: 8b 45 e0 mov 0xffffffe0(%ebp),%eax
eba: c1 e0 10 shl $0x10,%eax
ebd: 09 c2 or %eax,%edx
ebf: 8b 45 e4 mov 0xffffffe4(%ebp),%eax
ec2: c1 e0 08 shl $0x8,%eax
ec5: 09 d0 or %edx,%eax
ec7: 09 45 ec or %eax,0xffffffec(%ebp)
break;
}
if (addr)
eca: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
ece: 74 12 je ee2 <inet_aton+0x2a2>
addr->s_addr = htonl(val);
ed0: 8b 45 ec mov 0xffffffec(%ebp),%eax
ed3: 89 04 24 mov %eax,(%esp)
ed6: e8 65 01 00 00 call 1040 <htonl>
edb: 89 c2 mov %eax,%edx
edd: 8b 45 0c mov 0xc(%ebp),%eax
ee0: 89 10 mov %edx,(%eax)
return (1);
ee2: c7 45 c0 01 00 00 00 movl $0x1,0xffffffc0(%ebp)
ee9: 8b 45 c0 mov 0xffffffc0(%ebp),%eax
}
eec: c9 leave
eed: c3 ret
eee: 89 f6 mov %esi,%esi
00000ef0 <inet_ntoa>:
/* Convert numeric IP address into decimal dotted ASCII representation.
* returns ptr to static buffer; not reentrant!
*/
char *inet_ntoa(struct in_addr addr)
{
ef0: 55 push %ebp
ef1: 89 e5 mov %esp,%ebp
ef3: 53 push %ebx
ef4: 83 ec 24 sub $0x24,%esp
static char str[16];
u32_t s_addr = addr.s_addr;
ef7: 8b 45 08 mov 0x8(%ebp),%eax
efa: 89 45 ec mov %eax,0xffffffec(%ebp)
char inv[3];
char *rp;
char *ap;
u8_t rem;
u8_t n;
u8_t i;
rp = str;
efd: c7 45 f0 e4 10 00 00 movl $0x10e4,0xfffffff0(%ebp)
ap = (u8_t *)&s_addr;
f04: 8d 45 ec lea 0xffffffec(%ebp),%eax
f07: 89 45 f4 mov %eax,0xfffffff4(%ebp)
for(n = 0; n < 4; n++) {
f0a: c6 45 fa 00 movb $0x0,0xfffffffa(%ebp)
f0e: e9 af 00 00 00 jmp fc2 <inet_ntoa+0xd2>
i = 0;
f13: c6 45 fb 00 movb $0x0,0xfffffffb(%ebp)
do {
rem = *ap % (u8_t)10;
f17: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
f1a: 0f b6 08 movzbl (%eax),%ecx
f1d: b8 67 00 00 00 mov $0x67,%eax
f22: f6 e9 imul %cl
f24: 66 c1 e8 08 shr $0x8,%ax
f28: 89 c2 mov %eax,%edx
f2a: c0 fa 02 sar $0x2,%dl
f2d: 89 c8 mov %ecx,%eax
f2f: c0 f8 07 sar $0x7,%al
f32: 89 d3 mov %edx,%ebx
f34: 28 c3 sub %al,%bl
f36: 88 5d db mov %bl,0xffffffdb(%ebp)
f39: 0f b6 45 db movzbl 0xffffffdb(%ebp),%eax
f3d: c1 e0 02 shl $0x2,%eax
f40: 02 45 db add 0xffffffdb(%ebp),%al
f43: 01 c0 add %eax,%eax
f45: 89 ca mov %ecx,%edx
f47: 28 c2 sub %al,%dl
f49: 88 55 db mov %dl,0xffffffdb(%ebp)
f4c: 0f b6 5d db movzbl 0xffffffdb(%ebp),%ebx
f50: 88 5d f9 mov %bl,0xfffffff9(%ebp)
*ap /= (u8_t)10;
f53: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
f56: 0f b6 08 movzbl (%eax),%ecx
f59: b8 67 00 00 00 mov $0x67,%eax
f5e: f6 e9 imul %cl
f60: 66 c1 e8 08 shr $0x8,%ax
f64: 89 c2 mov %eax,%edx
f66: c0 fa 02 sar $0x2,%dl
f69: 89 c8 mov %ecx,%eax
f6b: c0 f8 07 sar $0x7,%al
f6e: 28 c2 sub %al,%dl
f70: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
f73: 88 10 mov %dl,(%eax)
inv[i++] = '0' + rem;
f75: 0f b6 55 fb movzbl 0xfffffffb(%ebp),%edx
f79: 0f b6 45 f9 movzbl 0xfffffff9(%ebp),%eax
f7d: 83 c0 30 add $0x30,%eax
f80: 88 44 15 e9 mov %al,0xffffffe9(%ebp,%edx,1)
f84: 80 45 fb 01 addb $0x1,0xfffffffb(%ebp)
} while(*ap);
f88: 8b 45 f4 mov 0xfffffff4(%ebp),%eax
f8b: 0f b6 00 movzbl (%eax),%eax
f8e: 84 c0 test %al,%al
f90: 75 85 jne f17 <inet_ntoa+0x27>
while(i--)
f92: eb 12 jmp fa6 <inet_ntoa+0xb6>
*rp++ = inv[i];
f94: 0f b6 45 fb movzbl 0xfffffffb(%ebp),%eax
f98: 0f b6 54 05 e9 movzbl 0xffffffe9(%ebp,%eax,1),%edx
f9d: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
fa0: 88 10 mov %dl,(%eax)
fa2: 83 45 f0 01 addl $0x1,0xfffffff0(%ebp)
fa6: 80 6d fb 01 subb $0x1,0xfffffffb(%ebp)
faa: 80 7d fb ff cmpb $0xff,0xfffffffb(%ebp)
fae: 75 e4 jne f94 <inet_ntoa+0xa4>
*rp++ = '.';
fb0: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
fb3: c6 00 2e movb $0x2e,(%eax)
fb6: 83 45 f0 01 addl $0x1,0xfffffff0(%ebp)
ap++;
fba: 83 45 f4 01 addl $0x1,0xfffffff4(%ebp)
fbe: 80 45 fa 01 addb $0x1,0xfffffffa(%ebp)
fc2: 80 7d fa 03 cmpb $0x3,0xfffffffa(%ebp)
fc6: 0f 86 47 ff ff ff jbe f13 <inet_ntoa+0x23>
}
*--rp = 0;
fcc: 83 6d f0 01 subl $0x1,0xfffffff0(%ebp)
fd0: 8b 45 f0 mov 0xfffffff0(%ebp),%eax
fd3: c6 00 00 movb $0x0,(%eax)
return str;
fd6: b8 e4 10 00 00 mov $0x10e4,%eax
}
fdb: 83 c4 24 add $0x24,%esp
fde: 5b pop %ebx
fdf: 5d pop %ebp
fe0: c3 ret
fe1: eb 0d jmp ff0 <htons>
fe3: 90 nop
fe4: 90 nop
fe5: 90 nop
fe6: 90 nop
fe7: 90 nop
fe8: 90 nop
fe9: 90 nop
fea: 90 nop
feb: 90 nop
fec: 90 nop
fed: 90 nop
fee: 90 nop
fef: 90 nop
00000ff0 <htons>:
#ifndef BYTE_ORDER
#error BYTE_ORDER is not defined
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
u16_t
htons(u16_t n)
{
ff0: 55 push %ebp
ff1: 89 e5 mov %esp,%ebp
ff3: 83 ec 04 sub $0x4,%esp
ff6: 8b 45 08 mov 0x8(%ebp),%eax
ff9: 66 89 45 fc mov %ax,0xfffffffc(%ebp)
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
ffd: 0f b7 45 fc movzwl 0xfffffffc(%ebp),%eax
1001: 25 ff 00 00 00 and $0xff,%eax
1006: c1 e0 08 shl $0x8,%eax
1009: 89 c2 mov %eax,%edx
100b: 0f b7 45 fc movzwl 0xfffffffc(%ebp),%eax
100f: 25 00 ff 00 00 and $0xff00,%eax
1014: c1 f8 08 sar $0x8,%eax
1017: 09 d0 or %edx,%eax
1019: 0f b7 c0 movzwl %ax,%eax
}
101c: c9 leave
101d: c3 ret
101e: 89 f6 mov %esi,%esi
00001020 <ntohs>:
u16_t
ntohs(u16_t n)
{
1020: 55 push %ebp
1021: 89 e5 mov %esp,%ebp
1023: 83 ec 08 sub $0x8,%esp
1026: 8b 45 08 mov 0x8(%ebp),%eax
1029: 66 89 45 fc mov %ax,0xfffffffc(%ebp)
return htons(n);
102d: 0f b7 45 fc movzwl 0xfffffffc(%ebp),%eax
1031: 89 04 24 mov %eax,(%esp)
1034: e8 b7 ff ff ff call ff0 <htons>
1039: 0f b7 c0 movzwl %ax,%eax
}
103c: c9 leave
103d: c3 ret
103e: 89 f6 mov %esi,%esi
00001040 <htonl>:
u32_t
htonl(u32_t n)
{
1040: 55 push %ebp
1041: 89 e5 mov %esp,%ebp
return ((n & 0xff) << 24) |
1043: 0f b6 45 08 movzbl 0x8(%ebp),%eax
1047: 89 c2 mov %eax,%edx
1049: c1 e2 18 shl $0x18,%edx
104c: 8b 45 08 mov 0x8(%ebp),%eax
104f: 25 00 ff 00 00 and $0xff00,%eax
1054: c1 e0 08 shl $0x8,%eax
1057: 09 c2 or %eax,%edx
1059: 8b 45 08 mov 0x8(%ebp),%eax
105c: 25 00 00 ff 00 and $0xff0000,%eax
1061: c1 e8 08 shr $0x8,%eax
1064: 09 c2 or %eax,%edx
1066: 8b 45 08 mov 0x8(%ebp),%eax
1069: 25 00 00 00 ff and $0xff000000,%eax
106e: c1 e8 18 shr $0x18,%eax
1071: 09 d0 or %edx,%eax
((n & 0xff00) << 8) |
((n & 0xff0000) >> 8) |
((n & 0xff000000) >> 24);
}
1073: 5d pop %ebp
1074: c3 ret
1075: 8d 74 26 00 lea 0x0(%esi),%esi
1079: 8d bc 27 00 00 00 00 lea 0x0(%edi),%edi
00001080 <ntohl>:
u32_t
ntohl(u32_t n)
{
1080: 55 push %ebp
1081: 89 e5 mov %esp,%ebp
1083: 83 ec 04 sub $0x4,%esp
return htonl(n);
1086: 8b 45 08 mov 0x8(%ebp),%eax
1089: 89 04 24 mov %eax,(%esp)
108c: e8 af ff ff ff call 1040 <htonl>
}
1091: c9 leave
1092: c3 ret
|
src/main/antlr4/org/darioaxel/ANTLRPowerScript/pbt/PowerScriptPBT.g4 | darioaxel/Antlr4-PowerScript | 6 | 2804 | <gh_stars>1-10
/*
* Original Author: <NAME>
* E-Mail: <EMAIL>
*/
grammar PowerScriptPBT;
prog: header libraries objects EOF;
header: 'Save Format v3.0(' NUMBER ')' #headers;
libraries: HEADER_BEGIN pathsFromTo+ ENDS SEMICOL #Intolibrarires ;
objects: OBJECTS_BEGIN pathsFromTo+ ENDS SEMICOL #Intoobjects;
pathsFromTo: path path SEMICOL;
path: '"' (( ID '\\\\')* file )* '"';
file: ID '.' ID;
HEADER_BEGIN : '@begin Libraries';
OBJECTS_BEGIN : '@begin Objects';
ENDS : '@end' ;
NUMBER : [0-9]+;
ID : [a-zA-Z0-9_]+ ;
SEMICOL : ';' ;
WS: [ \t\n\r]+ -> skip;
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_454.asm | ljhsiun2/medusa | 9 | 85152 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x14938, %rsi
lea addresses_WT_ht+0xcb5c, %rdi
nop
sub $15203, %rbp
mov $51, %rcx
rep movsw
nop
nop
nop
nop
nop
xor %rdi, %rdi
lea addresses_WT_ht+0x12ede, %r8
nop
nop
nop
nop
add %r9, %r9
mov (%r8), %si
nop
nop
and $34601, %r9
lea addresses_WT_ht+0x717e, %r9
nop
nop
nop
sub %r13, %r13
movl $0x61626364, (%r9)
nop
nop
nop
dec %rbp
lea addresses_WC_ht+0xe38, %r8
inc %r9
mov (%r8), %ecx
nop
nop
inc %r8
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// Store
lea addresses_D+0x197c8, %rsi
nop
nop
nop
sub %r9, %r9
movb $0x51, (%rsi)
add $16172, %r9
// REPMOV
lea addresses_D+0x1a6b8, %rsi
lea addresses_A+0x19d4a, %rdi
xor $61233, %r9
mov $4, %rcx
rep movsb
nop
nop
nop
nop
inc %r10
// REPMOV
lea addresses_D+0x1cb30, %rsi
lea addresses_RW+0xf1c6, %rdi
nop
nop
nop
nop
xor $27676, %rbp
mov $37, %rcx
rep movsw
nop
add %rsi, %rsi
// Store
lea addresses_A+0x3a98, %rax
cmp %rsi, %rsi
movl $0x51525354, (%rax)
nop
nop
nop
nop
cmp %r11, %r11
// Store
lea addresses_normal+0x8938, %r11
nop
xor %rsi, %rsi
mov $0x5152535455565758, %r9
movq %r9, %xmm0
movups %xmm0, (%r11)
nop
and %rdi, %rdi
// Faulty Load
lea addresses_normal+0x13138, %rcx
and %rax, %rax
movups (%rcx), %xmm7
vpextrq $1, %xmm7, %rdi
lea oracles, %r11
and $0xff, %rdi
shlq $12, %rdi
mov (%r11,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': True, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 4, 'same': False, 'type': 'addresses_D'}, 'OP': 'STOR'}
{'src': {'congruent': 7, 'same': False, 'type': 'addresses_D'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_A'}, 'OP': 'REPM'}
{'src': {'congruent': 3, 'same': False, 'type': 'addresses_D'}, 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_RW'}, 'OP': 'REPM'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_A'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_normal'}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_normal'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 2, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'STOR'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 7, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'}
{'34': 21829}
34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34
*/
|
oeis/153/A153814.asm | neoneye/loda-programs | 11 | 244219 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A153814: a(n) = 1001*n.
; 1001,2002,3003,4004,5005,6006,7007,8008,9009,10010,11011,12012,13013,14014,15015,16016,17017,18018,19019,20020,21021,22022,23023,24024,25025,26026,27027,28028,29029,30030,31031,32032,33033,34034,35035,36036,37037,38038,39039,40040,41041,42042,43043,44044,45045,46046,47047,48048,49049,50050,51051,52052,53053,54054,55055,56056,57057,58058,59059,60060,61061,62062,63063,64064,65065,66066,67067,68068,69069,70070,71071,72072,73073,74074,75075,76076,77077,78078,79079,80080,81081,82082,83083,84084
mul $0,1001
add $0,1001
|
agda-stdlib-0.9/src/Data/Star/Environment.agda | qwe2/try-agda | 1 | 13560 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Environments (heterogeneous collections)
------------------------------------------------------------------------
module Data.Star.Environment (Ty : Set) where
open import Data.Star
open import Data.Star.List
open import Data.Star.Decoration
open import Data.Star.Pointer as Pointer hiding (lookup)
open import Data.Unit
open import Relation.Binary.PropositionalEquality
-- Contexts, listing the types of all the elements in an environment.
Ctxt : Set
Ctxt = List Ty
-- Variables (de Bruijn indices); pointers into environments.
infix 4 _∋_
_∋_ : Ctxt → Ty → Set
Γ ∋ σ = Any (λ _ → ⊤) (_≡_ σ) Γ
vz : ∀ {Γ σ} → Γ ▻ σ ∋ σ
vz = this refl
vs : ∀ {Γ σ τ} → Γ ∋ τ → Γ ▻ σ ∋ τ
vs = that tt
-- Environments. The T function maps types to element types.
Env : (Ty → Set) → Ctxt → Set
Env T Γ = All T Γ
-- A safe lookup function for environments.
lookup : ∀ {Γ σ} {T : Ty → Set} → Γ ∋ σ → Env T Γ → T σ
lookup i ρ with Pointer.lookup i ρ
... | result refl x = x
|
test/Succeed/Issue462.agda | shlevy/agda | 1,989 | 11285 | <filename>test/Succeed/Issue462.agda
module Issue462 where
data _≡_ {A : Set} : A → A → Set where
≡-refl : (x : A) → x ≡ x
postulate A : Set
record R (_≈_ _∼_ : A → A → Set) : Set where
field
≈-refl : (x : A) → x ≈ x
∼-reflexive : (x y : A) → x ≈ y → x ∼ y
∼-refl : (x : A) → x ∼ x
∼-refl x = ∼-reflexive x x (≈-refl x)
postulate
_≈_ : A → A → Set
≈-refl : ((x : A) → x ≡ x) → (x : A) → x ≈ x
≈-irr : (x : A) (p : x ≈ x) → p ≡ p
≡-r : R _≡_ _≡_
≡-r = record
{ ≈-refl = ≡-refl
; ∼-reflexive = λ _ _ p → p
}
≈-reflexive : (x y : A) → x ≡ y → x ≈ y
≈-reflexive .x .x (≡-refl x) = ≈-refl (R.∼-refl ≡-r) x
≈-r : R _≡_ _≈_
≈-r = record
{ ≈-refl = ≡-refl
; ∼-reflexive = ≈-reflexive
}
foo : A → Set₁
foo x with ≈-irr x (R.∼-refl ≈-r x)
foo x | _ = Set
-- The generated with function should not contain unsolved
-- meta-variables.
|
Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-wtfiio.adb | djamal2727/Main-Bearing-Analytical-Model | 0 | 22090 | <filename>Validation/pyFrame3DD-master/gcc-master/gcc/ada/libgnat/a-wtfiio.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUN-TIME COMPONENTS --
-- --
-- A D A . T E X T _ I O . W I D E _ T E X T _ I O . F I X E D _ I O --
-- --
-- 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. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Wide_Text_IO.Float_Aux;
with System.WCh_Con; use System.WCh_Con;
with System.WCh_WtS; use System.WCh_WtS;
package body Ada.Wide_Text_IO.Fixed_IO is
subtype TFT is Ada.Wide_Text_IO.File_Type;
-- File type required for calls to routines in Aux
package Aux renames Ada.Wide_Text_IO.Float_Aux;
---------
-- Get --
---------
procedure Get
(File : File_Type;
Item : out Num;
Width : Field := 0)
is
begin
Aux.Get (TFT (File), Long_Long_Float (Item), Width);
exception
when Constraint_Error => raise Data_Error;
end Get;
procedure Get
(Item : out Num;
Width : Field := 0)
is
begin
Get (Current_Input, Item, Width);
end Get;
procedure Get
(From : Wide_String;
Item : out Num;
Last : out Positive)
is
S : constant String := Wide_String_To_String (From, WCEM_Upper);
-- String on which we do the actual conversion. Note that the method
-- used for wide character encoding is irrelevant, since if there is
-- a character outside the Standard.Character range then the call to
-- Aux.Gets will raise Data_Error in any case.
begin
Aux.Gets (S, Long_Long_Float (Item), Last);
exception
when Constraint_Error => raise Data_Error;
end Get;
---------
-- Put --
---------
procedure Put
(File : File_Type;
Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
begin
Aux.Put (TFT (File), Long_Long_Float (Item), Fore, Aft, Exp);
end Put;
procedure Put
(Item : Num;
Fore : Field := Default_Fore;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
begin
Put (Current_Output, Item, Fore, Aft, Exp);
end Put;
procedure Put
(To : out Wide_String;
Item : Num;
Aft : Field := Default_Aft;
Exp : Field := Default_Exp)
is
S : String (To'First .. To'Last);
begin
Aux.Puts (S, Long_Long_Float (Item), Aft, Exp);
for J in S'Range loop
To (J) := Wide_Character'Val (Character'Pos (S (J)));
end loop;
end Put;
end Ada.Wide_Text_IO.Fixed_IO;
|
LM/Aula4/Atividades/ex4.asm | Kw-Vinicius/Linguagem-de-Montagem- | 0 | 24772 | <reponame>Kw-Vinicius/Linguagem-de-Montagem-
; Escreva um programa em Assembly que calcule o valor X = 5! - (5+4+3+2+1)
SECTION .data
var: db 5
cont : db 0
SECTION .text
global _start
_start:
mov eax,[var]
add [cont],eax ;cont = 0+5 = 5
mov ebx,eax ;ebx = 5
dec eax ;eax = 4
add [cont],eax ;cont = 5+ 4 = 9
mov ecx,eax
mul ebx
;eax = 20
;ecx = 4
dec ecx ;ecx = 3
add [cont],ecx ;cont = 9+3 = 12
mov ebx,ecx ;ebx = 3
mul ebx ;ebx * eax = 20 * 3 = 60
dec ecx ;ecx = 2
add [cont],ecx ;cont = 12+2 = 14
mov ebx,ecx ;ebx = 2
mul ebx ;ebx * eax = 2 * 60 = 120
dec ecx ;ecx = 1
add [cont],ecx ;cont = 14+1 = 15
mov ebx,ecx ;ebx = 1
mul ebx ;ebx * eax = 1*120 = 120
sub eax,[cont]
mov ebx,eax ;Retorna para o SO (5!-cont) <=> (120-15) = 105
mov eax,1
int 80h
; O fatorial de 5 é 120, subtraindo cont = (5+4+3+2+1) = 15
; O valor retornado para o SO é 5! - cont = 120 - 15 = 105
|
src/ado-datasets.adb | Letractively/ada-ado | 0 | 22022 | <gh_stars>0
-----------------------------------------------------------------------
-- ado-datasets -- Datasets
-- Copyright (C) 2013, 2014 <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.Beans.Objects.Time;
with ADO.Schemas;
with ADO.Statements;
package body ADO.Datasets is
-- ------------------------------
-- Execute the SQL query on the database session and populate the dataset.
-- The column names are used to setup the dataset row bean definition.
-- ------------------------------
procedure List (Into : in out Dataset;
Session : in out ADO.Sessions.Session'Class;
Query : in ADO.Queries.Context'Class) is
procedure Fill (Data : in out Util.Beans.Objects.Datasets.Object_Array);
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
procedure Fill (Data : in out Util.Beans.Objects.Datasets.Object_Array) is
use ADO.Schemas;
begin
for I in Data'Range loop
case Stmt.Get_Column_Type (I - 1) is
-- Boolean column
when T_BOOLEAN =>
Data (I) := Util.Beans.Objects.To_Object (Stmt.Get_Boolean (I - 1));
when T_TINYINT | T_SMALLINT | T_INTEGER | T_LONG_INTEGER | T_YEAR =>
Data (I) := Util.Beans.Objects.To_Object (Stmt.Get_Integer (I - 1));
when T_FLOAT | T_DOUBLE | T_DECIMAL =>
Data (I) := Util.Beans.Objects.Null_Object;
when T_ENUM =>
Data (I) := Util.Beans.Objects.To_Object (Stmt.Get_String (I - 1));
when T_TIME | T_DATE | T_DATE_TIME | T_TIMESTAMP =>
Data (I) := Util.Beans.Objects.Time.To_Object (Stmt.Get_Time (I - 1));
when T_CHAR | T_VARCHAR =>
Data (I) := Util.Beans.Objects.To_Object (Stmt.Get_String (I - 1));
when T_BLOB =>
Data (I) := Util.Beans.Objects.Null_Object;
when T_SET | T_UNKNOWN | T_NULL =>
Data (I) := Util.Beans.Objects.Null_Object;
end case;
end loop;
end Fill;
begin
Stmt.Execute;
Into.Clear;
if Stmt.Has_Elements then
for I in 1 .. Stmt.Get_Column_Count loop
Into.Add_Column (Stmt.Get_Column_Name (I - 1));
end loop;
while Stmt.Has_Elements loop
Into.Append (Fill'Access);
Stmt.Next;
end loop;
end if;
end List;
-- ------------------------------
-- Get the number of items in a list by executing an SQL query.
-- ------------------------------
function Get_Count (Session : in ADO.Sessions.Session'Class;
Query : in ADO.Queries.Context'Class) return Natural is
Stmt : ADO.Statements.Query_Statement := Session.Create_Statement (Query);
begin
Stmt.Execute;
return Stmt.Get_Result_Integer;
end Get_Count;
end ADO.Datasets;
|
commands/browsing/safari-current-window-urls.applescript | jdmcd/script-commands | 0 | 4619 | <reponame>jdmcd/script-commands
#!/usr/bin/osascript
# Required parameters:
# @raycast.schemaVersion 1
# @raycast.title Copy Current Window URLs
# @raycast.mode silent
#
# Optional parameters:
# @raycast.icon 🧭
# @raycast.packageName Safari
#
# Documentation:
# @raycast.description This script copies to clipboard all URLs from frontmost Safari window.
# @raycast.author <NAME>
# @raycast.authorURL https://github.com/japanese-goblinn
tell application "Safari"
tell front window
if its document exists then
set AppleScript's text item delimiters to linefeed
set urlList to URL of its tabs
set the clipboard to (urlList as text)
log "Copied"
end if
end tell
end tell
|
src/keystore-logs.ads | My-Colaborations/ada-keystore | 25 | 6811 | -----------------------------------------------------------------------
-- keystore-logs -- Log support for the keystore
-- Copyright (C) 2019, 2020 <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.Log.Loggers;
with Keystore.IO;
private package Keystore.Logs is
procedure Dump (Log : in Util.Log.Loggers.Logger;
Content : in Ada.Streams.Stream_Element_Array);
procedure Error (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Warn (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Info (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Debug (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block : in IO.Storage_Block);
procedure Debug (Log : in Util.Log.Loggers.Logger;
Message : in String;
Block1 : in IO.Storage_Block;
Block2 : in IO.Storage_Block);
end Keystore.Logs;
|
src/hex_2digits_display.ads | hgrodriguez/embedded-dashboard-console | 0 | 4498 | <reponame>hgrodriguez/embedded-dashboard-console<gh_stars>0
--===========================================================================
--
-- Represents an 5x7 Matrix Pimoroni display.
-- This package can only display a hex number on such a 5x7 matrix.
--
--===========================================================================
--
-- Copyright 2021 (C) <NAME>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
with HAL.I2C;
generic
------------------------------------------------------
-- Define the port, where the display is connected to
------------------------------------------------------
I2C : HAL.I2C.Any_I2C_Port;
----------------------------------------------------
-- Define the address of the display on the I2C bus
----------------------------------------------------
Address : HAL.I2C.I2C_Address;
package Hex_2Digits_Display is
-----------------------------------------------------------------------
-- Shows the
-- Number
-- on the display having the
-- Address
-- on the
-- I2C
-- bus
-- as defined above
procedure Show (Number : HAL.UInt8);
end Hex_2Digits_Display;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_21829_50.asm | ljhsiun2/medusa | 9 | 28836 | <filename>Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca_notsx.log_21829_50.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r15
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x13526, %rsi
lea addresses_WC_ht+0x10629, %rdi
nop
nop
nop
nop
add %r12, %r12
mov $53, %rcx
rep movsq
xor %rdi, %rdi
lea addresses_WC_ht+0x10d26, %rsi
lea addresses_WT_ht+0xee26, %rdi
cmp %r13, %r13
mov $12, %rcx
rep movsl
nop
nop
nop
add %r13, %r13
lea addresses_WT_ht+0x1ee26, %r15
nop
nop
inc %r10
mov (%r15), %cx
nop
nop
sub $18430, %rcx
lea addresses_D_ht+0x15ea6, %rsi
lea addresses_normal_ht+0xd096, %rdi
nop
nop
nop
nop
xor %r15, %r15
mov $108, %rcx
rep movsl
nop
nop
dec %r10
lea addresses_WC_ht+0x21c6, %rsi
lea addresses_WT_ht+0xaca6, %rdi
clflush (%rdi)
nop
nop
nop
and %rax, %rax
mov $46, %rcx
rep movsw
nop
and %r12, %r12
lea addresses_WC_ht+0x31a6, %rax
nop
inc %r10
movw $0x6162, (%rax)
nop
and $19559, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r15
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r14
push %r15
push %r8
push %rbx
// Load
lea addresses_RW+0x14826, %r14
nop
nop
nop
nop
cmp $14202, %r15
mov (%r14), %r8w
nop
nop
cmp $64688, %r12
// Faulty Load
mov $0x6b5f860000000d26, %r14
cmp $24773, %r13
movaps (%r14), %xmm4
vpextrq $0, %xmm4, %r8
lea oracles, %r12
and $0xff, %r8
shlq $12, %r8
mov (%r12,%r8,1), %r8
pop %rbx
pop %r8
pop %r15
pop %r14
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_NC', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_NC', 'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 11, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 8, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 8}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_WC_ht'}, 'dst': {'same': True, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
source/slim-players-connected_state_visiters.adb | reznikmm/slimp | 0 | 26546 | <filename>source/slim-players-connected_state_visiters.adb
-- Copyright (c) 2019 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: MIT
-- License-Filename: LICENSE
-------------------------------------------------------------
with Slim.Messages.vers;
with Slim.Messages.strm;
with Slim.Messages.grfb;
with Slim.Messages.grfe;
with Slim.Messages.visu;
with Slim.Messages.bled;
with Slim.Messages.rtcs;
with Slim.Messages.bdac;
with Slim.Messages.aude;
with Slim.Messages.audg;
with Slim.Messages.Server_setd;
package body Slim.Players.Connected_State_Visiters is
----------
-- HELO --
----------
overriding procedure HELO
(Self : in out Visiter;
Message : not null access Slim.Messages.HELO.HELO_Message)
is
pragma Unreferenced (Message);
Player : Players.Player renames Self.Player.all;
Vers : Slim.Messages.vers.Vers_Message;
begin
Vers.Set_Version (League.Strings.To_Universal_String ("7.7.3"));
Write_Message (Player.Socket, Vers);
end HELO;
----------
-- STAT --
----------
overriding procedure STAT
(Self : in out Visiter;
Message : not null access Slim.Messages.STAT.STAT_Message)
is
pragma Unreferenced (Message);
use type Ada.Calendar.Time;
Player : Players.Player renames Self.Player.all;
Time : constant Natural := Natural
(Ada.Calendar.Seconds (Ada.Calendar.Clock));
Strm : Slim.Messages.strm.Strm_Message;
Grfb : Slim.Messages.grfb.Grfb_Message;
Grfe : Slim.Messages.grfe.Grfe_Message;
Visu : Slim.Messages.visu.Visu_Message;
Bled : Slim.Messages.bled.Bled_Message;
RTC1 : Slim.Messages.rtcs.Rtcs_Message;
RTC2 : Slim.Messages.rtcs.Rtcs_Message;
Bdac : Slim.Messages.bdac.Bdac_Message;
Aude : Slim.Messages.aude.Aude_Message;
Audg : Slim.Messages.audg.Audg_Message;
Setd : Slim.Messages.Server_setd.Setd_Message;
begin
Strm.Simple_Command
(Command => Slim.Messages.strm.Stop);
Write_Message (Player.Socket, Strm);
-- Set dynamic brightness - minimum in range 1 .. 7
-- 21 - coefficient in range (1 .. 20)
Grfb.Set_Brightness (16#0b04#);
Write_Message (Player.Socket, Grfb);
-- Send splash screen
Grfe.Initialize (Player.Splash.To_Stream_Element_Array);
Write_Message (Player.Socket, Grfe);
-- deactivate visualizer
Visu.Deactivate;
Write_Message (Player.Socket, Visu);
-- Enable backlight leds
Bled.Enable_LED;
Write_Message (Player.Socket, Bled);
-- Set 24hours clock mode
RTC1.Set_Format;
Write_Message (Player.Socket, RTC1);
-- Set clock
RTC2.Set_Time
(Hours => Time / 60 / 60,
Minutes => (Time / 60) mod 60,
Seconds => Time mod 60);
Write_Message (Player.Socket, RTC2);
-- Send a DAC settings to the client.
Bdac.Initialize
(6,
(16#09#, 16#00#, 16#00#, 16#02#, 16#92#, 16#00#,
16#00#, 16#03#, 16#d4#, 16#00#, 16#00#, 16#06#,
16#c1#, 16#00#, 16#00#, 16#0b#, 16#00#, 16#00#,
16#00#, 16#14#, 16#00#, 16#00#, 16#00#, 16#23#,
16#00#, 16#8f#, 16#ff#, 16#ff#, 16#ff#, 16#8f#,
16#ff#, 16#ff#, 16#ff#, 16#8f#, 16#ff#, 16#ff#,
16#ff#));
Write_Message (Player.Socket, Bdac);
-- Send a DAC settings to the client. Part 2
Bdac.Initialize
(7,
(16#09#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#8f#,
16#ff#, 16#ff#, 16#ff#, 16#8f#, 16#ff#, 16#ff#,
16#ff#));
Write_Message (Player.Socket, Bdac);
-- Send a DAC settings to the client. Part 3
Bdac.Initialize
(4, (16#05#, 16#37#, 16#00#, 16#00#, 16#17#, 16#2e#));
Write_Message (Player.Socket, Bdac);
-- Send a DAC settings to the client. Part 4
Bdac.Initialize
(4,
(16#11#, 16#29#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#,
16#00#, 16#00#, 16#00#, 16#00#, 16#00#, 16#00#));
Write_Message (Player.Socket, Bdac);
-- Send a DAC settings to the client. Part 5
Bdac.Initialize
(8, (16#00#, 16#00#, 16#26#, 16#00#));
Write_Message (Player.Socket, Bdac);
-- Enable the audio output.
Aude.Enable_Output;
Write_Message (Player.Socket, Aude);
-- Adjust the volume level
Audg.Set_Volume (50);
Write_Message (Player.Socket, Audg);
-- Ask player name
Setd.Request_Player_Name;
Write_Message (Player.Socket, Setd);
Player.State :=
(Idle,
Ada.Calendar.Clock - 60.0,
Menu_View => Player.First_Menu);
end STAT;
end Slim.Players.Connected_State_Visiters;
|
chapter_04/q67_3.asm | GeertArien/low-level-programming | 0 | 172892 | ; These macrodefinitions are copied from linux sources
; Linux is written in C, so the definitions looked a bit
; different there.
; We could have just looked up their values and use
; them directly inright places
; However it would have made the code much less legible
%define O_RDONLY 0
%define PROT_READ 0x1
%define MAP_PRIVATE 0x2
section .data
; This is the file name. You are free to change it.
fname: db 'int.txt', 0
section .text
global _start
; These functions are used to print a null terminated string
print_string:
push rdi
call string_length
pop rsi
mov rdx, rax
mov rax, 1
mov rdi, 1
syscall
ret
string_length:
xor rax, rax
.loop:
cmp byte [rdi+rax], 0
je .end
inc rax
jmp .loop
.end:
ret
; These functions are used to print an unsigned int
print_uint:
mov rax, rdi
mov rdi, rsp
push 0
dec rdi
sub rsp, 16
mov r8, 10
.loop:
xor rdx, rdx
div r8
or dl, 0x30
dec rdi
mov [rdi], dl
test rax, rax
jnz .loop
call print_string
add rsp, 24
.end:
ret
; rdi points to a string
; returns sum of all number's digits
add_digits:
call string_length
mov rdx, rax ; rdx contains string length
xor rax, rax ; final value
test rdx, rdx ; if string is empty jump to end
jz .end
xor rcx, rcx ; char position
xor r9, r9
mov r9b, [rdi]
cmp r9b, '-' ; if first char is minus
jne .next_char
inc rcx ; got to next char
.next_char:
cmp rcx, rdx
jae .end
mov r9b, [rdi + rcx] ; r9b now contains char
sub r9b, '0' ; convert char number to unsigned int
cmp r9b, 10 ; if char is not a number
ja .invalid_input
add rax, r9 ; add unsigned int to final value (rsi)
inc rcx
jmp .next_char
.invalid_input:
mov rax, 0
.end:
ret
_start:
; call open
mov rax, 2
mov rdi, fname
mov rsi, O_RDONLY ; Open file read only
mov rdx, 0 ; We are not creating a file
; so this argument has no meaning
syscall
; mmap
mov r8, rax ; rax holds opened file descriptor
; it is the fourth argument of mmap
mov rax, 9 ; mmap number
mov rdi, 0 ; operating system will choose mapping destination
mov rsi, 4096 ; page size
mov rdx, PROT_READ ; new memory region will be marked read only
mov r10, MAP_PRIVATE; pages will not be shared
mov r9, 0 ; offset inside test.txt
syscall ; now rax will point to mapped location
mov rdi, rax
call add_digits
mov rdi, rax
call print_uint
mov rax, 60 ; use exit system call to shut down correctly
xor rdi, rdi
syscall |
programs/oeis/185/A185453.asm | neoneye/loda | 22 | 24039 | <filename>programs/oeis/185/A185453.asm
; A185453: Trajectory of 1 under repeated application of the map in A185452.
; 1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2,1,3,8,4,2
add $0,1
mod $0,5
mov $3,1
add $$0,$0
mul $3,3
add $$1,$3
div $0,2
add $0,1
|
oeis/349/A349074.asm | neoneye/loda-programs | 11 | 161230 | ; A349074: a(n) = U(3*n, n), where U(n, x) is the Chebyshev polynomial of the second kind.
; Submitted by <NAME>
; 1,4,2911,7997214,57641556673,867583274883920,23630375698358890319,1056918444955456528983706,72383076947075470731692782081,7200266529428094485775774835670652,998383804974887102441600687728515247999,186701261436825568741051032736345268517903734,45829762782982068131037563968444805427190991572801,14437572357755682013263358305142731623683596698529842824,5726412386558175224593991590905555174151362206509944853875823,2813127081865394482865469670755328521180838294295985395680004352690
mov $3,$0
mul $0,3
lpb $0
sub $0,1
add $1,1
mov $2,$3
sub $2,1
mul $2,2
mul $2,$1
add $4,$2
add $1,$4
lpe
mov $0,$1
add $0,1
|
derivability.agda | guillaumebrunerie/general-type-theories | 0 | 12037 | <reponame>guillaumebrunerie/general-type-theories
{-# OPTIONS --rewriting --prop #-}
open import common
open import syntx
{- The sort corresponding to judgments -}
data JudgmentSort : Set where
Ty : JudgmentSort
Tm : JudgmentSort
Ty= : JudgmentSort
Tm= : JudgmentSort
JudgmentArityArgs = ArityArgs JudgmentSort
JudgmentArity = Arity JudgmentSort
{-
Judgments are indexed by the signature, their ambient context, the length of their local context,
and their sort.
We can see judgments as consisting of two contexts, one normal context (the ambient context) and
then one dependent context (the local context). The reason is that all typing rules occur in an
ambient context which never changes, and sometimes add new assumptions (to the local context).
Therefore we will never have to check that the ambient contexts are equal, it will be forced by the
typing.
Indexing judgments by sorts is very good to get rid of absurd cases, when giving typing rules and
that some judgments are supposed to have certain sorts.
-}
data Judgment (Σ : Signature) {m : ℕ} (Γ : Ctx Σ m) (n : ℕ) : JudgmentSort → Set where
_⊢_ : (Δ : DepCtx Σ m n) → TyExpr Σ (m + n) → Judgment Σ Γ n Ty
_⊢_:>_ : (Δ : DepCtx Σ m n) → TmExpr Σ (m + n) → TyExpr Σ (m + n) → Judgment Σ Γ n Tm
_⊢_==_ : (Δ : DepCtx Σ m n) → TyExpr Σ (m + n) → TyExpr Σ (m + n) → Judgment Σ Γ n Ty=
_⊢_==_:>_ : (Δ : DepCtx Σ m n) → TmExpr Σ (m + n) → TmExpr Σ (m + n) → TyExpr Σ (m + n)
→ Judgment Σ Γ n Tm=
{-
A derivation rule consists of a partial function taking a tuple of judgments (of the correct
arities) and returning another judgment. Moreover, a derivation rule is extendable to any other
signature the original signature maps to.
The type [DerivationRulePremises Σ Γ args] represents tuples of judgments of arities [args] (and in
signature [Σ] and with ambient context [Γ])
The type [DerivationRule Σ ar n] represents derivation rules in signature [Σ], of arity [ar] and in
scope [n]. It lives in [Set₁] because it quantifies over arbitrary signatures that [Σ] maps into.
-}
data DerivationRulePremises (Σ : Signature) {n : ℕ} (Γ : Ctx Σ n) : JudgmentArityArgs → Set where
[] : DerivationRulePremises Σ Γ []
_,_ : {m : ℕ} {k : JudgmentSort} {args : JudgmentArityArgs}
→ DerivationRulePremises Σ Γ args
→ Judgment Σ Γ m k
→ DerivationRulePremises Σ Γ (args , (m , k))
record DerivationRule (Σ : Signature) (ar : JudgmentArity) : Set₁ where
field
rule : {Σ' : Signature} {n : ℕ} → (Σ →Sig Σ') n → (Γ : Ctx Σ' n)
→ DerivationRulePremises Σ' Γ (args ar) → Partial (Judgment Σ' Γ 0 (sort ar))
open DerivationRule public
{- A derivability structure consists of a bunch of derivation rules, indexed by their arities -}
data Tag : Set where
S T C Eq : Tag
record DerivabilityStructure (Σ : Signature) : Set₁ where
field
Rules : Tag → JudgmentArity → Set
derivationRule : {t : Tag} {ar : JudgmentArity} (r : Rules t ar) → DerivationRule Σ ar
open DerivabilityStructure public
{- We can move the local context to the end of the ambient context -}
module _ {Σ : Signature} {m : ℕ} {Γ : Ctx Σ m} where
Γ+ : {l : ℕ} (Δ : DepCtx Σ m l) → Ctx Σ (m + l)
Γ+ ◇ = Γ
Γ+ (Δ , A) = (Γ+ Δ , A)
exchangeCtx : {n : ℕ} {k : JudgmentSort} → Judgment Σ Γ n k → Ctx Σ (m + n)
exchangeCtx (Δ ⊢ A) = Γ+ Δ
exchangeCtx (Δ ⊢ u :> A) = Γ+ Δ
exchangeCtx (Δ ⊢ A == B) = Γ+ Δ
exchangeCtx (Δ ⊢ u == v :> A) = Γ+ Δ
exchange : {n : ℕ} {k : JudgmentSort} → (j : Judgment Σ Γ n k) → Judgment Σ (exchangeCtx j) 0 k
exchange (Δ ⊢ A) = ◇ ⊢ A
exchange (Δ ⊢ u :> A) = ◇ ⊢ u :> A
exchange (Δ ⊢ A == B) = ◇ ⊢ A == B
exchange (Δ ⊢ u == v :> A) = ◇ ⊢ u == v :> A
{-
A judgment can be derivable in one different way:
- if it has a trivial local context, then it should be obtained by applying a rule [r] from the
derivability structure to a list of judgments [js] which are all derivable [js-der] and for which
the rule is defined [def].
The type [DerivableArgs E js] represents the fact that all of the judgments in [js] are derivables.
The type [Derivable E j] represents the fact that the judgment [j] is derivable.
-}
data Derivable {Σ : Signature} (E : DerivabilityStructure Σ)
: {m : ℕ} {Γ : Ctx Σ m} {k : JudgmentSort} → Judgment Σ Γ 0 k → Prop
data DerivableArgs {Σ : Signature} (E : DerivabilityStructure Σ) {m : ℕ} {Γ : Ctx Σ m}
: {ar : JudgmentArityArgs} → DerivationRulePremises Σ Γ ar → Prop where
[] : DerivableArgs E []
_,_ : {n : ℕ} {k : JudgmentSort} {j : Judgment Σ Γ n k}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange j)
→ DerivableArgs E (js , j)
data Derivable {Σ} E where
apr : (t : Tag) {ar : JudgmentArity} (r : Rules E t ar) {m : ℕ} {Γ : Ctx Σ m}
{js : DerivationRulePremises Σ Γ (args ar)}
(js-der : DerivableArgs E js) {{def : isDefined (rule (derivationRule E r) idSig Γ js)}}
→ Derivable E (rule (derivationRule E r) idSig Γ js $ def)
{- Special cases of [_,_], used to make Agda not blow up -}
_,0Ty_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {A : TyExpr Σ m}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (◇ ⊢ A)
→ DerivableArgs E (js , ◇ ⊢ A)
djs ,0Ty dj = djs , dj
_,0Ty=_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {A B : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (◇ ⊢ A == B)
→ DerivableArgs E (js , ◇ ⊢ A == B)
djs ,0Ty= dj = djs , dj
_,0Tm_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {u : _} {A : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (◇ ⊢ u :> A)
→ DerivableArgs E (js , ◇ ⊢ u :> A)
djs ,0Tm dj = djs , dj
_,0Tm=_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {u v : _} {A : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (◇ ⊢ u == v :> A)
→ DerivableArgs E (js , ◇ ⊢ u == v :> A)
djs ,0Tm= dj = djs , dj
_,1Ty_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {A} {B}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange ((◇ , A) ⊢ B))
→ DerivableArgs E (js , (◇ , A) ⊢ B)
djs ,1Ty dj = djs , dj
_,1Ty=_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {A} {B C}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange ((◇ , A) ⊢ B == C))
→ DerivableArgs E (js , (◇ , A) ⊢ B == C)
djs ,1Ty= dj = djs , dj
_,1Tm_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {u : _} {A : _} {B : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange ((◇ , B) ⊢ u :> A))
→ DerivableArgs E (js , (◇ , B) ⊢ u :> A)
djs ,1Tm dj = djs , dj
_,1Tm=_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {u v : _} {A : _} {B : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange ((◇ , B) ⊢ u == v :> A))
→ DerivableArgs E (js , (◇ , B) ⊢ u == v :> A)
djs ,1Tm= dj = djs , dj
_,2Tm_ : ∀ {Σ} {E} {m} {Γ : Ctx Σ m} {u : _} {A : _} {B : _} {C : _}
{ar : JudgmentArityArgs} {js : DerivationRulePremises Σ Γ ar}
→ DerivableArgs E js
→ Derivable E (exchange ((◇ , B , C) ⊢ u :> A))
→ DerivableArgs E (js , (◇ , B , C) ⊢ u :> A)
djs ,2Tm dj = djs , dj
infixl 4 _,0Ty_ _,0Ty=_ _,0Tm_ _,0Tm=_
_,1Ty_ _,1Ty=_ _,1Tm_ _,1Tm=_
_,2Tm_
|
programs/oeis/268/A268363.asm | neoneye/loda | 22 | 2708 | ; A268363: Number of n X 2 arrays containing 2 copies of 0..n-1 with row sums equal.
; 1,1,4,12,96,480,5760,40320,645120,5806080,116121600,1277337600,30656102400,398529331200,11158821273600,167382319104000,5356234211328000,91055981592576000,3278015337332736000,62282291409321984000,2491291656372879360000,52317124783830466560000,2301953490488540528640000,52944930281236432158720000,2541356653499348743618560000,63533916337483718590464000000,3303763649549153366704128000000,89201618537827140901011456000000,4995290638118319890456641536000000,144863428505431276823242604544000000
mov $2,4
lpb $0
mul $2,$0
sub $0,1
mul $2,$0
sub $0,1
mul $2,2
lpe
mov $0,$2
div $0,4
|
demo/src/demo_action_callbacks.adb | VitalijBondarenko/notifyada | 0 | 10229 | ------------------------------------------------------------------------------
-- --
-- Copyright (c) 2014-2021 <NAME> <<EMAIL>> --
-- --
------------------------------------------------------------------------------
-- --
-- The MIT License (MIT) --
-- --
-- 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. --
------------------------------------------------------------------------------
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Text_IO.Unbounded_IO; use Ada.Text_IO.Unbounded_IO;
with Glib; use Glib;
with Gtk; use Gtk;
with Gtk.Main;
package body Demo_Action_Callbacks is
---------------------
-- Action_Callback --
---------------------
procedure Action_Callback
(Notification : Notify_Notification;
Action : UTF8_String)
is
begin
Put_Line ("Action : " & Action);
Gtk.Main.Main_Quit;
Put_Line ("Action button pressed." & ASCII.LF & "Goodbye!");
end Action_Callback;
-------------------------------
-- Action_Callback_User_Data --
-------------------------------
procedure Action_Callback_User_Data
(Notification : Notify_Notification;
Action : UTF8_String;
User_Data : String_Ptr)
is
begin
Put_Line ("Action : " & Action);
Put_Line ("User Data : " & User_Data.all);
Gtk.Main.Main_Quit;
Put_Line ("Action button pressed." & ASCII.LF & "Goodbye!");
end Action_Callback_User_Data;
------------------------
-- On_Closed_Callback --
------------------------
procedure On_Closed_Callback
(Notification : access Notify_Notification_Record'Class)
is
begin
Gtk.Main.Main_Quit;
Put_Line ("Notification closed." & ASCII.LF & "Goodbye!");
end On_Closed_Callback;
end Demo_Action_Callbacks;
|
projects/batfish/src/main/antlr4/org/batfish/grammar/assertion/AssertionLexer.g4 | sskausik08/Wilco | 0 | 304 | lexer grammar AssertionLexer;
options {
superClass = 'org.batfish.grammar.BatfishLexer';
}
tokens {
QUOTED_TEXT
}
// Assertion Keywords
AND
:
'and'
;
FALSE
:
'false'
;
EMPTYPATH
:
'emptypath'
;
EQ
:
'eq'
;
GE
:
'ge'
;
GT
:
'gt'
;
IF
:
'if'
;
LE
:
'le'
;
LT
:
'lt'
;
NOT
:
'not'
;
OR
:
'or'
;
PATHSIZE
:
'pathsize'
;
TRUE
:
'true'
;
// Other tokens
DOUBLE
:
(
(
F_Digit+ '.' F_Digit*
)
|
(
'.' F_Digit+
)
) [Dd]
;
FLOAT
:
(
(
F_Digit+ '.' F_Digit*
)
|
(
'.' F_Digit+
)
) [Ff]
;
LONG
:
F_Digit+ [Ll]
;
INT
:
F_Digit+
;
PAREN_LEFT
:
'('
;
PAREN_RIGHT
:
')'
;
SINGLE_QUOTE
:
'\'' -> pushMode ( M_QuotedString )
;
WS
:
F_Whitespace+ -> channel ( HIDDEN )
;
fragment
F_Digit
:
'0' .. '9'
;
fragment
F_Whitespace
:
[ \r\n\t\u000C]
;
mode M_QuotedString;
M_QuotedString_QUOTED_TEXT
:
~'\''+ -> type ( QUOTED_TEXT )
;
M_QuotedString_SINGLE_QUOTE
:
'\'' -> type ( SINGLE_QUOTE ) , popMode
;
|
alloy4fun_models/trashltl/models/11/38aWjvGCon5TxaBeC.als | Kaixi26/org.alloytools.alloy | 0 | 5096 | <filename>alloy4fun_models/trashltl/models/11/38aWjvGCon5TxaBeC.als
open main
pred id38aWjvGCon5TxaBeC_prop12 {
always eventually all f:File | f in Trash implies always f in Trash'
}
pred __repair { id38aWjvGCon5TxaBeC_prop12 }
check __repair { id38aWjvGCon5TxaBeC_prop12 <=> prop12o } |
Transynther/x86/_processed/NONE/_zr_/i9-9900K_12_0xa0.log_21829_1262.asm | ljhsiun2/medusa | 9 | 162157 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r13
push %r9
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x2ec1, %rsi
lea addresses_WC_ht+0xc2e5, %rdi
clflush (%rsi)
nop
nop
add $5391, %r10
mov $123, %rcx
rep movsw
nop
nop
nop
nop
xor %r13, %r13
lea addresses_D_ht+0x295d, %r12
nop
inc %r9
mov (%r12), %esi
nop
nop
nop
nop
cmp %rdi, %rdi
lea addresses_normal_ht+0x17efd, %rsi
lea addresses_UC_ht+0x1241d, %rdi
and %r13, %r13
mov $44, %rcx
rep movsq
nop
nop
inc %rdi
lea addresses_WT_ht+0x904d, %rsi
lea addresses_D_ht+0x17ddd, %rdi
nop
nop
nop
nop
add %rax, %rax
mov $8, %rcx
rep movsq
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0xfa9d, %r12
and %r9, %r9
vmovups (%r12), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
nop
and $8160, %r13
lea addresses_normal_ht+0x101bd, %r13
nop
add $6470, %rdi
movb $0x61, (%r13)
nop
nop
nop
nop
cmp %r10, %r10
lea addresses_normal_ht+0x5d, %rsi
nop
nop
nop
inc %r13
mov (%rsi), %r10d
nop
nop
nop
nop
nop
inc %r9
lea addresses_D_ht+0x1e6dd, %rax
nop
nop
and %r12, %r12
mov $0x6162636465666768, %r13
movq %r13, %xmm1
vmovups %ymm1, (%rax)
nop
nop
nop
nop
and %rsi, %rsi
lea addresses_D_ht+0x432d, %r13
nop
nop
nop
xor $39495, %rsi
movw $0x6162, (%r13)
nop
nop
nop
nop
sub %r13, %r13
lea addresses_WC_ht+0xbd5d, %rax
nop
nop
add %rdi, %rdi
mov (%rax), %r9w
nop
nop
nop
nop
dec %r10
lea addresses_D_ht+0x19de1, %rcx
nop
nop
nop
nop
nop
dec %r13
vmovups (%rcx), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $0, %xmm2, %rsi
nop
nop
nop
nop
add %r13, %r13
lea addresses_A_ht+0x10815, %rax
nop
nop
nop
nop
and $16525, %r10
mov (%rax), %si
nop
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_D_ht+0xb15d, %r9
nop
nop
nop
nop
nop
cmp $54464, %rdi
mov $0x6162636465666768, %r12
movq %r12, %xmm6
movups %xmm6, (%r9)
nop
nop
nop
sub $12246, %rsi
lea addresses_WC_ht+0x1471d, %r13
clflush (%r13)
cmp $31417, %rax
mov (%r13), %rsi
nop
nop
nop
inc %r12
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r9
pop %r13
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r13
push %r14
push %r8
push %rax
push %rbp
push %rbx
push %rcx
// Store
lea addresses_D+0x13d5d, %rbp
clflush (%rbp)
add %rbx, %rbx
movb $0x51, (%rbp)
and $54026, %r14
// Load
mov $0x9126d0000000b41, %r14
nop
nop
nop
nop
sub $16802, %rcx
mov (%r14), %r8
nop
nop
add $58556, %rbx
// Store
lea addresses_PSE+0x1c0dd, %r8
nop
nop
nop
add %r13, %r13
movb $0x51, (%r8)
cmp $44387, %r14
// Store
lea addresses_normal+0xfc35, %rax
nop
nop
sub $43144, %r13
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rax)
nop
nop
nop
nop
nop
xor %r14, %r14
// Store
mov $0x4593fa00000003bd, %rcx
nop
nop
dec %r8
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
movups %xmm5, (%rcx)
nop
nop
nop
nop
dec %r13
// Store
lea addresses_A+0x318b, %rbx
nop
nop
xor $48530, %r13
movl $0x51525354, (%rbx)
nop
add %r14, %r14
// Store
lea addresses_D+0x19a51, %r8
nop
sub %r13, %r13
movl $0x51525354, (%r8)
nop
nop
nop
nop
nop
cmp %r8, %r8
// Faulty Load
lea addresses_WC+0x1e55d, %rcx
nop
nop
nop
nop
cmp %r14, %r14
mov (%rcx), %ax
lea oracles, %r14
and $0xff, %rax
shlq $12, %rax
mov (%r14,%rax,1), %rax
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r14
pop %r13
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_NC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 1}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 5, 'type': 'addresses_NC', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': True, 'same': False, 'congruent': 0, 'type': 'addresses_D', 'AVXalign': False, 'size': 4}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}}
{'src': {'NT': False, 'same': True, 'congruent': 9, 'type': 'addresses_D_ht', 'AVXalign': True, 'size': 4}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_UC_ht'}}
{'src': {'same': False, 'congruent': 4, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 1}}
{'src': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 2}}
{'src': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_WC_ht', 'AVXalign': True, 'size': 2}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 2}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16}}
{'src': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
alloy4fun_models/trashltl/models/10/cMj7XXp53frTZ6EuL.als | Kaixi26/org.alloytools.alloy | 0 | 2982 | open main
pred idcMj7XXp53frTZ6EuL_prop11 {
always File not in Protected after File in Protected
}
pred __repair { idcMj7XXp53frTZ6EuL_prop11 }
check __repair { idcMj7XXp53frTZ6EuL_prop11 <=> prop11o } |
doc/shellcode_after_execution.asm | wzw19890321/kindle-5.6.5-jailbreak | 466 | 172909 | ; IDA dump after execution. Older version of shellcode.
; Segment type: Pure code
AREA ROM, CODE, READWRITE, ALIGN=0
CODE32
RSBVS R6, R2, #0x20000006
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
loc_A104C ; DATA XREF: ROM:000A1074o
SUBPL R3, R1, #0x38
loc_A1050 ; DATA XREF: ROM:000A1078o
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
SUBPL R3, R1, #0x38
ADRMI R3, loc_A104C
ADRPL R3, loc_A1050
LDRPLB R3, [R3,#-0x30]
LDRMIB R3, [R3,#-0x30]
SUBMIS R5, R3, #0x39
SUBPLS R5, R3, #0x39
SUBMI R7, SP, #0x30
SUBMIS R3, R3, #0x38
SUBPL R6, R3, R3,ROR#2
SUBPL R4, PC, R3,ROR#2
STMPLDB R7, {R0,R4-R6,R8,LR}^
SUBPL R4, R3, R3,ROR#2
SUBPL R5, R4, #0x79
SUBPL R6, PC, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
SUBPL R6, R6, R5,ROR#2
STRPLB R3, [R6,#-0x52]
STRPLB R3, [R6,#-0x53]
STRPLB R3, [R6,#-0x54]
EORPLS R3, R3, #0x38
SUBPL R7, R3, #0x39
EORPLS R5, R7, #0x50
SUBMI R5, R3, #0x36
EORMIS R5, R3, #0x42
EORPLS R5, R5, #0x6C
STRPLB R5, [R6,#-0x48]
EORPLS R5, R3, #0x56
EORPLS R5, R5, #0x41
STRPLB R5, [R6,#-0x46]
STRPLB R7, [R6,#-0x47]
SUBPL R3, R7, #0x78
SUBPL R3, R3, #0x78
SUBPL R3, R3, #0x78
SUBPL R6, R6, R3,ROR#2
SUBPL R6, R6, R3,ROR#2
EORPLS R5, R7, #0x61
EORMIS R5, R5, #0x41
STRMIB R5, [R6,#-0x71]
EORMIS R7, R4, #0x38
SUBPL R5, SP, #0x30
LDMPLDA R5!, {R0-R2,R6,R8,LR}
SUBPL R7, R7, #0x38
SUBPL R5, R4, R4,ROR#2
RSBPLS R5, R5, #0xF0000004
EORMIS R5, R5, #0x30
SUBMIS R3, R5, #0xF0000004
SUBPL R5, R5, #0x34
EORPLS R7, R7, R5,ROR#12
EORPLS R7, R7, #0x32
EORPLS R7, R7, #0x30
EORPLS R5, R5, #0x30
SVCMI 0
EORMIS R5, R4, #0x38
SUBPL R6, PC, R1,ROR#2
BXPL R6
CODE16
MOV R0, PC
ADDS R0, #0x52 ; 'R'
SUBS R0, #0x35 ; '5'
NEGS R6, R0
NEGS R6, R6
BX R6 ; loc_A1184
; ---------------------------------------------------------------------------
CODE32
aBinSh DCB "/bin/sh",0
aMntUsJb DCB "/mnt/us/jb",0
DCB 0x30 ; 0
; ---------------------------------------------------------------------------
CODE16
loc_A1184 ; CODE XREF: ROM:000A116Ej
ADDS R0, #0x4D ; 'M'
SUBS R0, #0x62 ; 'b'
MULS R1, R2
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x73 ; 's'
STRB R2, [R0,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x6F ; 'o'
STRB R2, [R0,R1]
MULS R1, R2
ADDS R1, #0x61 ; 'a'
SUBS R1, #0x32 ; '2'
NEGS R2, R1
NEGS R2, R2
MULS R1, R4
STRB R2, [R0,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x76 ; 'v'
STRB R2, [R0,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x76 ; 'v'
STRB R2, [R0,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x76 ; 'v'
STRB R2, [R0,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x77 ; 'w'
STRB R2, [R0,R1]
MULS R1, R4
ADDS R1, #0x30 ; '0'
SUBS R1, #(loc_30+1)
NEGS R7, R1
MULS R1, R4
ADDS R1, #0x41 ; 'A'
SUBS R1, #0x36 ; '6'
MULS R7, R1
MOV R2, SP
MULS R1, R4
STR R0, [R2,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x76 ; 'v'
ADDS R0, #0x7A ; 'z'
SUBS R0, #0x72 ; 'r'
STR R0, [R2,R1]
ADDS R1, #0x7A ; 'z'
SUBS R1, #0x76 ; 'v'
STR R4, [R2,R1]
NEGS R1, R2
NEGS R1, R1
ADDS R0, #0x72 ; 'r'
SUBS R0, #0x7A ; 'z'
MULS R2, R4
SVC 0x30 ; '0'
; ---------------------------------------------------------------------------
; ROM ends
|
sources/conversion_type.adb | theurt/PageRank | 0 | 29357 | <filename>sources/conversion_type.adb
--with Ada.Text_IO; use Ada.Text_IO;
package body Conversion_Type is
type ultra_precis is digits 16; -- ce type va nous permettre d'avoir des réels avec une précision acceptable
-- package Real_IO is new Ada.Text_IO.Float_IO(T_Element); use Real_IO; utile pour du debugage
function To_Integer( chaine : in Unbounded_String) return Integer is
taille : Integer; -- taille de la chaine de caractères rentrée
chiffre : Integer; -- chiffre converti en integer
nombre : Integer; -- chaine de caractère convertie en nombre
begin
-- Initialiser les variables
taille := Length(chaine);
nombre := 0;
-- Appliquer le schéma de Horner pour reconstruire l'entier
for indice in 1..taille loop
-- Convertir chaine(indice) en chiffre
chiffre:= Character'Pos(To_string(chaine)(indice)) - Character'Pos('0');
-- Vérifier que c'est bien un chiffre !
if chiffre > 9 or chiffre < 0 then
raise Bad_Type_Conversion_Error;
end if;
-- Appliquer Horner
nombre := nombre * 10 + Chiffre;
end loop;
return nombre;
end To_Integer;
function To_reel( chaine : in Unbounded_String) return T_Element is
-- Nom : puissance_10
-- Semantique : Renvoie la puissance de 10 négative associée à nombre
-- Paramètre(s) :
-- exposant : in Integer; -- exposant
-- Type de retour : ultra_precis; -- le retour s'écrit sur 16 digits !
-- Pre : True
-- Post : puissance_10'Result - puissance_10'Result < 0.000000000000001
-- Tests :
-- Entrée : 2 Sortie : environ 1.0000000000000000 E-02
-- Exceptions : Exponant_Too_Big_error si l'utilisateur rentre un exposant plus grand que 16 (ada n'autorise que 16 digits au max)
function puissance_10 (exposant : in Integer) return ultra_precis is
resultat : ultra_precis;
Exponant_Too_Big_error : exception;
begin
if exposant > 16 then -- la précision du résultat ne serait pas assez bonne !
raise Exponant_Too_Big_error;
else
resultat := ultra_precis(0.1);
for i in 1..exposant-1 loop
resultat := ultra_precis(0.1)*resultat;
end loop;
return resultat;
end if;
end puissance_10;
taille_chaine : Integer; -- taille de la chaine de caractères rentrée
chaine_partie_entiere : Unbounded_String; -- partie entière du T_Element sous forme d'une chaine
partie_entiere : Integer; -- partie entière du T_Element
partie_decimal : T_Element; -- partie décimale du T_Element
position_virgule : Integer; -- indice de la position occupée par la virgule
virgule_trouvee : Boolean; -- Indique si la chaine comporte bien une virgule
chaine_partie_decimal : Unbounded_String; -- Chaine représentant la partie décimale
taille_partie_decimal : Integer; -- Taille de la chaine
begin
-- Traiter le cas évident ou la chaine est trop petite
taille_chaine := Length(chaine);
if taille_chaine < 3 then
raise Bad_Type_Conversion_Error;
-- Essayer de convertir la chaine en T_Element
else
-- Trouver la place de la virgule
position_virgule := 1;
virgule_trouvee := False;
while not virgule_trouvee loop
if To_string(chaine)(position_virgule) = '.' then
virgule_trouvee := True;
end if;
position_virgule := position_virgule + 1 ;
end loop ;
position_virgule := position_virgule -1; -- la sortie du while se fait avec position + 1
-- Extraire la partie entière du nombre
for i in 1..position_virgule-1 loop
chaine_partie_entiere := chaine_partie_entiere & To_string(chaine)(i) ;
end loop;
-- Convertir la partie entière en T_Element
partie_entiere := To_Integer(chaine_partie_entiere);
-- Extraire la partie décimale
chaine_partie_decimal := To_Unbounded_String(To_String(chaine)(position_virgule+1..Taille_chaine));
taille_partie_decimal := Length(chaine_partie_decimal);
-- Convertir la partie décimale
if taille_partie_decimal <= 8 then -- cette condition est due au fait que les réels <= 10⁸en ADA
partie_decimal:= T_Element(To_Integer(chaine_partie_decimal));
partie_decimal := partie_decimal*T_Element(puissance_10(taille_partie_decimal));
else
-- Découper la partie décimale en deux pour convertir des entiers de plus de 8 digits !
partie_decimal := T_Element(To_Integer(To_Unbounded_String(To_String(chaine_partie_decimal)(1..8))));
partie_decimal := partie_decimal*T_Element(puissance_10(8)); -- partie "gauche"
partie_decimal := partie_decimal + T_Element(To_Integer(To_Unbounded_String(To_String(chaine_partie_decimal)(9..taille_partie_decimal))))*T_Element(puissance_10(taille_partie_decimal));
end if;
return partie_decimal + T_Element(partie_entiere);
end if;
end To_reel;
procedure Integer_or_reel( chaine : in Unbounded_String; reel : out T_Element;
entier : out Integer; indicateur : out Character) is
begin
entier:= -1;
-- Déterminer si c'est un réel
begin
reel := To_reel(chaine);
indicateur := 'f';
exception
when Bad_Type_Conversion_Error|CONSTRAINT_ERROR => -- le constraint error apparait si on cherche la virgule dans un réel !
-- Déterminer si c'est un entier
begin
entier := To_Integer(chaine);
indicateur := 'i';
exception
-- Déterminer si c'est autre choses
when Bad_Type_Conversion_Error =>indicateur := 'o';
end;
end;
end Integer_or_reel;
end Conversion_Type;
|
ADL/drivers/stm32g474/stm32-i2s.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 20402 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2016, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f4xx_hal_i2s.c --
-- @author MCD Application Team --
-- @version V1.0.0 --
-- @date 18-February-2014 --
-- @brief I2S HAL module driver. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with Ada.Unchecked_Conversion;
with STM32.Device;
package body STM32.I2S is
function To_UInt16 is new Ada.Unchecked_Conversion (Integer_16,
UInt16);
function To_Integer_16 is new Ada.Unchecked_Conversion (UInt16,
Integer_16);
---------------
-- Configure --
---------------
procedure Configure (This : in out I2S_Port; Conf : I2S_Configuration) is
begin
This.Periph.I2SCFGR.I2SCFG := (case Conf.Mode is
when Slave_Transmit => 2#00#,
when Slave_Receive => 2#01#,
when Master_Transmit => 2#10#,
when Master_Receive => 2#11#);
This.Periph.I2SCFGR.PCMSYNC := Conf.Syncho = Long_Frame_Synchro;
This.Periph.I2SCFGR.I2SSTD := (case Conf.Standard is
when I2S_Philips_Standard => 2#00#,
when MSB_Justified_Standard => 2#01#,
when LSB_Justified_Standard => 2#10#,
when PCM_Standard => 2#11#);
This.Periph.I2SCFGR.CKPOL := Conf.Clock_Polarity = Steady_State_High;
This.Periph.I2SCFGR.DATLEN := (case Conf.Data_Length is
when Data_16bits => 2#00#,
when Data_24bits => 2#01#,
when Data_32bits => 2#10#);
This.Periph.I2SCFGR.CHLEN := Conf.Chan_Length = Channel_32bits;
This.Periph.I2SPR.MCKOE := Conf.Master_Clock_Out_Enabled;
This.Periph.CR2.TXDMAEN := Conf.Transmit_DMA_Enabled;
This.Periph.CR2.RXDMAEN := Conf.Receive_DMA_Enabled;
end Configure;
-----------------
-- In_I2S_Mode --
-----------------
function In_I2S_Mode (This : in out I2S_Port) return Boolean is
(This.Periph.I2SCFGR.I2SMOD);
------------
-- Enable --
------------
procedure Enable (This : in out I2S_Port) is
begin
if This.Periph.CR1.SPE then
raise Program_Error with "Device already enabled in SPI mode";
end if;
This.Periph.I2SCFGR.I2SMOD := True;
This.Periph.I2SCFGR.I2SE := True;
end Enable;
-------------
-- Disable --
-------------
procedure Disable (This : in out I2S_Port) is
begin
This.Periph.I2SCFGR.I2SE := False;
end Disable;
-------------
-- Enabled --
-------------
function Enabled (This : I2S_Port) return Boolean is
begin
return This.Periph.I2SCFGR.I2SE;
end Enabled;
---------------------------
-- Data_Register_Address --
---------------------------
function Data_Register_Address (This : I2S_Port)
return System.Address
is
begin
return This.Periph.DR'Address;
end Data_Register_Address;
-------------------
-- Set_Frequency --
-------------------
overriding
procedure Set_Frequency (This : in out I2S_Port;
Frequency : Audio_Frequency)
is
use STM32.Device;
I2SCLK : constant UInt32 := Get_Clock_Frequency (This);
Real_Divider : UInt32;
Packet_Len : constant UInt32 := (if This.Periph.I2SCFGR.DATLEN = 0
then 1 else 2);
Is_Odd : Boolean;
Divider : UInt32;
begin
if This.Periph.I2SPR.MCKOE then
Real_Divider := (I2SCLK / 256) * 10;
else
Real_Divider := (I2SCLK / (32 * Packet_Len)) * 10;
end if;
Real_Divider := ((Real_Divider / Frequency'Enum_Rep) + 5) / 10;
Is_Odd := Real_Divider mod 2 = 1;
if Is_Odd then
Divider := (Real_Divider - 1) / 2;
else
Divider := Real_Divider / 2;
end if;
if Divider < 2 or else Divider > 255 then
-- Value out of bounds, use default value
Divider := 2;
Is_Odd := False;
end if;
This.Periph.I2SPR.ODD := Is_Odd;
This.Periph.I2SPR.I2SDIV := UInt8 (Divider);
end Set_Frequency;
-------------
-- Receive --
-------------
overriding procedure Receive
(This : in out I2S_Port;
Data : out Audio_Buffer)
is
begin
for Elt of Data loop
while not This.Periph.SR.RXNE loop
null;
end loop;
Elt := To_Integer_16 (This.Periph.DR.DR);
end loop;
end Receive;
--------------
-- Transmit --
--------------
overriding procedure Transmit
(This : in out I2S_Port;
Data : Audio_Buffer)
is
begin
for Elt of Data loop
while not This.Periph.SR.TXE loop
null;
end loop;
This.Periph.DR.DR := To_UInt16 (Elt);
end loop;
end Transmit;
end STM32.I2S;
|
libsrc/_DEVELOPMENT/threads/mutex/c/sccz80/mtx_lock.asm | jpoikela/z88dk | 640 | 246130 | <gh_stars>100-1000
; int mtx_lock(mtx_t *m)
SECTION code_clib
SECTION code_threads_mutex
PUBLIC mtx_lock
EXTERN asm_mtx_lock
defc mtx_lock = asm_mtx_lock
|
oeis/017/A017642.asm | neoneye/loda-programs | 11 | 25697 | <filename>oeis/017/A017642.asm
; A017642: a(n) = (12*n+10)^2.
; 100,484,1156,2116,3364,4900,6724,8836,11236,13924,16900,20164,23716,27556,31684,36100,40804,45796,51076,56644,62500,68644,75076,81796,88804,96100,103684,111556,119716,128164,136900,145924,155236,164836,174724,184900,195364,206116,217156,228484,240100,252004,264196,276676,289444,302500,315844,329476,343396,357604,372100,386884,401956,417316,432964,448900,465124,481636,498436,515524,532900,550564,568516,586756,605284,624100,643204,662596,682276,702244,722500,743044,763876,784996,806404,828100
mul $0,12
add $0,10
pow $0,2
|
alloy4fun_models/trainstlt/models/1/CaCTAnpbLXHc96Kia.als | Kaixi26/org.alloytools.alloy | 0 | 291 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idCaCTAnpbLXHc96Kia_prop2 {
eventually (all t:Track | Green in t.signal)
}
pred __repair { idCaCTAnpbLXHc96Kia_prop2 }
check __repair { idCaCTAnpbLXHc96Kia_prop2 <=> prop2o } |
Library/Kernel/Format/formatVerify.asm | steakknife/pcgeos | 504 | 82832 |
COMMENT @-----------------------------------------------------------------------
Copyright (c) GeoWorks 1989 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: formatVerify.asm
AUTHOR: Cheng, 7/90
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 7/90 Initial revision
DESCRIPTION:
$Id: formatVerify.asm,v 1.1 97/04/05 01:18:26 newdeal Exp $
-------------------------------------------------------------------------------@
COMMENT @-----------------------------------------------------------------------
FUNCTION: VerifyKeyTracks
DESCRIPTION:
CALLED BY: INTERNAL ()
PASS: ds - dgroup
es - workBufSegAddr
RETURN: carry set on error
ax - 0 if successful,
else one of:
FMT_ERR_WRITING_BOOT
FMT_ERR_WRITING_ROOT_DIR
FMT_ERR_WRITING_FAT
DESTROYED: bx,cx,dx,bp,di
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial version
-------------------------------------------------------------------------------@
VerifyKeyTracks proc near uses ds, es
.enter
push ds
mov bx, es
mov ds, bx
pop es
mov bx, FML_DOS
call FileGrabSystem
mov ah, 0dh ;reset disk system
int 21h
clr dx ;logical sector 0
mov al, es:[drive]
mov cx, 1 ;specify 1 sector
verifyLoop:
clr bx
push ax,cx,dx
int 25h
inc sp
inc sp
pop ax,cx,dx
jc error
inc dx
cmp dx, es:[startFilesArea] ;al <- num sectors to verify
jne verifyLoop
clr ax ;ax <- 0, clear C
jmp short done
error:
mov ax, FMT_ERR_WRITING_BOOT
cmp dx, es:[startFAT]
jb doneError
mov ax, FMT_ERR_WRITING_FAT
cmp dx, es:[startRoot]
jb doneError
mov ax, FMT_ERR_WRITING_ROOT_DIR
doneError:
stc
done:
pushf
mov bx, FML_DOS
call FileReleaseSystem
popf
.leave
ret
VerifyKeyTracks endp
if 0 ;***************************************************************
COMMENT @-----------------------------------------------------------------------
FUNCTION: VerifyInt13
DESCRIPTION:
CALLED BY: INTERNAL (Not in use)
PASS: ah - int 13h operation
al - number of sectors
ch - cylinder
cl - sector
dh - head
dl - drive
RETURN: carry flag
DESTROYED:
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 6/90 Initial version
-------------------------------------------------------------------------------@
VerifyInt13 proc near uses bp
.enter
push ax
clr ah ;reset disk system
int 13h
pop ax
mov bp, 5
tryLoop:
push ax
int 13h ;perform operation
pop ax
jnc done
dec bp
jne tryLoop
stc
done:
.leave
ret
VerifyInt13 endp
COMMENT @-----------------------------------------------------------------------
FUNCTION: ConvLogicalToPhysical
DESCRIPTION: Converts the given logical sector number to its physical
address.
CALLED BY: INTERNAL (Not in use)
PASS: dx - logical sector number
ds - dgroup
RETURN: ch - cylinder
cl - sector
dh - head
DESTROYED: dl
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
Cheng 9/89 Initial version
-------------------------------------------------------------------------------@
ConvLogicalToPhysical proc near uses ax,bp
.enter
;
; First figure the sector number by dividing the logical sector by
; the number of sectors per track. This gives us the track number
; in ax and the sector number in dx. Both of these are 0-origin.
;
push dx
mov ax, dx
clr dx
div ds:[mediaVars.BPB_sectorsPerTrack]
inc dl
mov cl, dl ;cl <- sector number
;
; Now figure the head number from the track number. The tracks are
; assigned to the heads sequentially, e.g. for a 4-headed drive,
; track 0 is on head 0, track 1 on head 1, track 2 on head 2, track
; 3 on head 3, and track 4 is on head 0 again.
;
clr dx
div ds:[mediaVars.BPB_numHeads]
mov ch, dl ;dh <- head (eventually)
;
; Finally we need the cylinder number. For a 4-headed drive,
; tracks 0-3 make up cylinder 0.
;
mov ax, ds:[mediaVars.BPB_sectorsPerTrack]
; Figure sectors per cylinder
mul ds:[mediaVars.BPB_numHeads] ; from s.p.t. * tracks per
; cylinder (number of heads)
mov bp, ax ;preserve sectors per cylinder
pop ax ;retrieve logical sector
div bp ;yields cylinder in ax
mov dh, ch ;transfer head to dh now
; we're done with dx
mov ch, al ;return cylinder in ch
.leave
ret
ConvLogicalToPhysical endp
endif ;***************************************************************
|
non_regression/other_sparc_1.s.asm | LRGH/plasmasm | 1 | 1975 | .file "a02ter.c"
.section ".text"
.align 4
.align 4
.globl toto
.type toto, #function
.proc 020
toto:
save %sp, -96, %sp
st %i0, [%fp+68]
ld [%fp+68], %g1
ld [%g1], %g1
add %g1, 1, %g2
ld [%fp+68], %g1
st %g2, [%g1]
restore
retl
nop
.size toto, .-toto
# ----------------------
.align 4
.align 4
.globl tata
.type tata, #function
.proc 020
tata:
save %sp, -96, %sp
st %i0, [%fp+68]
ld [%fp+68], %g1
ld [%g1], %g1
add %g1, -1, %g2
ld [%fp+68], %g1
st %g2, [%g1]
restore
retl
nop
.size tata, .-tata
# ----------------------
.section ".data"
.align 4
.globl t
.type t, #object
t:
.long toto
.long tata
.size t, 8
# ----------------------
.section ".text"
.align 4
.align 4
.globl main
.type main, #function
.proc 04
main:
save %sp, -104, %sp
clr [%fp+-4]
sethi %hi(t), %g1
bset %lo(t), %g1
ld [%g1], %g1
add %fp, -4, %g2
mov %g2, %o0
call %g1, 0
nop
ld [%fp+-4], %g1
mov %g1, %i0
restore
retl
nop
.size main, .-main
# ----------------------
.ident "GCC: (GNU) 4.4.2"
|
oeis/021/A021276.asm | neoneye/loda-programs | 11 | 168500 | ; A021276: Decimal expansion of 1/272.
; Submitted by Jon Maiga
; 0,0,3,6,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1,1,7,6,4,7,0,5,8,8,2,3,5,2,9,4,1
seq $0,173833 ; 10^n - 3.
div $0,272
mod $0,10
|
programs/oeis/267/A267845.asm | neoneye/loda | 22 | 17857 | <reponame>neoneye/loda
; A267845: Triangle read by rows giving successive states of cellular automaton generated by "Rule 227" initiated with a single ON (black) cell.
; 1,1,0,0,1,1,0,1,0,1,1,1,1,0,1,0,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0
mov $4,4
mov $6,$0
lpb $4
mov $0,$6
mov $3,0
sub $4,1
add $0,$4
sub $0,1
lpb $0
mov $2,$0
sub $0,1
add $1,$5
add $3,1
div $2,$3
mov $5,8
add $5,$2
lpe
lpe
add $1,1
mod $1,2
mov $0,$1
|
test/Succeed/Issue836b.agda | shlevy/agda | 1,989 | 10392 | -- Andreas, 2013-05-02 This ain't a bug, it is a feature.
-- {-# OPTIONS -v scope.name:10 #-}
module _ where
open import Common.Equality
module M where
record R' : Set₁ where
field
X : Set
open M renaming (R' to R)
X : R → Set
X = R.X
-- Nisse:
-- The open directive did not mention the /module/ R, so (I think
-- that) the code above should be rejected.
-- Andreas:
-- NO, it is a feature that projections can also be accessed via
-- the record /type/.
-- Ulf:
-- According to the suggestion in 836, if you rename the module explicitly
-- the code above breaks (test/fail/Issue836.agda).
|
oeis/200/A200786.asm | neoneye/loda-programs | 11 | 80349 | <filename>oeis/200/A200786.asm<gh_stars>10-100
; A200786: Number of 0..n arrays x(0..3) of 4 elements without any two consecutive increases.
; Submitted by <NAME>
; 16,75,225,530,1071,1946,3270,5175,7810,11341,15951,21840,29225,38340,49436,62781,78660,97375,119245,144606,173811,207230,245250,288275,336726,391041,451675,519100,593805,676296,767096,866745,975800,1094835,1224441,1365226,1517815,1682850,1860990,2052911,2259306,2480885,2718375,2972520,3244081,3533836,3842580,4171125,4520300,4890951,5283941,5700150,6140475,6605830,7097146,7615371,8161470,8736425,9341235,9976916,10644501,11345040,12079600,12849265,13655136,14498331,15379985,16301250,17263295
mov $1,1
mov $2,$0
add $2,4
sub $1,$2
sub $1,$0
bin $1,4
bin $2,$0
add $1,$2
mov $0,$1
|
zh/zh2/Crossroad.adb | balintsoos/LearnAda | 0 | 306 | with Ada.Text_IO;
use Ada.Text_IO;
procedure Crossroad is
-- Colors
type colors is (red, redyellow, green, yellow);
-- Lamp
protected Lamp is
procedure Switch;
function Color return colors;
private
currentColor : colors := red;
end Lamp;
protected body Lamp is
procedure Switch is
begin
if currentColor = yellow then
currentColor := red;
else
currentColor := colors'Succ(currentColor);
end if;
Put_Line("Lamp switched to " & colors'Image(currentColor));
end Switch;
function Color return colors is
begin
return currentColor;
end Color;
end Lamp;
-- Controller
task Controller is
entry Stop;
end Controller;
task body Controller is
stopped : Boolean := false;
begin
while not stopped loop
select
accept Stop do
stopped := true;
end Stop;
or
-- red
delay 3.0;
Lamp.Switch;
-- redyellow
delay 1.0;
Lamp.Switch;
-- green
delay 3.0;
Lamp.Switch;
-- yellow
delay 2.0;
Lamp.Switch;
end select;
end loop;
end Controller;
type String_Access is access String;
task type Vehicle(plate: String_Access);
type Vehicle_Access is access Vehicle;
task body Vehicle is
crossed : Boolean := false;
begin
Put_Line(plate.all & " arrived");
while not crossed loop
if Lamp.Color = green then
Put_Line(plate.all & " crossed");
crossed := true;
else
Put_Line(plate.all & " waiting");
delay 0.2;
end if;
end loop;
end Vehicle;
vehicles : array(1 .. 10) of Vehicle_Access;
plate : String_Access;
begin
for i in 1 .. 10 loop
plate := new String'("CAR" & Integer'Image(i));
vehicles(i) := new Vehicle(plate);
delay 0.5;
end loop;
--Skip_Line();
delay 15.0;
Controller.Stop;
end Crossroad;
|
programs/oeis/094/A094025.asm | neoneye/loda | 22 | 83701 | <reponame>neoneye/loda<filename>programs/oeis/094/A094025.asm
; A094025: Expansion of (1+3x)/((1-x^2)(1-3x^2)).
; 1,3,4,12,13,39,40,120,121,363,364,1092,1093,3279,3280,9840,9841,29523,29524,88572,88573,265719,265720,797160,797161,2391483,2391484,7174452,7174453,21523359,21523360,64570080,64570081,193710243,193710244
mov $1,$0
lpb $1
trn $1,2
add $2,1
add $0,$2
mov $2,$0
sub $0,$1
add $2,$0
lpe
add $0,1
|
Transynther/x86/_processed/AVXALIGN/_st_zr_4k_sm_/i3-7100_9_0x84_notsx.log_21829_461.asm | ljhsiun2/medusa | 9 | 163815 | <filename>Transynther/x86/_processed/AVXALIGN/_st_zr_4k_sm_/i3-7100_9_0x84_notsx.log_21829_461.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r8
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x1a246, %rsi
lea addresses_WC_ht+0x4386, %rdi
nop
and $46947, %r10
mov $91, %rcx
rep movsb
dec %r8
lea addresses_normal_ht+0x1e27e, %rsi
lea addresses_A_ht+0x14c16, %rdi
nop
nop
nop
nop
xor $3390, %rdx
mov $118, %rcx
rep movsq
nop
nop
nop
and $24214, %rcx
lea addresses_normal_ht+0x14c3e, %rdx
nop
nop
nop
nop
cmp %r11, %r11
vmovups (%rdx), %ymm6
vextracti128 $1, %ymm6, %xmm6
vpextrq $0, %xmm6, %r10
cmp $5725, %rcx
lea addresses_UC_ht+0xd416, %rsi
lea addresses_normal_ht+0x8d81, %rdi
nop
nop
nop
nop
xor %r13, %r13
mov $103, %rcx
rep movsb
nop
nop
nop
nop
nop
xor %r8, %r8
lea addresses_normal_ht+0x1ee12, %rdi
nop
nop
nop
nop
nop
add %r11, %r11
vmovups (%rdi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r10
add %r11, %r11
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %r8
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r8
push %rbx
push %rdi
push %rdx
// Load
lea addresses_WT+0x6916, %rbx
clflush (%rbx)
nop
nop
nop
nop
nop
dec %r8
mov (%rbx), %edx
nop
xor $45455, %rdi
// Store
lea addresses_US+0x18d16, %r11
clflush (%r11)
nop
nop
nop
nop
nop
and $26618, %r10
mov $0x5152535455565758, %rbx
movq %rbx, %xmm4
movups %xmm4, (%r11)
nop
cmp %r14, %r14
// Store
mov $0x494b710000000d16, %r14
nop
nop
add %r10, %r10
mov $0x5152535455565758, %r8
movq %r8, %xmm3
vmovups %ymm3, (%r14)
nop
nop
and $57502, %r8
// Load
lea addresses_UC+0x1af16, %rdx
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%rdx), %r8
nop
and %rbx, %rbx
// Store
lea addresses_RW+0xf0da, %r10
nop
nop
nop
nop
inc %rdi
movw $0x5152, (%r10)
// Exception!!!
nop
nop
nop
nop
mov (0), %r8
inc %r8
// Store
mov $0x75a4d90000000616, %rdi
nop
nop
nop
add %r11, %r11
movw $0x5152, (%rdi)
nop
add $14995, %rdi
// Faulty Load
mov $0x494b710000000d16, %r10
nop
nop
nop
nop
nop
and %r8, %r8
mov (%r10), %rdx
lea oracles, %r8
and $0xff, %rdx
shlq $12, %rdx
mov (%r8,%rdx,1), %rdx
pop %rdx
pop %rdi
pop %rbx
pop %r8
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_US', 'same': False, 'size': 16, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': True, 'size': 32, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_UC', 'same': False, 'size': 8, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_RW', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_NC', 'same': False, 'size': 2, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_NC', 'same': True, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 4, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 3, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'00': 973, '58': 20856}
58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 00 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 00 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 00 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58
*/
|
oeis/092/A092467.asm | neoneye/loda-programs | 11 | 25119 | ; A092467: a(n) = Sum_{i+j+k=n, 0<=i,j,k<=n} (n+2k)!/(i! * j! * (3*k)!).
; Submitted by <NAME>
; 1,3,13,63,309,1511,7373,35951,175269,854455,4165565,20307647,99002389,482649479,2352978861,11471077391,55922991237,272631840855,1329115610269,6479611111519,31588945184245,154000207833639,750771001516685,3660106078087087,17843492191078501,86989340412637943,424084325220220285,2067466129118514687,10079165724488062933,49137241123756026567,239550428205383548269,1167839429748517022543,5693368798765064791109,27755911860016317653399,135313672872921582260829,659671718180375782313887
mov $3,$0
lpb $0
mov $2,$3
bin $2,$0
sub $0,1
add $1,$2
mul $1,2
add $3,2
lpe
mov $0,$1
add $0,1
|
test/Fail/Issue256.agda | redfish64/autonomic-agda | 3 | 1955 | <reponame>redfish64/autonomic-agda<filename>test/Fail/Issue256.agda
module Issue256 where
open import Common.Level
const : ∀ {a b} {A : Set a} {B : Set b} → A → B → A
const x = λ _ → x
level : ∀ {ℓ} → Set ℓ → Level
level {ℓ} _ = ℓ
-- termination check should fail for the following definition
ℓ : Level
ℓ = const lzero (Set ℓ)
-- A : Set (lsuc {!ℓ!})
-- A = Set (level A)
|
source/web/soap/web_services-soap-message_decoders.ads | svn2github/matreshka | 24 | 17314 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2012, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the <NAME>, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
-- SOAP message decoder process events from SAX parser.
------------------------------------------------------------------------------
with League.Strings;
with XML.SAX.Attributes;
with XML.SAX.Content_Handlers;
with XML.SAX.Error_Handlers;
with XML.SAX.Parse_Exceptions;
with XML.SAX.Lexical_Handlers;
private with Web_Services.SOAP.Payloads.Decoders;
private with Web_Services.SOAP.Headers.Decoders;
with Web_Services.SOAP.Messages;
package Web_Services.SOAP.Message_Decoders is
type SOAP_Message_Decoder is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with private;
function Success (Self : SOAP_Message_Decoder'Class) return Boolean;
function Message
(Self : SOAP_Message_Decoder'Class)
return Web_Services.SOAP.Messages.SOAP_Message_Access;
private
type States is
(Initial, -- Initial state.
SOAP_Envelope, -- SOAP Envelope element has been processed.
SOAP_Header, -- SOAP Header element has been processed.
Header_Element, -- SOAP Header child element has been processed.
Header_Ignore, -- Ignore child and grandchildren of SOAP Header.
SOAP_Body, -- SOAP Body element has beed processed.
Body_Element, -- SOAP Body child element has been processed.
Body_Ignore); -- Ignore child and grandchildren of SOAP Header.
type Modes is
(Strict, -- Strict mode: all 'SHOULD' assertions are
-- checked.
Conformant); -- Relaxed mode to pass SOAP conformance testsuite;
-- some 'SHOULD' assertions aren't checked.
type SOAP_Message_Decoder is
limited new XML.SAX.Content_Handlers.SAX_Content_Handler
and XML.SAX.Error_Handlers.SAX_Error_Handler
and XML.SAX.Lexical_Handlers.SAX_Lexical_Handler with
record
Mode : Modes := Conformant;
State : States := Initial;
Depth : Natural := 0;
Payload_Decoder :
Web_Services.SOAP.Payloads.Decoders.SOAP_Payload_Decoder_Access;
Header_Decoder :
Web_Services.SOAP.Headers.Decoders.SOAP_Header_Decoder_Access;
Message : Web_Services.SOAP.Messages.SOAP_Message_Access;
Success : Boolean := True;
end record;
overriding procedure Characters
(Self : in out SOAP_Message_Decoder;
Text : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure End_Element
(Self : in out SOAP_Message_Decoder;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Error
(Self : in out SOAP_Message_Decoder;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception;
Success : in out Boolean);
-- Stops processing of the message.
overriding function Error_String
(Self : SOAP_Message_Decoder) return League.Strings.Universal_String;
-- Returns error information as string.
overriding procedure Fatal_Error
(Self : in out SOAP_Message_Decoder;
Occurrence : XML.SAX.Parse_Exceptions.SAX_Parse_Exception);
-- Stops processing of the message.
overriding procedure Processing_Instruction
(Self : in out SOAP_Message_Decoder;
Target : League.Strings.Universal_String;
Data : League.Strings.Universal_String;
Success : in out Boolean);
-- Handles processing instructions in XML stream. Processing instructions
-- are prohibited in SOAP messages, this subprogram always sets Success to
-- False.
overriding procedure Start_Document
(Self : in out SOAP_Message_Decoder;
Success : in out Boolean);
-- Handles start of processing of document. Used for initialization.
overriding procedure Start_DTD
(Self : in out SOAP_Message_Decoder;
Name : League.Strings.Universal_String;
Public_Id : League.Strings.Universal_String;
System_Id : League.Strings.Universal_String;
Success : in out Boolean);
overriding procedure Start_Element
(Self : in out SOAP_Message_Decoder;
Namespace_URI : League.Strings.Universal_String;
Local_Name : League.Strings.Universal_String;
Qualified_Name : League.Strings.Universal_String;
Attributes : XML.SAX.Attributes.SAX_Attributes;
Success : in out Boolean);
end Web_Services.SOAP.Message_Decoders;
|
release/src-rt-6.x.4708/router/gmp/mpn/rsh1sub_n.asm | zaion520/ATtomato | 2 | 85532 | dnl ARM mpn_rsh1add_n and mpn_rsh1sub_n.
dnl Contributed to the GNU project by <NAME>.
dnl Copyright 2012 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
dnl
dnl The GNU MP Library is free software; you can redistribute it and/or modify
dnl it under the terms of either:
dnl
dnl * the GNU Lesser General Public License as published by the Free
dnl Software Foundation; either version 3 of the License, or (at your
dnl option) any later version.
dnl
dnl or
dnl
dnl * the GNU General Public License as published by the Free Software
dnl Foundation; either version 2 of the License, or (at your option) any
dnl later version.
dnl
dnl or both in parallel, as here.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
dnl for more details.
dnl
dnl You should have received copies of the GNU General Public License and the
dnl GNU Lesser General Public License along with the GNU MP Library. If not,
dnl see https://www.gnu.org/licenses/.
include(`../config.m4')
C cycles/limb
C StrongARM ?
C XScale ?
C Cortex-A7 ?
C Cortex-A8 ?
C Cortex-A9 3.64-3.7
C Cortex-A15 2.5
C TODO
C * Not optimised.
define(`rp', `r0')
define(`up', `r1')
define(`vp', `r2')
define(`n', `r3')
ifdef(`OPERATION_rsh1add_n', `
define(`ADDSUB', adds)
define(`ADDSUBC', adcs)
define(`RSTCY', `cmn $1, $1')
define(`func', mpn_rsh1add_n)
define(`func_nc', mpn_rsh1add_nc)')
ifdef(`OPERATION_rsh1sub_n', `
define(`ADDSUB', subs)
define(`ADDSUBC', sbcs)
define(`RSTCY',
`mvn $2, #0x80000000
cmp $2, $1')
define(`func', mpn_rsh1sub_n)
define(`func_nc', mpn_rsh1sub_nc)')
MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
ASM_START()
PROLOGUE(func)
push {r4-r11}
ldr r4, [up], #4
ldr r8, [vp], #4
ADDSUB r4, r4, r8
movs r12, r7, rrx
and r11, r4, #1 C return value
subs n, n, #4
blo L(end)
L(top): ldmia up!, {r5,r6,r7}
ldmia vp!, {r8,r9,r10}
cmn r12, r12
ADDSUBC r5, r5, r8
ADDSUBC r6, r6, r9
ADDSUBC r7, r7, r10
movs r12, r7, rrx
movs r6, r6, rrx
movs r5, r5, rrx
movs r4, r4, rrx
subs n, n, #3
stmia rp!, {r4,r5,r6}
mov r4, r7
bhs L(top)
L(end): cmn n, #2
bls L(e2)
ldm up, {r5,r6}
ldm vp, {r8,r9}
cmn r12, r12
ADDSUBC r5, r5, r8
ADDSUBC r6, r6, r9
movs r12, r6, rrx
movs r5, r5, rrx
movs r4, r4, rrx
stmia rp!, {r4,r5}
mov r4, r6
b L(e1)
L(e2): bne L(e1)
ldr r5, [up, #0]
ldr r8, [vp, #0]
cmn r12, r12
ADDSUBC r5, r5, r8
movs r12, r5, rrx
movs r4, r4, rrx
str r4, [rp], #4
mov r4, r5
L(e1): RSTCY( r12, r1)
mov r4, r4, rrx
str r4, [rp, #0]
mov r0, r11
pop {r4-r11}
ret r14
EPILOGUE()
|
test/Fail/Issue4530.agda | shlevy/agda | 1,989 | 1586 | <filename>test/Fail/Issue4530.agda
open import Agda.Builtin.Bool public
open import Agda.Builtin.Nat public
data IsTrue : Bool → Set where
instance truth : IsTrue true
postulate
foo : {{IsTrue (3 < 2)}} → Nat
test : Nat
test = foo
|
fm/DosQFileMode.asm | osfree-project/FamilyAPI | 0 | 22860 | <gh_stars>0
;/*!
; @file
;
; @ingroup fapi
;
; @brief DosQFileMode DOS wrapper
;
; (c) osFree Project 2018, <http://www.osFree.org>
; for licence see licence.txt in root directory, or project website
;
; This is Family API implementation for DOS, used with BIND tools
; to link required API
;
; @author <NAME> (<EMAIL>)
;
; @todo add dos version check
;
;*/
.8086
; Helpers
INCLUDE helpers.inc
INCLUDE dos.inc
INCLUDE GlobalVars.inc
INCLUDE bseerr.inc
_TEXT SEGMENT BYTE PUBLIC 'CODE' USE16
@PROLOG DOSQFILEMODE
FILENAME DD ?
CURRENTATTRIBUTE DD ?
RESERVED DD ?
@START DOSQFILEMODE
MOV AX,ERROR_INVALID_PARAMETER
XOR BX, BX
CMP BX, WORD PTR [DS:BP].ARGS.RESERVED
JNZ EXIT
CMP BX, WORD PTR [DS:BP].ARGS.RESERVED+2
JNZ EXIT
CMP LFNAPI, 0FFFFH
JZ LFN
CHANGE_MODE [DS:BP].ARGS.FILENAME, 0, 0
JMP RESULT
LFN:
LFN_CHANGE_MODE [DS:BP].ARGS.FILENAME, 0, 0
RESULT:
LDS SI,[DS:BP].ARGS.CURRENTATTRIBUTE
MOV WORD PTR [SI],CX
JC @1F
XOR AX,AX
JMP EXIT
@1F:
GET_ERROR
EXIT:
@EPILOG DOSQFILEMODE
_TEXT ENDS
END
|
Read Only/gdb-7.12.1/gdb/testsuite/gdb.ada/var_arr_typedef/var_arr_typedef.adb | samyvic/OS-Project | 0 | 25983 | -- Copyright 2015-2017 Free Software Foundation, Inc.
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
with Pack; use Pack;
procedure Var_Arr_Typedef is
RA : constant Rec_Type := (3, False);
RB : constant Rec_Type := (2, True);
VA : constant Vec_Type := (RA, RA, RB, RB);
VB : constant Vec_Type := (RB, RB, RA, RA);
A : constant Array_Type (1 .. Identity (4)) := (VA, VA, VB, VB);
begin
Do_Nothing (A); -- BREAK
end Var_Arr_Typedef;
|
Task/Generator-Exponential/Ada/generator-exponential-5.ada | LaudateCorpus1/RosettaCodeData | 1 | 13991 | with Ada.Text_IO;
with Generator.Filtered;
procedure Generator_Test is
function Square (X : Natural) return Natural is
begin
return X * X;
end Square;
function Cube (X : Natural) return Natural is
begin
return X * X * X;
end Cube;
G1, G2 : aliased Generator.Generator;
F : aliased Generator.Filtered.Filtered_Generator;
begin
G1.Set_Generator_Function (Func => Square'Unrestricted_Access);
G2.Set_Generator_Function (Func => Cube'Unrestricted_Access);
F.Set_Source (G1'Unrestricted_Access);
F.Set_Filter (G2'Unrestricted_Access);
F.Skip (20);
for I in 1 .. 10 loop
Ada.Text_IO.Put ("I:" & Integer'Image (I));
Ada.Text_IO.Put (", F:" & Integer'Image (F.Get_Next));
Ada.Text_IO.New_Line;
end loop;
end Generator_Test;
|
libsrc/_DEVELOPMENT/l/sccz80/8-gbz80/i32/l_long_neg_mhl.asm | ahjelm/z88dk | 4 | 242259 | ; Z88 Small C+ Run Time Library
; Long functions
;
; feilipu 10/2021
SECTION code_clib
SECTION code_l_sccz80
PUBLIC l_long_neg_mhl
;primary = - primary
;enter with primary in (hl)
.l_long_neg_mhl
ld a,0
sub a,(hl)
ld (hl+),a
ld a,0
sbc a,(hl)
ld (hl+),a
ld a,0
sbc a,(hl)
ld (hl+),a
ld a,0
sbc a,(hl)
ld (hl),a
ret
|
alloy4fun_models/trashltl/models/15/S3xSujqdYLGizBLra.als | Kaixi26/org.alloytools.alloy | 0 | 1223 | open main
pred idS3xSujqdYLGizBLra_prop16 {
all f: File | once f in Protected implies historically f in Protected
}
pred __repair { idS3xSujqdYLGizBLra_prop16 }
check __repair { idS3xSujqdYLGizBLra_prop16 <=> prop16o } |
orka/src/orka/implementation/orka-containers-ring_buffers.adb | onox/orka | 52 | 2574 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
package body Orka.Containers.Ring_Buffers is
function Length (Container : Buffer) return Natural is
(Container.Count);
function Is_Empty (Container : Buffer) return Boolean is
(Length (Container) = 0);
function Is_Full (Container : Buffer) return Boolean is
(Length (Container) = Container.Capacity);
procedure Add_Last (Container : in out Buffer; Element : Element_Type) is
begin
Container.Elements (Container.Head) := Element;
Container.Head := (Container.Head mod Container.Capacity) + 1;
Container.Count := Container.Count + 1;
end Add_Last;
function Remove_First (Container : in out Buffer) return Element_Type is
Result : constant Element_Type := Container.Elements (Container.Tail);
begin
-- Make position in buffer null to fix references in case Element_Type
-- is/contains a controlled type
Container.Elements (Container.Tail .. Container.Tail) := (others => <>);
Container.Tail := (Container.Tail mod Container.Capacity) + 1;
Container.Count := Container.Count - 1;
return Result;
end Remove_First;
end Orka.Containers.Ring_Buffers;
|
_tests/trconvert/antlr3/krl.g4 | SKalt/Domemtech.Trash | 16 | 1459 | grammar krl;
/*
This file is the grammar for the KUKA Robot Language.
Copyright (C) 2010-2011 <NAME>
This grammar 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 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
module
:
( moduleData
| moduleRoutines
)
EOF
;
moduleRoutines
: mainRoutine
( subRoutine
| NEWLINE
)*
;
mainRoutine
: procedureDefinition
| functionDefinition
;
subRoutine
: procedureDefinition
| functionDefinition
;
procedureDefinition
: GLOBAL? DEF procedureName formalParameters NEWLINE
routineBody
END
;
procedureName
: IDENTIFIER
;
functionDefinition
: GLOBAL? DEFFCT type functionName formalParameters NEWLINE
routineBody
ENDFCT
;
functionName
: IDENTIFIER
;
moduleData
: DEFDAT moduleName PUBLIC? NEWLINE
dataList
ENDDAT NEWLINE*
;
moduleName
: IDENTIFIER
;
dataList
: ( NEWLINE
| forwardDeclaration NEWLINE
| typeDeclaration NEWLINE
| variableDeclarationInDataList NEWLINE
| arrayInitialisation NEWLINE
| importStatement NEWLINE
)*
;
arrayInitialisation
: IDENTIFIER arrayVariableSuffix '=' unaryPlusMinuxExpression
;
typeDeclaration
: structureDefinition
| enumDefinition
;
structureDefinition
: GLOBAL?
STRUC
typeName
type variableName variableListRest
(',' type variableName variableListRest)*
;
enumDefinition
: GLOBAL?
ENUM
typeName
enumValue
(',' enumValue)*
;
enumValue
: IDENTIFIER
;
variableDeclaration
: DECL?
( type variableName variableListRest
| signalDeclaration
)
;
signalDeclaration
: SIGNAL IDENTIFIER primary ( TO primary )?
;
variableDeclarationInDataList
: DECL?
GLOBAL?
CONST?
( type variableName
( variableListRest
| variableInitialisation
)
| signalDeclaration
)
;
variableListRest
: (',' variableName)*
;
variableInitialisation
: '=' unaryPlusMinuxExpression
;
structLiteral
: '{'
( typeName ':' )?
structElementList
'}'
;
structElementList
: structElement
( ',' structElement)*
;
structElement
: variableName unaryPlusMinuxExpression
;
formalParameters
: '('
(
parameter
(',' parameter)*
)? ')'
;
parameter
: variableName ( parameterCallType )?
;
routineBody
: routineDataSection
routineImplementationSection
;
routineDataSection
:
( forwardDeclaration NEWLINE
| variableDeclaration NEWLINE
| NEWLINE
| importStatement NEWLINE
)*
;
forwardDeclaration
: EXT procedureName formalParametersWithType
| EXTFCT type functionName formalParametersWithType
;
formalParametersWithType
: '('
(
parameterWithType
(',' parameterWithType)*
)? ')'
;
parameterWithType
: type ( parameterCallType )?
;
parameterCallType
: ':' { input.LT(1).getText().toLowerCase().matches("in|out") }? IDENTIFIER
;
importStatement
: IMPORT
type
variableName
IS
'/R1/' moduleName '..' variableName
;
variableName
: IDENTIFIER
( arrayVariableSuffix
)?
;
// expression in arrays are optional: a string literal can be assigned to a char array as a whole
arrayVariableSuffix
:
'['
( expression
( ','
( expression
( ','
expression?
)?
)?
)?
)?
']'
;
routineImplementationSection
: statementList
;
statementList
: statement*
;
statement
: CONTINUE NEWLINE
| EXIT NEWLINE
| FOR IDENTIFIER '=' expression TO expression ({ input.LT(1).getText().equalsIgnoreCase("step") }? IDENTIFIER expression)? NEWLINE
statementList
ENDFOR
| GOTO IDENTIFIER NEWLINE
| HALT NEWLINE
| IF expression THEN NEWLINE
statementList
(ELSE NEWLINE
statementList)?
ENDIF NEWLINE
| LOOP NEWLINE
statementList
ENDLOOP NEWLINE
| REPEAT NEWLINE
statementList
UNTIL expression NEWLINE
| SWITCH expression NEWLINE
switchBlockStatementGroups
ENDSWITCH NEWLINE
| WAIT FOR expression NEWLINE
| WAIT SEC expression NEWLINE
| WHILE expression NEWLINE
statementList
ENDWHILE NEWLINE
| RETURN (assignmentExpression )? NEWLINE
| BRAKE ({ input.LT(1).getText().equalsIgnoreCase("f") }? IDENTIFIER)? NEWLINE
| assignmentExpression NEWLINE
| IDENTIFIER ':' NEWLINE
| NEWLINE
| GLOBAL? INTERRUPT DECL primary WHEN expression DO assignmentExpression NEWLINE
| INTERRUPT { input.LT(1).getText().toLowerCase().matches("on|off|disable|enable") }? IDENTIFIER primary? NEWLINE
| (PTP|PTP_REL) geometricExpression ( C_PTP ( C_DIS | C_ORI | C_VEL )? )? NEWLINE
| LIN geometricExpression ( C_DIS | C_ORI | C_VEL )? NEWLINE
| LIN_REL geometricExpression ( C_DIS | C_ORI | C_VEL )? enumElement? NEWLINE
| (CIRC|CIRC_REL) geometricExpression ',' geometricExpression (',' { input.LT(1).getText().equalsIgnoreCase("ca") }? IDENTIFIER primary)? ( C_DIS | C_ORI | C_VEL )? NEWLINE
| TRIGGER WHEN ({ input.LT(1).getText().equalsIgnoreCase("distance") }? IDENTIFIER) '=' expression DELAY '=' expression DO assignmentExpression ( PRIO '=' expression )? NEWLINE
| analogInputStatement NEWLINE
| analogOutputStatement NEWLINE
;
analogOutputStatement
: ANOUT
( { input.LT(1).getText().equalsIgnoreCase("on") }? IDENTIFIER assignmentExpression ({ input.LT(1).getText().toLowerCase().matches("delay|minimum|maximum") }? IDENTIFIER '=' literal)*
| { input.LT(1).getText().equalsIgnoreCase("off") }? IDENTIFIER IDENTIFIER
)
;
analogInputStatement
: ANIN
( { input.LT(1).getText().equalsIgnoreCase("on") }? IDENTIFIER assignmentExpression
| { input.LT(1).getText().equalsIgnoreCase("off") }? IDENTIFIER IDENTIFIER
)
;
switchBlockStatementGroups
: NEWLINE*
( caseLabel statementList )+
( defaultLabel statementList )?
;
caseLabel
: CASE expression ( ',' expression )* NEWLINE
;
defaultLabel
: DEFAULT NEWLINE
;
expressionList
: assignmentExpression
(',' assignmentExpression
)*
;
assignmentExpression
: expression ( '=' expression )*
;
expression
: conditionalOrExpression
(relationalOp conditionalOrExpression
)*
;
relationalOp
: '=='
| '<>'
| '<='
| '>='
| '<'
| '>'
;
conditionalOrExpression
: exclusiveOrExpression
( ( OR | B_OR ) exclusiveOrExpression
)*
;
exclusiveOrExpression
: conditionalAndExpression
( ( EXOR | B_EXOR ) conditionalAndExpression
)*
;
conditionalAndExpression
: additiveExpression
( ( AND | B_AND ) additiveExpression
)*
;
additiveExpression
: multiplicativeExpression
( ( '+' | '-' ) multiplicativeExpression )*
;
multiplicativeExpression
:
geometricExpression
(
( '*'
| '/'
)
geometricExpression
)*
;
geometricExpression
: unaryNotExpression
( ':' unaryNotExpression )*
;
unaryNotExpression
: NOT unaryNotExpression
| B_NOT unaryNotExpression
| unaryPlusMinuxExpression
;
unaryPlusMinuxExpression
: '+' unaryPlusMinuxExpression
| '-' unaryPlusMinuxExpression
| primary
;
primary
: parExpression
| variableName
( '.' variableName )*
( arguments)?
| literal
;
parExpression
: '(' assignmentExpression ')'
;
type
: primitiveType ( '[' (INTLITERAL)? ']' )?
| typeName ( '[' (INTLITERAL)? ']' )?
;
typeName
: IDENTIFIER
;
primitiveType
: BOOL
| CHAR
| INT
| REAL
;
arguments
: '(' (expressionList
)? ')'
;
literal
: INTLITERAL
| FLOATLITERAL
| CHARLITERAL
| STRINGLITERAL
| structLiteral
| TRUE
| FALSE
| enumElement
;
enumElement
: '#' IDENTIFIER
;
/********************************************************************************************
Lexer section
*********************************************************************************************/
//option {
// caseSensitive=false
// }
AND : A N D;
ANIN : A N I N;
ANOUT : A N O U T;
B_AND : B '_' A N D;
B_NOT : B '_' N O T;
B_OR : B '_' O R;
B_EXOR : B '_'E X O R;
BOOL : B O O L;
BRAKE : B R A K E;
C_DIS : C '_' D I S;
C_ORI : C '_' O R I;
C_PTP : C '_' P T P;
C_VEL : C '_' V E L;
CASE : C A S E;
CAST_FROM
: C A S T '_' F R O M;
CAST_TO : C A S T '_' T O;
CHAR : C H A R;
CIRC_REL: C I R C '_' R E L;
CIRC : C I R C;
CONST : C O N S T;
CONTINUE: C O N T I N U E;
DELAY : D E L A Y;
DECL : D E C L;
DEF : D E F;
DEFAULT : D E F A U L T;
DEFDAT : D E F D A T;
DEFFCT : D E F F C T;
DO : D O;
ELSE : E L S E;
END : E N D;
ENDDAT : E N D D A T;
ENDFCT : E N D F C T;
ENDFOR : E N D F O R;
ENDIF : E N D I F;
ENDLOOP : E N D L O O P;
ENDSWITCH
: E N D S W I T C H;
ENDWHILE: E N D W H I L E;
ENUM : E N U M;
EXIT : E X I T;
EXT : E X T;
EXTFCT : E X T F C T;
FALSE : F A L S E;
FOR : F O R;
GLOBAL : G L O B A L;
GOTO : G O T O;
HALT : H A L T;
IF : I F;
IMPORT : I M P O R T;
INTERRUPT
: I N T E R R U P T;
INT : I N T;
IS : I S;
LIN_REL : L I N '_' R E L;
LIN : L I N;
LOOP : L O O P;
MAXIMUM : M A X I M U M;
MINIMUM : M I N I M U M;
NOT : N O T;
OR : O R;
PRIO : P R I O;
PTP_REL : P T P '_' R E L;
PTP : P T P;
PUBLIC : P U B L I C;
REAL : R E A L;
REPEAT : R E P E A T;
RETURN : R E T U R N;
SEC : S E C;
SIGNAL : S I G N A L;
STRUC : S T R U C;
SWITCH : S W I T C H;
THEN : T H E N;
TO : T O;
TRIGGER : T R I G G E R;
TRUE : T R U E;
UNTIL : U N T I L;
WAIT : W A I T;
WHEN : W H E N;
WHILE : W H I L E;
EXOR : E X O R;
fragment A:('a'|'A');
fragment B:('b'|'B');
fragment C:('c'|'C');
fragment D:('d'|'D');
fragment E:('e'|'E');
fragment F:('f'|'F');
fragment G:('g'|'G');
fragment H:('h'|'H');
fragment I:('i'|'I');
fragment J:('j'|'J');
fragment K:('k'|'K');
fragment L:('l'|'L');
fragment M:('m'|'M');
fragment N:('n'|'N');
fragment O:('o'|'O');
fragment P:('p'|'P');
fragment Q:('q'|'Q');
fragment R:('r'|'R');
fragment S:('s'|'S');
fragment T:('t'|'T');
fragment U:('u'|'U');
fragment V:('v'|'V');
fragment W:('w'|'W');
fragment X:('x'|'X');
fragment Y:('y'|'Y');
fragment Z:('z'|'Z');
HEADERLINE
: '&' ~('\n'|'\r')* ('\r\n' | '\r' | '\n' | EOF)
{
skip();
}
;
WS
: (
' '
| '\t'
| '\u000C'
)
{
skip();
}
;
NEWLINE : '\r'? '\n' ;
LINE_COMMENT
: ';' ~('\n' | '\r')*
{
skip();
}
;
CHARLITERAL
: '\''
( EscapeSequence
| ~( '\'' | '\\' | '\r' | '\n' )
)
'\''
;
STRINGLITERAL
: '"'
( EscapeSequence
| ~( '\\' | '"' | '\r' | '\n' )
)*
'"'
;
fragment
EscapeSequence
: '\\' (
'b'
| 't'
| 'n'
| 'f'
| 'r'
| '\"'
| '\''
| '\\'
|
('0'..'3') ('0'..'7') ('0'..'7')
|
('0'..'7') ('0'..'7')
|
('0'..'7')
)
;
FLOATLITERAL
: ('0' .. '9')+ '.' ('0' .. '9')* Exponent?
| '.' ( '0' .. '9' )+ Exponent?
| ('0' .. '9')+ Exponent
;
fragment
Exponent
: E ( '+' | '-' )? ( '0' .. '9' )+
;
INTLITERAL
: ('0'..'9')+
| HexPrefix HexDigit+ HexSuffix
| BinPrefix BinDigit+ BinSuffix
;
fragment
HexPrefix
: '\'' H
;
fragment
HexDigit
: ('0'..'9'|'a'..'f'|'A'..'F')
;
fragment
HexSuffix
: '\''
;
fragment
BinPrefix
: '\'' B
;
fragment
BinDigit
: ('0' | '1')
;
fragment
BinSuffix
: '\''
;
IDENTIFIER
: IdentifierStart IdentifierPart*
;
fragment
IdentifierStart
: 'a'..'z'
| 'A'..'Z'
| '_'
| '$'
;
fragment
IdentifierPart
: IdentifierStart
| '0'..'9'
;
|
libsrc/_DEVELOPMENT/stdio/c/sccz80/ftrylockfile.asm | jpoikela/z88dk | 640 | 10260 | <gh_stars>100-1000
; int ftrylockfile (FILE *stream)
SECTION code_clib
SECTION code_stdio
PUBLIC ftrylockfile
EXTERN asm_ftrylockfile
ftrylockfile:
push hl
pop ix
jp asm_ftrylockfile
|
antlr/HBaseSQL.g4 | endlessc/hbase-sdk | 0 | 5443 | <reponame>endlessc/hbase-sdk
grammar HBaseSQL;
@header {
package com.github.CCwexiao.dsl.auto;
}
prog : inserthqlc # insertHqlCl
| selecthqlc # selectHqlCl
| deletehqlc # deleteHqlCl
;
inserthqlc : INSERT INTO tableName LB cidList RB VALUES insertValueList WHERE ROWKEY IS rowKeyExp ( TS IS tsexp ) ?
;
selecthqlc : SELECT selectCidList FROM tableName WHERE rowKeyRange? wherec? maxVersionExp? tsrange? limitExp?
;
deletehqlc : DELETE selectCidList FROM tableName WHERE rowKeyRange? wherec? ( TS IS tsexp ) ?
;
wherec: conditionc;
conditionc : LB conditionc RB # conditionwrapper
| conditionc AND conditionc # andcondition
| conditionc OR conditionc # orcondition
| cid EQUAL constant # equalconstant
| cid EQUAL var # equalvar
| cid LESS constant # lessconstant
| cid LESS var # lessvar
| cid GREATER constant # greaterconstant
| cid GREATER var # greatervar
| cid LESSEQUAL constant # lessequalconstant
| cid LESSEQUAL var # lessequalvar
| cid GREATEREQUAL constant # greaterequalconstant
| cid GREATEREQUAL var # greaterequalvar
| cid NOTEQUAL constant # notequalconstant
| cid NOTEQUAL var # notequalvar
| cid NOTMATCH constant # notmatchconstant
| cid NOTMATCH var # notmatchvar
| cid MATCH constant # matchconstant
| cid MATCH var # matchvar
| cid IN constantList # inconstantlist
| cid IN var # invarlist
| cid NOTIN constantList # notinconstantlist
| cid NOTIN var # notinvarlist
| cid BETWEEN constant AND constant # betweenconstant
| cid BETWEEN var AND var # betweenvar
| cid NOTBETWEEN constant AND constant # notbetweenconstant
| cid NOTBETWEEN var AND var # notbetweenvar
| cid ISNULL # isnullc
| cid ISNOTNULL # isnotnullc
| cid ISMISSING # ismissingc
| cid ISNOTMISSING # isnotmissingc
;
rowKeyRange : STARTKEY IS rowKeyExp ',' ENDKEY IS rowKeyExp # rowkeyrange_startAndEnd
| STARTKEY IS rowKeyExp # rowkeyrange_start
| ENDKEY IS rowKeyExp # rowkeyrange_end
| ROWKEY IS rowKeyExp # rowkeyrange_onerowkey
| ROWKEY IS rowKeyExp # rowkeyrange_insomekeys
;
rowKeyExp : LB rowKeyExp RB # rowkey_Wrapper
| funcname LB constant RB # rowkey_FuncConstant
| funcname IN LB constant ( ',' constant)* RB # rowkey_inRangeKey
| HBASESTARTKEY # rowkey_hbasestart
| HBASEENDKEY # rowkey_hbaseend
;
tsrange : LB STARTTS IS tsexp ',' ENDTS IS tsexp RB # tsrange_startAndEnd
| LB STARTTS IS tsexp RB # tsrange_start
| LB ENDTS IS tsexp RB # tsrange_end
;
tsexp: constant ;
selectCidList : cidList # cidList_CidList
| STAR # cidList_Star
| TEXT # cidList_Regx
;
cidList : cid (',' cid)* ;
cid : TEXT ;
funcname: TEXT # rowKey_FunctionName
;
constantList : LB constant ( ',' constant)* RB ;
insertValueList : LB insertValue ( ',' insertValue)* RB ;
insertValue: constant # insertValue_NotNull
| NULL # insertValue_Null
;
maxVersionExp : LB MAXVERSION IS maxversion RB
;
limitExp : LIMIT TEXT ( ',' TEXT)?
;
tableName : TEXT ;
maxversion : TEXT ;
constant: '\'' TEXT '\'';
var : '#' TEXT '#' ;
STAR : '*' ;
LB : '(' ;
RB : ')' ;
WHERE : 'where' | 'WHERE' ;
SELECT : 'select' | 'SELECT' ;
INSERT : 'insert' | 'INSERT' ;
DELETE : 'delete' | 'DELETE' ;
INTO : 'into' | 'INTO' ;
VALUES : 'values' | 'VALUES' ;
FROM : 'from' | 'FROM' ;
ROWKEY : 'rowkey' | 'rowKey' ;
STARTKEY : 'startkey' | 'startKey' ;
ENDKEY : 'endkey' | 'endKey' ;
HBASESTARTKEY : 'hbasestartkey';
HBASEENDKEY : 'hbaseendkey';
MAXVERSION : 'maxversion' | 'maxVersion' ;
LIMIT : 'limit' | 'LIMIT' ;
TS : 'ts' ;
STARTTS : 'startTS' ;
ENDTS : 'endTS' ;
IS : 'is' | 'IS';
NULL : 'null';
NOT : 'not' | 'NOT' ;
AND : 'and' | 'AND' ;
OR : 'or' | 'OR' ;
LESSEQUAL : 'lessequal' ;
LESS : 'less' ;
GREATEREQUAL : 'greaterequal';
GREATER: 'greater' ;
NOTEQUAL : 'notequal' ;
EQUAL : 'equal' ;
ENDER : ';' ;
NOTMATCH : 'notmatch' ;
MATCH : 'match' ;
IN : 'in' ;
NOTIN : 'notin' ;
BETWEEN : 'between' ;
NOTBETWEEN : 'notbetween' ;
ISNULL : 'isnull' ;
ISNOTNULL : 'isnotnull' ;
ISMISSING : 'ismissing' ;
ISNOTMISSING : 'isnotmissing' ;
TEXT : [a-zA-Z0-9_:*-+.,\\|=&^%$#@!~`()<>\r"]+ ;
SPACE: ( '\t' | ' ' | '\r' | '\n' )+ -> channel(HIDDEN);
COMMENT_INPUT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: (
('-- ' | '#') ~[\r\n]* ('\r'? '\n' | EOF)
| '--' ('\r'? '\n' | EOF)
) -> channel(HIDDEN); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.