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 |
|---|---|---|---|---|
day02/tests/intcode-test.adb | jwarwick/aoc_2019_ada | 0 | 17992 | <reponame>jwarwick/aoc_2019_ada<gh_stars>0
with AUnit.Assertions; use AUnit.Assertions;
with Ada.Containers;
use type Ada.Containers.Count_Type;
package body IntCode.Test is
procedure Test_Load (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
Assert(memory.length = 0, "Vector before load should be size 0, got: " & Ada.Containers.Count_Type'Image(memory.length));
load("99");
Assert(memory.length = 1, "Vector after load should be size 1, got: " & Ada.Containers.Count_Type'Image(memory.length));
Assert(memory(0) = 99, "First element of vector should be 99, got: " & Integer'Image(memory(0)));
load("16,42,0,-1");
Assert(memory.length = 4, "Vector after load should be size 4, got: " & Ada.Containers.Count_Type'Image(memory.length));
Assert(memory(0) = 16, "First element of vector should be 16, got: " & Integer'Image(memory(0)));
Assert(memory(1) = 42, "First element of vector should be 16, got: " & Integer'Image(memory(1)));
Assert(memory(2) = 0, "First element of vector should be 16, got: " & Integer'Image(memory(2)));
Assert(memory(3) = -1, "First element of vector should be 16, got: " & Integer'Image(memory(3)));
end Test_Load;
procedure Test_Poke (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
begin
load("16,42,0,-1");
Assert(memory.length = 4, "Vector after load should be size 4, got: " & Ada.Containers.Count_Type'Image(memory.length));
Assert(memory(0) = 16, "First element of vector should be 16, got: " & Integer'Image(memory(0)));
Assert(memory(1) = 42, "First element of vector should be 16, got: " & Integer'Image(memory(1)));
Assert(memory(2) = 0, "First element of vector should be 16, got: " & Integer'Image(memory(2)));
Assert(memory(3) = -1, "First element of vector should be 16, got: " & Integer'Image(memory(3)));
poke(0, -5);
Assert(memory(0) = -5, "Poked element of vector should be -5, got: " & Integer'Image(memory(0)));
-- XXX - test exception
-- poke(10, 11);
Assert(peek(3) = -1, "Peeking element of vector should be -1, got: " & Integer'Image(memory(3)));
end Test_Poke;
procedure Test_Eval (T : in out AUnit.Test_Cases.Test_Case'Class) is
pragma Unreferenced (T);
type Memory_Array is array(Integer range <>) of Integer;
function to_memory(a : Memory_Array) return Memory_Vector.Vector is
m : Memory_Vector.Vector;
begin
for val of a loop
m.append(val);
end loop;
return m;
end to_memory;
procedure eval_test(input : in Memory_Array; expected : in Memory_Array; desc : in String) is
use type Memory_Vector.Vector;
m : Memory_Vector.Vector := to_memory(input);
e : Memory_Vector.Vector := to_memory(expected);
begin
memory := m;
eval;
Assert(memory = e, desc & ", got: " & dump);
end eval_test;
begin
eval_test((1, 0, 0, 0, 99), (2, 0, 0, 0, 99), "Simple add test");
eval_test((2,3,0,3,99), (2,3,0,6,99), "Simple mult test");
eval_test((2,4,4,5,99,0), (2,4,4,5,99,9801), "Bigger mult test");
eval_test((1,1,1,4,99,5,6,0,99), (30,1,1,4,2,5,6,0,99), "Multiple write test");
end Test_Eval;
function Name (T : Test) return AUnit.Message_String is
pragma Unreferenced (T);
begin
return AUnit.Format ("IntCode Package");
end Name;
procedure Register_Tests (T : in out Test) is
use AUnit.Test_Cases.Registration;
begin
Register_Routine (T, Test_Load'Access, "Loading");
Register_Routine (T, Test_Poke'Access, "Peek/Poke");
Register_Routine (T, Test_Eval'Access, "Evaluation");
end Register_Tests;
end IntCode.Test;
|
oap-template/src/main/antlr4/TemplateLexerExpression.g4 | oaplatform/oap-core | 9 | 1286 | lexer grammar TemplateLexerExpression;
import TemplateLexerBasic;
fragment Ws : Hws | Vws ;
fragment Hws : [ \t] ;
fragment Vws : [\r\n\f] ;
fragment BlockComment : '/*' .*? ('*/' | EOF) ;
fragment Esc : '\\' ;
fragment SQuote : '\'' ;
fragment DQuote : '"' ;
fragment Underscore : '_' ;
fragment Comma : ',' ;
fragment Semi : ';' ;
fragment Pipe : '|' ;
fragment Dot : '.' ;
fragment LParen : '(' ;
fragment RParen : ')' ;
fragment LBrack : '[' ;
fragment RBrack : ']' ;
fragment Star : '*' ;
fragment Slash : '/' ;
fragment Percent : '%' ;
fragment Plus : '+' ;
fragment Minus : '-' ;
fragment DQuestion : '??' ;
fragment NameChar
: [A-Z]
| [a-z]
| '\u00C0'..'\u00D6'
| '\u00D8'..'\u00F6'
| '\u00F8'..'\u02FF'
| '\u0370'..'\u037D'
| '\u037F'..'\u1FFF'
| '\u200C'..'\u200D'
| '\u2070'..'\u218F'
| '\u2C00'..'\u2FEF'
| '\u3001'..'\uD7FF'
| '\uF900'..'\uFDCF'
| '\uFDF0'..'\uFFFD'
| Underscore
| '\u00B7'
| '\u0300'..'\u036F'
| '\u203F'..'\u2040'
;
fragment EscSeq
: Esc
( [btnfr"'\\] // The standard escaped character set such as tab, newline, etc.
| UnicodeEsc // A Unicode escape sequence
| . // Invalid escape character
| EOF // Incomplete at EOF
)
;
fragment UnicodeEsc
: 'u' (HexDigit (HexDigit (HexDigit HexDigit?)?)?)?
;
fragment SQuoteLiteral : SQuote ( EscSeq | ~['\r\n\\] )* SQuote ;
fragment DQuoteLiteral : DQuote ( EscSeq | ~["\r\n\\] )* DQuote ;
fragment BoolLiteral : True | False ;
fragment HexDigit : [0-9a-fA-F] ;
fragment DecDigit : [0-9] ;
fragment DecDigits : DecDigit+ ;
fragment Float : DecDigits Dot DecDigits? ;
fragment True : 'true' ;
fragment False : 'false' ;
BLOCK_COMMENT : BlockComment;
HORZ_WS : Hws+ -> skip ;
VERT_WS : Vws+ -> skip ;
LBRACE : LBrace -> pushMode(Concatenation) ;
RBRACE : RBrace -> popMode ;
PIPE : Pipe ;
DOT : Dot ;
LPAREN : LParen ;
RPAREN : RParen ;
LBRACK : LBrack ;
RBRACK : RBrack ;
DQUESTION : DQuestion ;
SEMI : Semi ;
COMMA : Comma ;
STAR : Star ;
SLASH : Slash ;
PERCENT : Percent ;
PLUS : Plus ;
MINUS : Minus ;
DSTRING : DQuoteLiteral ;
SSTRING : SQuoteLiteral ;
DECDIGITS : DecDigits ;
FLOAT : Float ;
BOOLEAN : BoolLiteral ;
ID : NameChar (NameChar|DecDigit)* ;
ERR_CHAR : (' '|'\t') -> skip ;
mode Concatenation ;
C_HORZ_WS : Hws+ -> skip ;
C_VERT_WS : Vws+ -> skip ;
CRBRACE : RBrace -> popMode, type(RBRACE) ;
CCOMMA : Comma -> type(COMMA) ;
CID : NameChar (NameChar|DecDigit)* -> type(ID);
CDSTRING : DQuoteLiteral -> type(DSTRING) ;
CSSTRING : SQuoteLiteral -> type(SSTRING) ;
CDECDIGITS : DecDigits -> type(DECDIGITS) ;
CFLOAT : Float -> type(FLOAT) ;
CERR_CHAR : (' '|'\t') -> skip ;
|
test/inference/kernel/fp16/igemm_fwd_btm_nhwc_fp16.asm | aska-0096/iGEMMgen | 20 | 104141 | <reponame>aska-0096/iGEMMgen
; pay attention to register bank of v_c, v_b
.macro .fma_1x16_fp16 v_c, v_a, v_b
v_dot2c_f32_f16 v[\v_c+0 ], v[\v_a], v[\v_b+0 ]
v_dot2c_f32_f16 v[\v_c+1 ], v[\v_a], v[\v_b+1 ]
v_dot2c_f32_f16 v[\v_c+2 ], v[\v_a], v[\v_b+2 ]
v_dot2c_f32_f16 v[\v_c+3 ], v[\v_a], v[\v_b+3 ]
v_dot2c_f32_f16 v[\v_c+4 ], v[\v_a], v[\v_b+4 ]
v_dot2c_f32_f16 v[\v_c+5 ], v[\v_a], v[\v_b+5 ]
v_dot2c_f32_f16 v[\v_c+6 ], v[\v_a], v[\v_b+6 ]
v_dot2c_f32_f16 v[\v_c+7 ], v[\v_a], v[\v_b+7 ]
v_dot2c_f32_f16 v[\v_c+8 ], v[\v_a], v[\v_b+8 ]
v_dot2c_f32_f16 v[\v_c+9 ], v[\v_a], v[\v_b+9 ]
v_dot2c_f32_f16 v[\v_c+10], v[\v_a], v[\v_b+10]
v_dot2c_f32_f16 v[\v_c+11], v[\v_a], v[\v_b+11]
v_dot2c_f32_f16 v[\v_c+12], v[\v_a], v[\v_b+12]
v_dot2c_f32_f16 v[\v_c+13], v[\v_a], v[\v_b+13]
v_dot2c_f32_f16 v[\v_c+14], v[\v_a], v[\v_b+14]
v_dot2c_f32_f16 v[\v_c+15], v[\v_a], v[\v_b+15]
.endm
.macro .fma_1x8_fp16 v_c, v_a, v_b
v_dot2c_f32_f16 v[\v_c+0 ], v[\v_a], v[\v_b+0 ]
v_dot2c_f32_f16 v[\v_c+1 ], v[\v_a], v[\v_b+1 ]
v_dot2c_f32_f16 v[\v_c+2 ], v[\v_a], v[\v_b+2 ]
v_dot2c_f32_f16 v[\v_c+3 ], v[\v_a], v[\v_b+3 ]
v_dot2c_f32_f16 v[\v_c+4 ], v[\v_a], v[\v_b+4 ]
v_dot2c_f32_f16 v[\v_c+5 ], v[\v_a], v[\v_b+5 ]
v_dot2c_f32_f16 v[\v_c+6 ], v[\v_a], v[\v_b+6 ]
v_dot2c_f32_f16 v[\v_c+7 ], v[\v_a], v[\v_b+7 ]
.endm
.macro .fma_1x4_fp16 v_c, v_a, v_b
v_dot2c_f32_f16 v[\v_c+0 ], v[\v_a], v[\v_b+0 ]
v_dot2c_f32_f16 v[\v_c+1 ], v[\v_a], v[\v_b+1 ]
v_dot2c_f32_f16 v[\v_c+2 ], v[\v_a], v[\v_b+2 ]
v_dot2c_f32_f16 v[\v_c+3 ], v[\v_a], v[\v_b+3 ]
.endm
.macro .mdiv_u32_ss s_quot s_numer s_magic s_shift s_tmp
s_mul_hi_u32 s[\s_tmp], s[\s_magic], s[\s_numer]
s_add_u32 s[\s_tmp], s[\s_tmp], s[\s_numer]
s_lshr_b32 s[\s_quot], s[\s_tmp], s[\s_shift]
.endm
.macro .mdiv_u32_rem_ss s_rem s_quot s_numer s_magic s_shift s_denom s_tmp
.mdiv_u32_ss \s_quot,\s_numer,\s_magic,\s_shift,\s_tmp
s_mul_i32 s[\s_tmp], s[\s_denom], s[\s_quot]
s_sub_u32 s[\s_rem], s[\s_numer], s[\s_tmp]
.endm
.macro .mdiv_u32_vs v_quot v_numer s_magic s_shift v_tmp
v_mul_hi_u32 v[\v_tmp], s[\s_magic], v[\v_numer]
v_add_nc_u32 v[\v_tmp], v[\v_tmp], v[\v_numer]
v_lshrrev_b32 v[\v_quot], s[\s_shift], v[\v_tmp]
.endm
.macro .mdiv_u32_rem_vs v_rem v_quot v_numer s_magic s_shift s_denom v_tmp
.mdiv_u32_vs \v_quot,\v_numer,\s_magic,\s_shift,\v_tmp
v_mul_lo_u32 v[\v_tmp], s[\s_denom], v[\v_quot]
v_sub_nc_u32 v[\v_rem], v[\v_numer], v[\v_tmp]
.endm
.macro .v_clear_nc vid, num
_v = \vid
.rept \num
v_mov_b32 v[_v], 0
_v = _v + 1
.endr
.endm
.macro exp_f_float base, sign, vtmp //e^x = 2^(xlog2e)
.if \sign < 0
v_mov_b32 v[\vtmp], 0xbfb8aa3b //-log2e
.else
v_mov_b32 v[\vtmp], 0x3fb8aa3b //log2e
.endif
v_mul_f32 v[\base], v[\base], v[\vtmp]
v_exp_f32 v[\base], v[\base]
.endm
.macro ln_f_float base, vtmp // ln(x) = log2x * 1 / (log2e)
v_log_f32 v[\base], v[\base]
v_mov_b32 v[\vtmp], 0x3f317218 // 1/(log2e)
v_mul_f32 v[\base], v[\base], v[\vtmp]
.endm
MIOPEN_NEURON_PASTHRU = 0 // x
MIOPEN_NEURON_LOGISTIC = 1 // 1 / (1 + e^-x) //Sigmoid
MIOPEN_NEURON_TANH = 2 // beta * tanh(alpha * x)
MIOPEN_NEURON_RELU = 3 // max(0, x)
MIOPEN_NEURON_SOFTRELU = 4 // log(1 + e^x) // bonomial normal log likelihood
MIOPEN_NEURON_ABS = 5 // abs(x)
MIOPEN_NEURON_POWER = 6 // (alpha + beta * x )^gamma
MIOPEN_NEURON_CLIPPED_RELU = 7 // min(alpha, max(0, x))
MIOPEN_NEURON_LEAKY_RELU = 8 // alpha * x | x <= 0; x | x > 0
MIOPEN_NEURON_ELU = 9 // alpha * (e^x - 1) | x <= 0; x | x > 0
.ifnotdef activ_mode
activ_mode = MIOPEN_NEURON_PASTHRU
.endif
EPSILON_float = 0x358637bd
.macro .activ_f32 base, activ_mode, alpha, beta, gamma, vtmp0, vtmp1
.if \activ_mode == MIOPEN_NEURON_LOGISTIC //1 / (1 + e^-x)
exp_f_float \base, -1, \vtmp0
v_add_f32 v[\base], 1.0, v[\base]
v_rcp_f32 v[\base], v[\base]
.elseif \activ_mode == MIOPEN_NEURON_TANH // \beta * tanh(\alpha * x)
v_mul_f32 v[\base], s[\alpha], v[\base]
v_mul_f32 v[\base], 2.0, v[\base]
exp_f_float \base, 1, \vtmp0
v_add_f32 v[\base], 1.0, v[\base]
v_rcp_f32 v[\base], v[\base]
v_mul_f32 v[\base], 2.0, v[\base]
v_sub_f32 v[\base], 1.0, v[\base]
v_mov_b32 v[\vtmp0], 1.0
v_mul_f32 v[\base], s[\beta], v[\base]
.elseif \activ_mode == MIOPEN_NEURON_RELU //max(0, x)
v_max_f32 v[\base], v[\base], 0
.elseif \activ_mode == MIOPEN_NEURON_SOFTRELU //log(1 + e^x)
exp_f_float \base, 1, \vtmp0
v_add_f32 v[\base], 1.0, v[\base]
ln_f_float \base, \vtmp0
.elseif \activ_mode == MIOPEN_NEURON_ABS //abs(x)
v_max_f32 v[\base], v[\base], -v[\base]
.elseif \activ_mode == MIOPEN_NEURON_POWER //(\alpha + \beta * x )^\gamma
v_mul_f32 v[\base], s[\beta], v[\base]
v_add_f32 v[\base], s[\alpha], v[\base]
v_mov_b32 v[\vtmp0], v[\base]
v_log_f32 v[\base], v[\base]
v_mul_f32 v[\base], s[\gamma], v[\base]
v_exp_f32 v[\base], v[\base]
v_cmp_lt_f32 EPSILON_float, v[\vtmp0]
v_cndmask_b32 v[\base], 0, v[\base]
.elseif \activ_mode == MIOPEN_NEURON_CLIPPED_RELU //min(\alpha, max(0, x))
v_max_f32 v[\base], v[\base], 0
v_min_f32 v[\base], s[\alpha], v[\base]
.elseif \activ_mode == MIOPEN_NEURON_LEAKY_RELU //\alpha * x | x <= 0; x | x > 0
v_cmp_lt_f32 0, v[\base]
v_mov_b32 v[\vtmp0], s[\alpha]
v_cndmask_b32 v[\vtmp0], v[\vtmp0], 1.0
v_mul_f32 v[\base], v[\base], v[\vtmp0]
.elseif \activ_mode == MIOPEN_NEURON_ELU //\alpha * (e^x - 1) | x <= 0; x | x > 0
v_cmp_lt_f32 0, v[\base]
v_mov_b32 v[\vtmp1], v[\base]
exp_f_float \base, 1, \vtmp0
v_add_f32 v[\base], -1.0, v[\base]
v_mul_f32 v[\base], s[\alpha], v[\base]
v_cndmask_b32 v[\base], v[\base], v[\vtmp1]
.endif
.endm
.macro .activ_int32 base, activ_mode, alpha, beta, gamma, vtmp0, vtmp1
v_cvt_f32_i32 v[\base], v[\base]
.activ_f32 \base, \activ_mode, \alpha, \beta, \gamma, \vtmp0, \vtmp1
v_cvt_i32_f32 v[\base], v[\base]
.endm
.include "igemm_fwd_btm_nhwc_fp16_128x004.asm"
.include "igemm_fwd_btm_nhwc_fp16_128x016.asm"
.include "igemm_fwd_btm_nhwc_fp16_256x004.asm"
.include "igemm_fwd_btm_nhwc_fp16_256x016.asm"
.include "igemm_fwd_btm_nhwc_fp16_256x008.asm"
.include "igemm_fwd_btm_nhwc_fp16_384x004.asm"
.include "igemm_fwd_btm_nhwc_fp16_512x004.asm"
.include "igemm_fwd_btm_nhwc_fp16_512x008.asm"
.include "igemm_fwd_btm_nhwc_fp16_1024x008.asm"
.amdgpu_metadata
---
amdhsa.version: [ 1, 0 ]
amdhsa.kernels:
- .name: igemm_fwd_btm_nhwc_fp16_128x4x16_r2
.symbol: igemm_fwd_btm_nhwc_fp16_128x4x16_r2.kd
.sgpr_count: 68
.vgpr_count: 88
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [64, 1, 1]
.max_flat_workgroup_size: 64
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_128x16x16_r3
.symbol: igemm_fwd_btm_nhwc_fp16_128x16x16_r3.kd
.sgpr_count: 68
.vgpr_count: 74
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 13056
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_256x4x16_r1
.symbol: igemm_fwd_btm_nhwc_fp16_256x4x16_r1.kd
.sgpr_count: 68
.vgpr_count: 112
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 13056
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_256x16x16_r3
.symbol: igemm_fwd_btm_nhwc_fp16_256x16x16_r3.kd
.sgpr_count: 68
.vgpr_count: 112
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 13056
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_256x8x16_r2
.symbol: igemm_fwd_btm_nhwc_fp16_256x8x16_r2.kd
.sgpr_count: 68
.vgpr_count: 128
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 4096
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_256x8x8_r2
.symbol: igemm_fwd_btm_nhwc_fp16_256x8x8_r2.kd
.sgpr_count: 68
.vgpr_count: 124
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [64, 1, 1]
.max_flat_workgroup_size: 64
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_384x4x16_r1
.symbol: igemm_fwd_btm_nhwc_fp16_384x4x16_r1.kd
.sgpr_count: 68
.vgpr_count: 114
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_512x4x16_r1
.symbol: igemm_fwd_btm_nhwc_fp16_512x4x16_r1.kd
.sgpr_count: 68
.vgpr_count: 140
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_512x8x16_r2
.symbol: igemm_fwd_btm_nhwc_fp16_512x8x16_r2.kd
.sgpr_count: 68
.vgpr_count: 188
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 4096
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_512x8x8_r1
.symbol: igemm_fwd_btm_nhwc_fp16_512x8x8_r1.kd
.sgpr_count: 68
.vgpr_count: 124
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
- .name: igemm_fwd_btm_nhwc_fp16_1024x8x8_r1
.symbol: igemm_fwd_btm_nhwc_fp16_1024x8x8_r1.kd
.sgpr_count: 68
.vgpr_count: 212
.kernarg_segment_align: 8
.kernarg_segment_size: 128
.group_segment_fixed_size: 2048
.private_segment_fixed_size: 0
.wavefront_size: 32
.reqd_workgroup_size : [128, 1, 1]
.max_flat_workgroup_size: 128
.args:
- { .name: p_in , .size: 8, .offset: 0, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_wei , .size: 8, .offset: 8, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: true}
- { .name: p_out , .size: 8, .offset: 16, .value_kind: global_buffer, .value_type: f32, .address_space: global, .is_const: false}
- { .name: hi , .size: 4, .offset: 24, .value_kind: by_value, .value_type: i32}
- { .name: wi , .size: 4, .offset: 28, .value_kind: by_value, .value_type: i32}
- { .name: n , .size: 4, .offset: 32, .value_kind: by_value, .value_type: i32}
- { .name: k , .size: 4, .offset: 36, .value_kind: by_value, .value_type: i32}
- { .name: c , .size: 4, .offset: 40, .value_kind: by_value, .value_type: i32}
- { .name: ho , .size: 4, .offset: 44, .value_kind: by_value, .value_type: i32}
- { .name: wo , .size: 4, .offset: 48, .value_kind: by_value, .value_type: i32}
- { .name: stride_h , .size: 4, .offset: 52, .value_kind: by_value, .value_type: i32}
- { .name: stride_w , .size: 4, .offset: 56, .value_kind: by_value, .value_type: i32}
- { .name: dilation_h, .size: 4, .offset: 60, .value_kind: by_value, .value_type: i32}
- { .name: dilation_w, .size: 4, .offset: 64, .value_kind: by_value, .value_type: i32}
- { .name: pad_h , .size: 4, .offset: 68, .value_kind: by_value, .value_type: i32}
- { .name: pad_w , .size: 4, .offset: 72, .value_kind: by_value, .value_type: i32}
- { .name: y , .size: 4, .offset: 76, .value_kind: by_value, .value_type: i32}
- { .name: x , .size: 4, .offset: 80, .value_kind: by_value, .value_type: i32}
- { .name: group , .size: 4, .offset: 84, .value_kind: by_value, .value_type: i32}
- { .name: batch_m , .size: 4, .offset: 88, .value_kind: by_value, .value_type: i32}
- { .name: stride_m , .size: 4, .offset: 92, .value_kind: by_value, .value_type: i32}
- { .name: alpha , .size: 4, .offset: 96, .value_kind: by_value, .value_type: f32}
- { .name: beta , .size: 4, .offset: 100, .value_kind: by_value, .value_type: f32}
- { .name: gamma , .size: 4, .offset: 104, .value_kind: by_value, .value_type: f32}
- { .name: magic_0 , .size: 4, .offset: 108, .value_kind: by_value, .value_type: i32}
- { .name: magic_1 , .size: 4, .offset: 112, .value_kind: by_value, .value_type: i32}
- { .name: magic_2 , .size: 4, .offset: 116, .value_kind: by_value, .value_type: i32}
- { .name: shift_pack_0, .size: 4, .offset: 120, .value_kind: by_value, .value_type: i32}
- { .name: __pack_0 , .size: 4, .offset: 124, .value_kind: by_value, .value_type: i32}
...
.end_amdgpu_metadata
|
ch9.agda | asajeffrey/tapl | 3 | 4064 | <filename>ch9.agda
{-# OPTIONS --rewriting #-}
open import prelude renaming (_≟Nat_ to _≟_)
-- Copied pretty much verbatim
Var = Nat
data Term : Set where
var : Var → Term
fun : Term → Term
_$_ : Term → Term → Term
true : Term
false : Term
if_then_else_end : Term → Term → Term → Term
data VarHeaded : Term → Set
data Value : Term → Set
data VarHeaded where
var : (x : Var) → VarHeaded(var x)
_$_ : ∀ {t} → VarHeaded(t) → (u : Term) → VarHeaded(t $ u)
if_then_else_end : ∀ {t₀} → VarHeaded(t₀) → (t₁ t₂ : Term) → VarHeaded(if t₀ then t₁ else t₂ end)
data Value where
var : (x : Var) → Value(var x)
fun : (t : Term) → Value(fun t)
_$_ : ∀ {t} → VarHeaded(t) → (u : Term) → Value(t $ u)
if_then_else_end : ∀ {t₀} → VarHeaded(t₀) → (t₁ t₂ : Term) → Value(if t₀ then t₁ else t₂ end)
true : Value true
false : Value false
-- Substitution
shift : Var → Var → Term → Term
shift c d (var x) = if (c ≤? x) (var (d + x)) (var x)
shift c d (fun t) = fun (shift (1 + c) d t)
shift c d (t₁ $ t₂) = (shift c d t₁) $ (shift c d t₂)
shift c d true = true
shift c d false = false
shift c d if t₀ then t₁ else t₂ end = if shift c d t₀ then shift c d t₁ else shift c d t₂ end
[_↦_]_ : Var → Term → Term → Term
[ x ↦ s ] var y = if (x ≟ y) (shift 0 x s) (if (x ≤? y) (var (y - 1)) (var y))
[ x ↦ s ] fun t = fun ([ (1 + x) ↦ s ] t)
[ x ↦ s ] (t₁ $ t₂) = ([ x ↦ s ] t₁) $ ([ x ↦ s ] t₂)
[ x ↦ s ] true = true
[ x ↦ s ] false = false
[ x ↦ s ] if t₀ then t₁ else t₂ end = if [ x ↦ s ] t₀ then [ x ↦ s ] t₁ else [ x ↦ s ] t₂ end
-- Reduction
data _⟶_ : Term → Term → Set where
E─IfTrue : ∀ {t₂ t₃} →
-----------------------------------
if true then t₂ else t₃ end ⟶ t₂
E─IfFalse : ∀ {t₂ t₃} →
-----------------------------------
if false then t₂ else t₃ end ⟶ t₃
E─IfCong : ∀ {t₁ t₁′ t₂ t₃} →
(t₁ ⟶ t₁′) →
----------------------------------------------------------
(if t₁ then t₂ else t₃ end ⟶ if t₁′ then t₂ else t₃ end)
E─App1 : ∀ {t₁ t₁′ t₂} →
(t₁ ⟶ t₁′) →
------------------------
(t₁ $ t₂) ⟶ (t₁′ $ t₂)
E─App2 : ∀ {t₁ t₂ t₂′} →
(t₂ ⟶ t₂′) →
------------------------
(t₁ $ t₂) ⟶ (t₁ $ t₂′)
E─AppAbs : ∀ {t₁ t₂} →
---------------------------------
(fun t₁ $ t₂) ⟶ ([ 0 ↦ t₂ ] t₁)
data Redex : Term → Set where
redex : ∀ {t t′} →
t ⟶ t′ →
--------
Redex(t)
-- Types
data Type : Set where
bool : Type
_⇒_ : Type → Type → Type
data Context : Set where
ε : Context
_,_ : Context → Type → Context
data _∋_⦂_ : Context → Nat → Type → Set where
zero : ∀ {Γ S} → (Γ , S) ∋ zero ⦂ S
suc : ∀ {Γ S T n} → (Γ ∋ n ⦂ T) → (Γ , S) ∋ suc n ⦂ T
data _⊢_⦂_ : Context → Term → Type → Set where
T-True : ∀ {Γ} →
-----------
Γ ⊢ true ⦂ bool
T-False : ∀ {Γ} →
-----------
Γ ⊢ false ⦂ bool
T-If : ∀ {Γ t₁ t₂ t₃ T} →
Γ ⊢ t₁ ⦂ bool →
Γ ⊢ t₂ ⦂ T →
Γ ⊢ t₃ ⦂ T →
-----------------------------
Γ ⊢ if t₁ then t₂ else t₃ end ⦂ T
T-Var : ∀ {Γ n T} →
Γ ∋ n ⦂ T →
------------------------
Γ ⊢ var n ⦂ T
T-Abs : ∀ {Γ t T₁ T₂} →
(Γ , T₁) ⊢ t ⦂ T₂ →
-----------------------
Γ ⊢ (fun t) ⦂ (T₁ ⇒ T₂)
T-App : ∀ {Γ t₁ t₂ T₁₁ T₁₂} →
Γ ⊢ t₁ ⦂ (T₁₁ ⇒ T₁₂) →
Γ ⊢ t₂ ⦂ T₁₁ →
-----------------------
Γ ⊢ (t₁ $ t₂) ⦂ T₁₂
-- Proving that well-typed terms stay well-typed
# : Context → Nat
# ε = 0
# (Γ , x) = 1 + # Γ
_,,_ : Context → Context → Context
Γ ,, ε = Γ
Γ ,, (Δ , T) = (Γ ,, Δ) , T
T-Eq : ∀ {Γ s S T} → (Γ ⊢ s ⦂ S) → (S ≡ T) → (Γ ⊢ s ⦂ T)
T-Eq p refl = p
hit : ∀ {Γ Δ S T} → (((Γ , S) ,, Δ) ∋ # Δ ⦂ T) → (S ≡ T)
hit {Δ = ε} zero = refl
hit {Δ = Δ , R} (suc p) = hit p
left : ∀ {Γ Δ S T n} → (# Δ < n) → (((Γ , S) ,, Δ) ∋ n ⦂ T) → ((Γ ,, Δ) ∋ (n - 1) ⦂ T)
left {n = zero} p q = CONTRADICTION (p zero)
left {Δ = ε} {n = suc n} p (suc q) = q
left {Δ = Δ , R} {n = suc zero} p (suc q) = CONTRADICTION (p (suc zero))
left {Δ = Δ , R} {n = suc (suc n)} p (suc q) = suc (left (λ a → p (suc a)) q)
right : ∀ {Γ Δ S T n} → (n < # Δ) → (((Γ , S) ,, Δ) ∋ n ⦂ T) → ((Γ ,, Δ) ∋ n ⦂ T)
right {Δ = ε} p q = CONTRADICTION (p zero)
right {Δ = Δ , R} p zero = zero
right {Δ = Δ , R} p (suc q) = suc (right (λ z → p (suc z)) q)
this : ∀ {Γ T} n Δ Ξ → (# Ξ ≤ n) → ((Γ ,, Ξ) ∋ n ⦂ T) → (((Γ ,, Δ) ,, Ξ) ∋ (# Δ + n) ⦂ T)
this n ε ε p q = q
this n (Δ , R) ε p q = suc (this n Δ ε p q)
this (suc n) Δ (Ξ , S) (suc p) (suc q) = suc (this n Δ Ξ p q)
that : ∀ {Γ T} n Δ Ξ → (n < # Ξ) → ((Γ ,, Ξ) ∋ n ⦂ T) → (((Γ ,, Δ) ,, Ξ) ∋ n ⦂ T)
that n Δ ε p q = CONTRADICTION (p zero)
that zero Δ (Ξ , S) p zero = zero
that (suc n) Δ (Ξ , S) p (suc q) = suc (that n Δ Ξ (λ z → p (suc z)) q)
preservation-shift : ∀ {Γ s S} Δ Ξ → ((Γ ,, Ξ) ⊢ s ⦂ S) → (((Γ ,, Δ) ,, Ξ) ⊢ shift (# Ξ) (# Δ) s ⦂ S)
preservation-shift Δ Ξ T-True = T-True
preservation-shift Δ Ξ T-False = T-False
preservation-shift Δ Ξ (T-If p p₁ p₂) = T-If (preservation-shift Δ Ξ p) (preservation-shift Δ Ξ p₁)
(preservation-shift Δ Ξ p₂)
preservation-shift {Γ} {var n} {S} Δ Ξ (T-Var p) = helper (# Ξ ≤? n) where
helper : (q : Dec(# Ξ ≤ n)) → ((Γ ,, Δ) ,, Ξ) ⊢ if q (var (# Δ + n)) (var n) ⦂ S
helper (yes q) = T-Var (this n Δ Ξ q p)
helper (no q) = T-Var (that n Δ Ξ q p)
preservation-shift Δ Ξ (T-Abs p) = T-Abs (preservation-shift Δ (Ξ , _) p)
preservation-shift Δ Ξ (T-App p p₁) = T-App (preservation-shift Δ Ξ p) (preservation-shift Δ Ξ p₁)
preservation-substitution : ∀ {Γ s t S T} → (Γ ⊢ s ⦂ S) → (Δ : Context) → (((Γ , S) ,, Δ) ⊢ t ⦂ T) → ((Γ ,, Δ) ⊢ [ # Δ ↦ s ] t ⦂ T)
preservation-substitution {Γ} {s} {t} {S} {T} p Δ (T-Var {n = n} q) = helper (# Δ ≟ n) (# Δ ≤? n) where
helper : (p : Dec(# Δ ≡ n)) → (q : Dec(# Δ ≤ n)) → (Γ ,, Δ) ⊢ if p (shift 0 (# Δ) s) (if q (var (n - 1)) (var n)) ⦂ T
helper (yes refl) _ = T-Eq (preservation-shift Δ ε p) (hit q)
helper (no a) (yes b) = T-Var (left (λ c → a (asym b c)) q)
helper (no a) (no b) = T-Var (right b q)
preservation-substitution p Δ T-True = T-True
preservation-substitution p Δ T-False = T-False
preservation-substitution p Δ (T-If q q₁ q₂) = T-If (preservation-substitution p Δ q)
(preservation-substitution p Δ q₁)
(preservation-substitution p Δ q₂)
preservation-substitution p Δ (T-Abs q) = T-Abs (preservation-substitution p (Δ , _) q)
preservation-substitution p Δ (T-App q q₁) = T-App (preservation-substitution p Δ q)
(preservation-substitution p Δ q₁)
preservation : ∀ {Γ t t′ T} → (Γ ⊢ t ⦂ T) → (t ⟶ t′) → (Γ ⊢ t′ ⦂ T)
preservation (T-If p₁ p₂ p₃) E─IfTrue = p₂
preservation (T-If p₁ p₂ p₃) E─IfFalse = p₃
preservation (T-If p₁ p₂ p₃) (E─IfCong q) = T-If (preservation p₁ q) p₂ p₃
preservation (T-App p₁ p₂) (E─App1 q) = T-App (preservation p₁ q) p₂
preservation (T-App p₁ p₂) (E─App2 q) = T-App p₁ (preservation p₂ q)
preservation (T-App (T-Abs p₁) p₂) E─AppAbs = preservation-substitution p₂ ε p₁
-- Proving that every term is a value or a redex
data ValueOrRedex : Term → Set where
value : ∀ {t} →
(Value(t)) →
---------------
ValueOrRedex(t)
redex : ∀ {t t′} →
t ⟶ t′ →
---------------
ValueOrRedex(t)
progress : ∀ {Γ t T} → (Γ ⊢ t ⦂ T) → ValueOrRedex(t)
progress T-True = value true
progress T-False = value false
progress (T-If p₁ p₂ p₃) = helper (progress p₁) p₁ where
helper : ∀ {Γ t₀ t₁ t₂} → ValueOrRedex(t₀) → (Γ ⊢ t₀ ⦂ bool) → ValueOrRedex(if t₀ then t₁ else t₂ end)
helper (value true) p = redex E─IfTrue
helper (value false) p = redex E─IfFalse
helper (value (var x)) p = value (if var x then _ else _ end)
helper (value (if t₃ then t₄ else t₅ end)) p = value if if t₃ then t₄ else t₅ end then _ else _ end
helper (value (t₁ $ t₂)) p = value if (t₁ $ t₂) then _ else _ end
helper (redex r) p = redex (E─IfCong r)
progress (T-Var {n = n} p) = value (var n)
progress (T-Abs {t = t} p) = value (fun t)
progress (T-App p₁ p₂) = helper (progress p₁) p₁ where
helper : ∀ {Γ t₁ t₂ T₁₁ T₁₂} → ValueOrRedex(t₁) → (Γ ⊢ t₁ ⦂ (T₁₁ ⇒ T₁₂)) → ValueOrRedex(t₁ $ t₂)
helper (value (var x)) p = value (var x $ _)
helper (value (fun t)) p = redex E─AppAbs
helper (value (t₃ $ t₄)) p = value ((t₃ $ t₄) $ _)
helper (value (if t₃ then t₄ else t₅ end)) p = value (if t₃ then t₄ else t₅ end $ _)
helper (redex r) p = redex (E─App1 r)
-- Interpreter
data _⟶*_ : Term → Term → Set where
done : ∀ {t} →
--------
t ⟶* t
redex : ∀ {t t′ t″} →
t ⟶ t′ →
t′ ⟶* t″ →
----------
t ⟶* t″
-- An interpreter result
data Result : Term → Set where
result : ∀ {t t′} →
t ⟶* t′ →
Value(t′) →
---------
Result(t)
-- The interpreter just calls `progress` until it is a value.
-- This might bot terminate!
{-# NON_TERMINATING #-}
interp : ∀ {Γ t T} → (Γ ⊢ t ⦂ T) → Result(t)
interp p = helper₂ p (progress p) where
helper₁ : ∀ {t t′} → (t ⟶ t′) → Result(t′) → Result(t)
helper₁ r (result s v) = result (redex r s) v
helper₂ : ∀ {Γ t T} → (Γ ⊢ t ⦂ T) → ValueOrRedex(t) → Result(t)
helper₂ p (value v) = result done v
helper₂ p (redex r) = helper₁ r (interp (preservation p r))
|
src/Lambda/Compiler-correctness/Steps-match.agda | nad/definitional-interpreters | 0 | 15243 | <filename>src/Lambda/Compiler-correctness/Steps-match.agda
------------------------------------------------------------------------
-- The "time complexity" of the compiled program matches the one
-- obtained from the instrumented interpreter
------------------------------------------------------------------------
open import Prelude hiding (_+_; _*_)
import Lambda.Syntax
module Lambda.Compiler-correctness.Steps-match
{Name : Type}
(open Lambda.Syntax Name)
(def : Name → Tm 1)
where
import Equality.Propositional as E
open import Logical-equivalence using (_⇔_)
import Tactic.By.Propositional as By
open import Prelude.Size
open import Conat E.equality-with-J as Conat
using (Conat; zero; suc; force; ⌜_⌝; _+_; _*_; max;
[_]_≤_; step-≤; step-∼≤; _∎≤)
open import Function-universe E.equality-with-J hiding (_∘_)
open import List E.equality-with-J using (_++_)
open import Monad E.equality-with-J using (return; _>>=_; _⟨$⟩_)
open import Vec.Data E.equality-with-J
open import Delay-monad
open import Delay-monad.Bisimilarity
open import Delay-monad.Quantitative-weak-bisimilarity
open import Lambda.Compiler def
open import Lambda.Delay-crash
open import Lambda.Interpreter.Steps def
open import Lambda.Virtual-machine.Instructions Name hiding (crash)
open import Lambda.Virtual-machine comp-name
private
module C = Closure Code
module T = Closure Tm
------------------------------------------------------------------------
-- Some lemmas
-- A rearrangement lemma for ⟦_⟧.
⟦⟧-· :
∀ {n} (t₁ t₂ : Tm n) {ρ} {k : T.Value → Delay-crash C.Value ∞} →
⟦ t₁ · t₂ ⟧ ρ >>= k ∼
⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k
⟦⟧-· t₁ t₂ {ρ} {k} =
⟦ t₁ · t₂ ⟧ ρ >>= k ∼⟨⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂) >>= k ∼⟨ symmetric (associativity (⟦ t₁ ⟧ _) _ _) ⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
(do v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂) >>= k) ∼⟨ (⟦ t₁ ⟧ _ ∎) >>=-cong (λ _ → symmetric (associativity (⟦ t₂ ⟧ _) _ _)) ⟩
(do v₁ ← ⟦ t₁ ⟧ ρ
v₂ ← ⟦ t₂ ⟧ ρ
v₁ ∙ v₂ >>= k) ∎
-- Lemmas related to conatural numbers.
private
lemma₁ : ∀ {δ} → [ ∞ ] δ ≤ ⌜ 1 ⌝ + δ
lemma₁ = Conat.≤suc
lemma₂ : ∀ {δ} → [ ∞ ] δ ≤ max ⌜ 1 ⌝ δ
lemma₂ = Conat.ʳ≤max ⌜ 1 ⌝ _
lemma₃ : ∀ {δ} → [ ∞ ] max ⌜ 1 ⌝ δ ≤ max ⌜ 1 ⌝ δ + ⌜ 1 ⌝
lemma₃ = Conat.m≤m+n
lemma₄ : ∀ {δ} → [ ∞ ] δ ≤ max ⌜ 1 ⌝ δ + ⌜ 1 ⌝
lemma₄ {δ} =
δ ≤⟨ lemma₂ ⟩
max ⌜ 1 ⌝ δ ≤⟨ lemma₃ {δ = δ} ⟩
max ⌜ 1 ⌝ δ + ⌜ 1 ⌝ ∎≤
lemma₅ : ∀ {δ} → [ ∞ ] ⌜ 1 ⌝ + δ ≤ δ + ⌜ 1 ⌝
lemma₅ {δ} =
⌜ 1 ⌝ + δ ∼⟨ Conat.+-comm ⌜ 1 ⌝ ⟩≤
δ + ⌜ 1 ⌝ ∎≤
lemma₆ : ∀ {δ} → [ ∞ ] ⌜ 1 ⌝ + δ ≤ max ⌜ 1 ⌝ δ + ⌜ 1 ⌝
lemma₆ {δ} =
⌜ 1 ⌝ + δ ≤⟨ lemma₅ ⟩
δ + ⌜ 1 ⌝ ≤⟨ lemma₂ Conat.+-mono (⌜ 1 ⌝ ∎≤) ⟩
max ⌜ 1 ⌝ δ + ⌜ 1 ⌝ ∎≤
lemma₇ : ∀ {δ} → [ ∞ ] max ⌜ 1 ⌝ (⌜ 1 ⌝ + δ) ≤ ⌜ 1 ⌝ + δ
lemma₇ {δ} = suc λ { .force →
δ ∎≤ }
lemma₈ : ∀ {δ} → [ ∞ ] max ⌜ 1 ⌝ (max ⌜ 1 ⌝ δ) ≤ max ⌜ 1 ⌝ δ
lemma₈ {δ} = suc λ { .force →
Conat.pred δ ∎≤ }
lemma₉ :
∀ {δ} → [ ∞ ] max ⌜ 1 ⌝ (max ⌜ 1 ⌝ (max ⌜ 1 ⌝ δ)) ≤ max ⌜ 1 ⌝ δ
lemma₉ {δ} =
max ⌜ 1 ⌝ (max ⌜ 1 ⌝ (max ⌜ 1 ⌝ δ)) ≤⟨ lemma₈ ⟩
max ⌜ 1 ⌝ (max ⌜ 1 ⌝ δ) ≤⟨ lemma₈ ⟩
max ⌜ 1 ⌝ δ ∎≤
lemma₁₀ : ∀ {δ} → [ ∞ ] ⌜ 1 ⌝ + ⌜ 0 ⌝ ≤ max ⌜ 1 ⌝ δ
lemma₁₀ = suc λ { .force → zero }
lemma₁₁ : Conat.[ ∞ ] max ⌜ 1 ⌝ ⌜ 1 ⌝ ∼ ⌜ 1 ⌝
lemma₁₁ = suc λ { .force → zero }
lemma₁₂ : Conat.[ ∞ ] ⌜ 1 ⌝ + ⌜ 1 ⌝ ∼ ⌜ 2 ⌝
lemma₁₂ = Conat.symmetric-∼ (Conat.⌜⌝-+ 1)
------------------------------------------------------------------------
-- Well-formed continuations and stacks
-- A continuation is OK with respect to a certain state and conatural
-- number if the following property is satisfied.
Cont-OK :
Size → State → (T.Value → Delay-crash C.Value ∞) → Conat ∞ → Type
Cont-OK i ⟨ c , s , ρ ⟩ k δ =
∀ v → [ i ∣ ⌜ 1 ⌝ ∣ δ ] exec ⟨ c , val (comp-val v) ∷ s , ρ ⟩ ≳ k v
-- If the In-tail-context parameter indicates that we are in a tail
-- context, then the stack must have a certain shape, and it must be
-- related to the continuation and the conatural number in a certain
-- way.
data Stack-OK
(i : Size) (k : T.Value → Delay-crash C.Value ∞) (δ : Conat ∞) :
In-tail-context → Stack → Type where
unrestricted : ∀ {s} → Stack-OK i k δ false s
restricted : ∀ {s n} {c : Code n} {ρ : C.Env n} →
Cont-OK i ⟨ c , s , ρ ⟩ k δ →
Stack-OK i k δ true (ret c ρ ∷ s)
-- A lemma that can be used to show that certain stacks are OK.
ret-ok :
∀ {p i s n c} {ρ : C.Env n} {k δ} →
Cont-OK i ⟨ c , s , ρ ⟩ k δ →
Stack-OK i k (⌜ 1 ⌝ + δ) p (ret c ρ ∷ s)
ret-ok {true} c-ok = restricted (weakenˡ lemma₁ ∘ c-ok)
ret-ok {false} _ = unrestricted
------------------------------------------------------------------------
-- The semantics of the compiled program matches that of the source
-- code
mutual
-- Some lemmas making up the main part of the compiler correctness
-- result.
⟦⟧-correct :
∀ {i n} (t : Tm n) (ρ : T.Env n) {c s}
{k : T.Value → Delay-crash C.Value ∞} {tc δ} →
Stack-OK i k δ tc s →
Cont-OK i ⟨ c , s , comp-env ρ ⟩ k δ →
[ i ∣ ⌜ 1 ⌝ ∣ max ⌜ 1 ⌝ δ ]
exec ⟨ comp tc t c , s , comp-env ρ ⟩ ≳ ⟦ t ⟧ ρ >>= k
⟦⟧-correct (var x) ρ {c} {s} {k} _ c-ok =
exec ⟨ var x ∷ c , s , comp-env ρ ⟩ ≳⟨ later (λ { .force →
exec ⟨ c , val By.⟨ index (comp-env ρ) x ⟩ ∷ s , comp-env ρ ⟩ ≡⟨ By.⟨by⟩ (comp-index ρ x) ⟩ˢ
exec ⟨ c , val (comp-val (index ρ x)) ∷ s , comp-env ρ ⟩ ≳⟨ weakenˡ lemma₄ (c-ok (index ρ x)) ⟩ˢ
k (index ρ x) ∎ }) ⟩ˢ
⟦ var x ⟧ ρ >>= k ∎
⟦⟧-correct (lam t) ρ {c} {s} {k} _ c-ok =
exec ⟨ clo (comp-body t) ∷ c , s , comp-env ρ ⟩ ≳⟨ later (λ { .force →
exec ⟨ c , val (comp-val (T.lam t ρ)) ∷ s , comp-env ρ ⟩ ≳⟨ weakenˡ lemma₄ (c-ok (T.lam t ρ)) ⟩ˢ
k (T.lam t ρ) ∎ }) ⟩ˢ
⟦ lam t ⟧ ρ >>= k ∎
⟦⟧-correct (t₁ · t₂) ρ {c} {s} {k} _ c-ok =
exec ⟨ comp false t₁ (comp false t₂ (app ∷ c))
, s
, comp-env ρ
⟩ ≳⟨ weakenˡ lemma₉ (⟦⟧-correct t₁ _ unrestricted λ v₁ →
exec ⟨ comp false t₂ (app ∷ c)
, val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≳⟨ (⟦⟧-correct t₂ _ unrestricted λ v₂ →
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≳⟨ ∙-correct v₁ v₂ c-ok ⟩ˢ
v₁ ∙ v₂ >>= k ∎) ⟩ˢ
(⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k) ∎) ⟩ˢ
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦ t₂ ⟧ ρ >>= λ v₂ → v₁ ∙ v₂ >>= k) ∼⟨ symmetric (⟦⟧-· t₁ t₂) ⟩
⟦ t₁ · t₂ ⟧ ρ >>= k ∎
⟦⟧-correct (call f t) ρ {c} {s} {k} unrestricted c-ok =
exec ⟨ comp false (call f t) c , s , comp-env ρ ⟩ ∼⟨⟩ˢ
exec ⟨ comp false t (cal f ∷ c) , s , comp-env ρ ⟩ ≳⟨ (⟦⟧-correct t _ unrestricted λ v →
exec ⟨ cal f ∷ c , val (comp-val v) ∷ s , comp-env ρ ⟩ ≳⟨ (later λ { .force → weakenˡ lemma₅ (
exec ⟨ comp-name f
, ret c (comp-env ρ) ∷ s
, comp-val v ∷ []
⟩ ≳⟨ body-lemma (def f) [] c-ok ⟩ˢ
(⟦ def f ⟧ (v ∷ []) >>= k) ∎) }) ⟩ˢ
(T.lam (def f) [] ∙ v >>= k) ∎) ⟩ˢ
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v >>= k) ∼⟨ associativity (⟦ t ⟧ ρ) _ _ ⟩
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v) >>= k ∼⟨⟩
⟦ call f t ⟧ ρ >>= k ∎
⟦⟧-correct (call f t) ρ {c} {ret c′ ρ′ ∷ s} {k} (restricted c-ok) _ =
exec ⟨ comp true (call f t) c , ret c′ ρ′ ∷ s , comp-env ρ ⟩ ∼⟨⟩ˢ
exec ⟨ comp false t (tcl f ∷ c) , ret c′ ρ′ ∷ s , comp-env ρ ⟩ ≳⟨ (⟦⟧-correct t _ unrestricted λ v →
exec ⟨ tcl f ∷ c
, val (comp-val v) ∷ ret c′ ρ′ ∷ s
, comp-env ρ
⟩ ≳⟨ (later λ { .force → weakenˡ lemma₅ (
exec ⟨ comp-name f
, ret c′ ρ′ ∷ s
, comp-val v ∷ []
⟩ ≳⟨ body-lemma (def f) [] c-ok ⟩ˢ
⟦ def f ⟧ (v ∷ []) >>= k ∎) }) ⟩ˢ
T.lam (def f) [] ∙ v >>= k ∎) ⟩ˢ
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v >>= k) ∼⟨ associativity (⟦ t ⟧ ρ) _ _ ⟩
(⟦ t ⟧ ρ >>= λ v → T.lam (def f) [] ∙ v) >>= k ∼⟨⟩
⟦ call f t ⟧ ρ >>= k ∎
⟦⟧-correct (con b) ρ {c} {s} {k} _ c-ok =
exec ⟨ con b ∷ c , s , comp-env ρ ⟩ ≳⟨ later (λ { .force →
exec ⟨ c , val (comp-val (T.con b)) ∷ s , comp-env ρ ⟩ ≳⟨ weakenˡ lemma₄ (c-ok (T.con b)) ⟩ˢ
k (T.con b) ∎ }) ⟩ˢ
⟦ con b ⟧ ρ >>= k ∎
⟦⟧-correct (if t₁ t₂ t₃) ρ {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ comp false t₁ (bra (comp tc t₂ []) (comp tc t₃ []) ∷ c)
, s
, comp-env ρ
⟩ ≳⟨ weakenˡ lemma₈
(⟦⟧-correct t₁ _ unrestricted λ v₁ → ⟦if⟧-correct v₁ t₂ t₃ s-ok c-ok) ⟩ˢ
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ >>= k) ∼⟨ associativity (⟦ t₁ ⟧ ρ) _ _ ⟩
(⟦ t₁ ⟧ ρ >>= λ v₁ → ⟦if⟧ v₁ t₂ t₃ ρ) >>= k ∼⟨⟩
⟦ if t₁ t₂ t₃ ⟧ ρ >>= k ∎
body-lemma :
∀ {i n n′} (t : Tm (suc n)) ρ {ρ′ : C.Env n′} {c s v}
{k : T.Value → Delay-crash C.Value ∞} {δ} →
Cont-OK i ⟨ c , s , ρ′ ⟩ k δ →
[ i ∣ ⌜ 1 ⌝ ∣ ⌜ 1 ⌝ + δ ]
exec ⟨ comp-body t , ret c ρ′ ∷ s , comp-val v ∷ comp-env ρ ⟩ ≳
⟦ t ⟧ (v ∷ ρ) >>= k
body-lemma t ρ {ρ′} {c} {s} {v} {k} c-ok =
exec ⟨ comp-body t , ret c ρ′ ∷ s , comp-val v ∷ comp-env ρ ⟩ ∼⟨⟩ˢ
exec ⟨ comp-body t , ret c ρ′ ∷ s , comp-env (v ∷ ρ) ⟩ ≳⟨ weakenˡ lemma₇ (⟦⟧-correct t (_ ∷ _) (ret-ok c-ok) λ v′ →
exec ⟨ ret ∷ []
, val (comp-val v′) ∷ ret c ρ′ ∷ s
, comp-env (v ∷ ρ)
⟩ ≳⟨⟩ˢ
exec ⟨ c , val (comp-val v′) ∷ s , ρ′ ⟩ ≳⟨ c-ok v′ ⟩ˢ
k v′ ∎) ⟩ˢ
⟦ t ⟧ (v ∷ ρ) >>= k ∎
∙-correct :
∀ {i n} v₁ v₂ {ρ : C.Env n} {c s}
{k : T.Value → Delay-crash C.Value ∞} {δ} →
Cont-OK i ⟨ c , s , ρ ⟩ k δ →
[ i ∣ ⌜ 1 ⌝ ∣ max ⌜ 1 ⌝ δ ]
exec ⟨ app ∷ c , val (comp-val v₂) ∷ val (comp-val v₁) ∷ s , ρ ⟩ ≳
v₁ ∙ v₂ >>= k
∙-correct (T.lam t₁ ρ₁) v₂ {ρ} {c} {s} {k} c-ok =
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val (T.lam t₁ ρ₁)) ∷ s
, ρ
⟩ ≳⟨ later (λ { .force → weakenˡ lemma₆ (
exec ⟨ comp-body t₁ , ret c ρ ∷ s , comp-val v₂ ∷ comp-env ρ₁ ⟩ ≳⟨ body-lemma t₁ _ c-ok ⟩ˢ
⟦ t₁ ⟧ (v₂ ∷ ρ₁) >>= k ∎) }) ⟩ˢ
T.lam t₁ ρ₁ ∙ v₂ >>= k ∎
∙-correct (T.con b) v₂ {ρ} {c} {s} {k} _ = weakenˡ lemma₁₀ (
exec ⟨ app ∷ c
, val (comp-val v₂) ∷ val (comp-val (T.con b)) ∷ s
, ρ
⟩ ≳⟨⟩ˢ
crash ∼⟨⟩ˢ
T.con b ∙ v₂ >>= k ∎ˢ)
⟦if⟧-correct :
∀ {i n} v₁ (t₂ t₃ : Tm n) {ρ : T.Env n} {c s}
{k : T.Value → Delay-crash C.Value ∞} {tc δ} →
Stack-OK i k δ tc s →
Cont-OK i ⟨ c , s , comp-env ρ ⟩ k δ →
[ i ∣ ⌜ 1 ⌝ ∣ max ⌜ 1 ⌝ δ ]
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val v₁) ∷ s
, comp-env ρ
⟩ ≳
⟦if⟧ v₁ t₂ t₃ ρ >>= k
⟦if⟧-correct (T.lam t₁ ρ₁) t₂ t₃ {ρ} {c} {s} {k} {tc} _ _ =
weakenˡ lemma₁₀ (
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.lam t₁ ρ₁)) ∷ s
, comp-env ρ
⟩ ≳⟨⟩ˢ
crash ∼⟨⟩ˢ
⟦if⟧ (T.lam t₁ ρ₁) t₂ t₃ ρ >>= k ∎ˢ)
⟦if⟧-correct (T.con true) t₂ t₃ {ρ} {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.con true)) ∷ s
, comp-env ρ
⟩ ≳⟨ later (λ { .force → weakenˡ lemma₃ (
exec ⟨ comp tc t₂ [] ++ c , s , comp-env ρ ⟩ ≡⟨ By.by (comp-++ _ t₂) ⟩ˢ
exec ⟨ comp tc t₂ c , s , comp-env ρ ⟩ ≳⟨ ⟦⟧-correct t₂ _ s-ok c-ok ⟩ˢ
⟦ t₂ ⟧ ρ >>= k ∎) }) ⟩ˢ
⟦if⟧ (T.con true) t₂ t₃ ρ >>= k ∎
⟦if⟧-correct (T.con false) t₂ t₃ {ρ} {c} {s} {k} {tc} s-ok c-ok =
exec ⟨ bra (comp tc t₂ []) (comp tc t₃ []) ∷ c
, val (comp-val (T.con false)) ∷ s
, comp-env ρ
⟩ ≳⟨ later (λ { .force → weakenˡ lemma₃ (
exec ⟨ comp tc t₃ [] ++ c , s , comp-env ρ ⟩ ≡⟨ By.by (comp-++ _ t₃) ⟩ˢ
exec ⟨ comp tc t₃ c , s , comp-env ρ ⟩ ≳⟨ ⟦⟧-correct t₃ _ s-ok c-ok ⟩ˢ
⟦ t₃ ⟧ ρ >>= k ∎) }) ⟩ˢ
⟦if⟧ (T.con false) t₂ t₃ ρ >>= k ∎
-- The "time complexity" of the compiled program is linear in the time
-- complexity obtained from the instrumented interpreter, and vice
-- versa.
steps-match :
(t : Tm 0) →
[ ∞ ] steps (⟦ t ⟧ []) ≤ steps (exec ⟨ comp₀ t , [] , [] ⟩)
×
[ ∞ ] steps (exec ⟨ comp₀ t , [] , [] ⟩) ≤
⌜ 1 ⌝ + ⌜ 2 ⌝ * steps (⟦ t ⟧ [])
steps-match t = $⟨ ⟦⟧-correct t [] unrestricted (λ v → laterˡ (return (comp-val v) ∎ˢ)) ⟩
[ ∞ ∣ ⌜ 1 ⌝ ∣ max ⌜ 1 ⌝ ⌜ 1 ⌝ ]
exec ⟨ comp₀ t , [] , [] ⟩ ≳ comp-val ⟨$⟩ ⟦ t ⟧ [] ↝⟨ proj₂ ∘ _⇔_.to ≳⇔≈×steps≤steps² ⟩
[ ∞ ] steps (comp-val ⟨$⟩ ⟦ t ⟧ []) ≤
steps (exec ⟨ comp₀ t , [] , [] ⟩) ×
[ ∞ ] steps (exec ⟨ comp₀ t , [] , [] ⟩) ≤
max ⌜ 1 ⌝ ⌜ 1 ⌝ +
(⌜ 1 ⌝ + ⌜ 1 ⌝) * steps (comp-val ⟨$⟩ ⟦ t ⟧ []) ↝⟨ _⇔_.to (steps-⟨$⟩ Conat.≤-cong-∼ (_ Conat.∎∼)
×-cong
(_ Conat.∎∼)
Conat.≤-cong-∼
lemma₁₁ Conat.+-cong lemma₁₂ Conat.*-cong steps-⟨$⟩) ⟩□
[ ∞ ] steps (⟦ t ⟧ []) ≤ steps (exec ⟨ comp₀ t , [] , [] ⟩) ×
[ ∞ ] steps (exec ⟨ comp₀ t , [] , [] ⟩) ≤
⌜ 1 ⌝ + ⌜ 2 ⌝ * steps (⟦ t ⟧ []) □
|
demo/imago/src/imago-binary.ads | 98devin/ada-wfc | 9 | 11486 | ------------------------------------------------------------------------------
-- EMAIL: <<EMAIL>> --
-- License: ISC --
-- --
-- Copyright © 2015 darkestkhan --
------------------------------------------------------------------------------
-- Permission to use, copy, modify, and/or distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- The software is provided "as is" and the author disclaims all warranties --
-- with regard to this software including all implied warranties of --
-- merchantability and fitness. In no event shall the author be liable for --
-- any special, direct, indirect, or consequential damages or any damages --
-- whatsoever resulting from loss of use, data or profits, whether in an --
-- action of contract, negligence or other tortious action, arising out of --
-- or in connection with the use or performance of this software. --
------------------------------------------------------------------------------
--------------------------------------------------------------------------
-- This package is based on Lumen.Binary package from Lumen library. --
--------------------------------------------------------------------------
package Imago.Binary is
--------------------------------------------------------------------------
pragma Pure;
--------------------------------------------------------------------------
-----------------------
-- C O N S T A N T S --
-----------------------
--------------------------------------------------------------------------
-- Basic sizes of fundamental binary data types.
Byte_Bits : constant := 8;
Short_Bits: constant := 16;
Word_Bits : constant := 32;
Long_Bits : constant := 64;
--------------------------------------------------------------------------
-- Derived sizes.
Short_Bytes: constant := Short_Bits / Byte_Bits;
Word_Bytes : constant := Word_Bits / Byte_Bits;
Long_Bytes : constant := Long_Bits / Byte_Bits;
--------------------------------------------------------------------------
-- "Last-bit" values for use in rep clauses.
Byte_LB : constant := Byte_Bits - 1;
Short_LB: constant := Short_Bits - 1;
Word_LB : constant := Word_Bits - 1;
Long_LB : constant := Long_Bits - 1;
--------------------------------------------------------------------------
---------------
-- T Y P E S --
---------------
--------------------------------------------------------------------------
-- Unsigned types.
type Byte is mod 2 ** Byte_Bits;
type Short is mod 2 ** Short_Bits;
type Word is mod 2 ** Word_Bits;
type Long is mod 2 ** Long_Bits;
for Byte'Size use Byte_Bits;
for Short'Size use Short_Bits;
for Word'Size use Word_Bits;
for Long'Size use Long_Bits;
--------------------------------------------------------------------------
-- Signed types.
type S_Byte is new Integer range -(2 ** Byte_LB) .. (2 ** Byte_LB) - 1;
type S_Short is new Integer range -(2 ** Short_LB) .. (2 ** Short_LB) - 1;
type S_Word is new Integer range -(2 ** Word_LB) .. (2 ** Word_LB) - 1;
type S_Long is new Long_Integer range -(2 ** Long_LB) .. (2 ** Long_LB) - 1;
for S_Byte'Size use Byte_Bits;
for S_Short'Size use Short_Bits;
for S_Word'Size use Word_Bits;
for S_Long'Size use Long_Bits;
--------------------------------------------------------------------------
-- Array types.
type Byte_Array is array (Natural range <>) of Byte;
type Short_Array is array (Natural range <>) of Short;
type Word_Array is array (Natural range <>) of Word;
type Long_Array is array (Natural range <>) of Long;
type S_Byte_Array is array (Natural range <>) of S_Byte;
type S_Short_Array is array (Natural range <>) of S_Short;
type S_Word_Array is array (Natural range <>) of S_Word;
type S_Long_Array is array (Natural range <>) of S_Long;
---------------------------------------------------------------------------
end Imago.Binary;
|
ksql-parser/src/main/antlr4/io/confluent/ksql/parser/SqlBase.g4 | maxzheng/ksql | 0 | 3112 | /*
* Copyright 2018 Confluent Inc.
*
* Licensed under the Confluent Community License (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.confluent.io/confluent-community-license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
grammar SqlBase;
tokens {
DELIMITER
}
statements
: (singleStatement)* EOF
;
singleStatement
: statement ';'
;
singleExpression
: expression EOF
;
statement
: query #querystatement
| (LIST | SHOW) PROPERTIES #listProperties
| (LIST | SHOW) TOPICS #listTopics
| (LIST | SHOW) REGISTERED TOPICS #listRegisteredTopics
| (LIST | SHOW) STREAMS EXTENDED? #listStreams
| (LIST | SHOW) TABLES EXTENDED? #listTables
| (LIST | SHOW) FUNCTIONS #listFunctions
| DESCRIBE EXTENDED? (qualifiedName | TOPIC qualifiedName) #showColumns
| DESCRIBE FUNCTION qualifiedName #describeFunction
| PRINT (qualifiedName | STRING) printClause #printTopic
| (LIST | SHOW) QUERIES EXTENDED? #listQueries
| TERMINATE QUERY? qualifiedName #terminateQuery
| SET STRING EQ STRING #setProperty
| UNSET STRING #unsetProperty
| LOAD expression #loadProperties
| REGISTER TOPIC (IF NOT EXISTS)? qualifiedName
(WITH tableProperties)? #registerTopic
| CREATE STREAM (IF NOT EXISTS)? qualifiedName
('(' tableElement (',' tableElement)* ')')?
(WITH tableProperties)? #createStream
| CREATE STREAM (IF NOT EXISTS)? qualifiedName
(WITH tableProperties)? AS query
(PARTITION BY identifier)? #createStreamAs
| CREATE TABLE (IF NOT EXISTS)? qualifiedName
('(' tableElement (',' tableElement)* ')')?
(WITH tableProperties)? #createTable
| CREATE TABLE (IF NOT EXISTS)? qualifiedName
(WITH tableProperties)? AS query #createTableAs
| INSERT INTO qualifiedName query (PARTITION BY identifier)? #insertInto
| DROP TOPIC (IF EXISTS)? qualifiedName #dropTopic
| DROP STREAM (IF EXISTS)? qualifiedName (DELETE TOPIC)? #dropStream
| DROP TABLE (IF EXISTS)? qualifiedName (DELETE TOPIC)? #dropTable
| EXPLAIN ANALYZE?
(statement | qualifiedName) #explain
| EXPORT CATALOG TO STRING #exportCatalog
| RUN SCRIPT STRING #runScript
;
query
: queryNoWith
;
tableElement
: identifier type
;
tableProperties
: '(' tableProperty (',' tableProperty)* ')'
;
tableProperty
: identifier EQ expression
;
queryNoWith:
queryTerm
limitClause
;
printClause
: (FROM BEGINNING)?
intervalClause
limitClause
;
intervalClause
: ((INTERVAL | SAMPLE) number)?
;
limitClause
: (LIMIT number)?
;
queryTerm
: queryPrimary #queryTermDefault
;
queryPrimary
: querySpecification #queryPrimaryDefault
| TABLE qualifiedName #table
| VALUES expression (',' expression)* #inlineTable
| '(' queryNoWith ')' #subquery
;
querySpecification
: SELECT selectItem (',' selectItem)*
(INTO into=relationPrimary)?
FROM from=relation
(WINDOW windowExpression)?
(WHERE where=booleanExpression)?
(GROUP BY groupBy)?
(HAVING having=booleanExpression)?
;
windowExpression
: (IDENTIFIER)?
( tumblingWindowExpression | hoppingWindowExpression | sessionWindowExpression )
;
tumblingWindowExpression
: TUMBLING '(' SIZE number windowUnit')'
;
hoppingWindowExpression
: HOPPING '(' SIZE number windowUnit ',' ADVANCE BY number windowUnit ')'
;
sessionWindowExpression
: SESSION '(' number windowUnit ')'
;
windowUnit
: DAY
| HOUR
| MINUTE
| SECOND
| MILLISECOND
| DAYS
| HOURS
| MINUTES
| SECONDS
| MILLISECONDS
;
groupBy
: groupingElement (',' groupingElement)*
;
groupingElement
: groupingExpressions #singleGroupingSet
;
groupingExpressions
: '(' (expression (',' expression)*)? ')'
| expression
;
namedQuery
: name=identifier (columnAliases)? AS '(' query ')'
;
selectItem
: expression (AS? identifier)? #selectSingle
| qualifiedName '.' ASTERISK #selectAll
| ASTERISK #selectAll
;
relation
: left=aliasedRelation joinType JOIN right=aliasedRelation joinWindow? joinCriteria
#joinRelation
| aliasedRelation #relationDefault
;
joinType
: INNER? #innerJoin
| FULL OUTER? #outerJoin
| LEFT OUTER? #leftJoin
;
joinWindow
: (WITHIN withinExpression)?
;
withinExpression
: '(' joinWindowSize ',' joinWindowSize ')' # joinWindowWithBeforeAndAfter
| joinWindowSize # singleJoinWindow
;
joinWindowSize
: number windowUnit
;
joinCriteria
: ON booleanExpression
;
aliasedRelation
: relationPrimary (AS? identifier columnAliases?)?
;
columnAliases
: '(' identifier (',' identifier)* ')'
;
relationPrimary
:
qualifiedName (WITH tableProperties)? #tableName
| '(' query ')' #subqueryRelation
| '(' relation ')' #parenthesizedRelation
;
expression
: booleanExpression
;
booleanExpression
: predicated #booleanDefault
| NOT booleanExpression #logicalNot
| left=booleanExpression operator=AND right=booleanExpression #logicalBinary
| left=booleanExpression operator=OR right=booleanExpression #logicalBinary
;
// workaround for:
// https://github.com/antlr/antlr4/issues/780
// https://github.com/antlr/antlr4/issues/781
predicated
: valueExpression predicate[$valueExpression.ctx]?
;
predicate[ParserRuleContext value]
: comparisonOperator right=valueExpression #comparison
| NOT? BETWEEN lower=valueExpression AND upper=valueExpression #between
| NOT? IN '(' expression (',' expression)* ')' #inList
| NOT? IN '(' query ')' #inSubquery
| NOT? LIKE pattern=valueExpression #like
| IS NOT? NULL #nullPredicate
| IS NOT? DISTINCT FROM right=valueExpression #distinctFrom
;
valueExpression
: primaryExpression #valueExpressionDefault
| valueExpression AT timeZoneSpecifier #atTimeZone
| operator=(MINUS | PLUS) valueExpression #arithmeticUnary
| left=valueExpression operator=(ASTERISK | SLASH | PERCENT) right=valueExpression #arithmeticBinary
| left=valueExpression operator=(PLUS | MINUS) right=valueExpression #arithmeticBinary
| left=valueExpression CONCAT right=valueExpression #concatenation
;
primaryExpression
: NULL #nullLiteral
| identifier STRING #typeConstructor
| number #numericLiteral
| booleanValue #booleanLiteral
| STRING #stringLiteral
| BINARY_LITERAL #binaryLiteral
| qualifiedName '(' ASTERISK ')' #functionCall
| qualifiedName '(' (expression (',' expression)*)? ')' #functionCall
| '(' query ')' #subqueryExpression
| CASE valueExpression whenClause+ (ELSE elseExpression=expression)? END #simpleCase
| CASE whenClause+ (ELSE elseExpression=expression)? END #searchedCase
| CAST '(' expression AS type ')' #cast
| ARRAY '[' (expression (',' expression)*)? ']' #arrayConstructor
| value=primaryExpression '[' index=valueExpression ']' #subscript
| identifier #columnReference
| identifier '.' identifier #columnReference
| base=primaryExpression STRUCT_FIELD_REF fieldName=identifier #dereference
| '(' expression ')' #parenthesizedExpression
;
timeZoneSpecifier
: TIME ZONE STRING #timeZoneString
;
comparisonOperator
: EQ | NEQ | LT | LTE | GT | GTE
;
booleanValue
: TRUE | FALSE
;
type
: type ARRAY
| ARRAY '<' type '>'
| MAP '<' type ',' type '>'
| STRUCT '<' identifier type (',' identifier type)* '>'
| baseType ('(' typeParameter (',' typeParameter)* ')')?
;
typeParameter
: INTEGER_VALUE | type
;
baseType
: identifier
;
whenClause
: WHEN condition=expression THEN result=expression
;
qualifiedName
: identifier ('.' identifier)*
;
identifier
: IDENTIFIER #unquotedIdentifier
| QUOTED_IDENTIFIER #quotedIdentifierAlternative
| nonReserved #unquotedIdentifier
| BACKQUOTED_IDENTIFIER #backQuotedIdentifier
| DIGIT_IDENTIFIER #digitIdentifier
;
number
: DECIMAL_VALUE #decimalLiteral
| INTEGER_VALUE #integerLiteral
;
nonReserved
: SHOW | TABLES | COLUMNS | COLUMN | PARTITIONS | FUNCTIONS | FUNCTION | SESSION
| STRUCT | MAP | ARRAY | PARTITION
| INTEGER | DATE | TIME | TIMESTAMP | INTERVAL | ZONE
| YEAR | MONTH | DAY | HOUR | MINUTE | SECOND
| EXPLAIN | ANALYZE | TYPE
| SET | RESET
| IF
;
SELECT: 'SELECT';
FROM: 'FROM';
AS: 'AS';
DISTINCT: 'DISTINCT';
WHERE: 'WHERE';
WITHIN: 'WITHIN';
WINDOW: 'WINDOW';
GROUP: 'GROUP';
BY: 'BY';
HAVING: 'HAVING';
LIMIT: 'LIMIT';
AT: 'AT';
OR: 'OR';
AND: 'AND';
IN: 'IN';
NOT: 'NOT';
EXISTS: 'EXISTS';
BETWEEN: 'BETWEEN';
LIKE: 'LIKE';
IS: 'IS';
NULL: 'NULL';
TRUE: 'TRUE';
FALSE: 'FALSE';
INTEGER: 'INTEGER';
DATE: 'DATE';
TIME: 'TIME';
TIMESTAMP: 'TIMESTAMP';
INTERVAL: 'INTERVAL';
YEAR: 'YEAR';
MONTH: 'MONTH';
DAY: 'DAY';
HOUR: 'HOUR';
MINUTE: 'MINUTE';
SECOND: 'SECOND';
MILLISECOND: 'MILLISECOND';
YEARS: 'YEARS';
MONTHS: 'MONTHS';
DAYS: 'DAYS';
HOURS: 'HOURS';
MINUTES: 'MINUTES';
SECONDS: 'SECONDS';
MILLISECONDS: 'MILLISECONDS';
ZONE: 'ZONE';
TUMBLING: 'TUMBLING';
HOPPING: 'HOPPING';
SIZE: 'SIZE';
ADVANCE: 'ADVANCE';
CASE: 'CASE';
WHEN: 'WHEN';
THEN: 'THEN';
ELSE: 'ELSE';
END: 'END';
JOIN: 'JOIN';
FULL: 'FULL';
OUTER: 'OUTER';
INNER: 'INNER';
LEFT: 'LEFT';
RIGHT: 'RIGHT';
ON: 'ON';
PARTITION: 'PARTITION';
STRUCT: 'STRUCT';
WITH: 'WITH';
VALUES: 'VALUES';
CREATE: 'CREATE';
REGISTER: 'REGISTER';
TABLE: 'TABLE';
TOPIC: 'TOPIC';
STREAM: 'STREAM';
STREAMS: 'STREAMS';
INSERT: 'INSERT';
DELETE: 'DELETE';
INTO: 'INTO';
DESCRIBE: 'DESCRIBE';
EXTENDED: 'EXTENDED';
PRINT: 'PRINT';
EXPLAIN: 'EXPLAIN';
ANALYZE: 'ANALYZE';
TYPE: 'TYPE';
CAST: 'CAST';
SHOW: 'SHOW';
LIST: 'LIST';
TABLES: 'TABLES';
TOPICS: 'TOPICS';
REGISTERED: 'REGISTERED';
QUERY: 'QUERY';
QUERIES: 'QUERIES';
TERMINATE: 'TERMINATE';
LOAD: 'LOAD';
COLUMNS: 'COLUMNS';
COLUMN: 'COLUMN';
PARTITIONS: 'PARTITIONS';
FUNCTIONS: 'FUNCTIONS';
FUNCTION: 'FUNCTION';
DROP: 'DROP';
TO: 'TO';
RENAME: 'RENAME';
ARRAY: 'ARRAY';
MAP: 'MAP';
SET: 'SET';
RESET: 'RESET';
SESSION: 'SESSION';
SAMPLE: 'SAMPLE';
EXPORT: 'EXPORT';
CATALOG: 'CATALOG';
PROPERTIES: 'PROPERTIES';
BEGINNING: 'BEGINNING';
UNSET: 'UNSET';
RUN: 'RUN';
SCRIPT: 'SCRIPT';
IF: 'IF';
EQ : '=';
NEQ : '<>' | '!=';
LT : '<';
LTE : '<=';
GT : '>';
GTE : '>=';
PLUS: '+';
MINUS: '-';
ASTERISK: '*';
SLASH: '/';
PERCENT: '%';
CONCAT: '||';
STRUCT_FIELD_REF: '->';
STRING
: '\'' ( ~'\'' | '\'\'' )* '\''
;
// Note: we allow any character inside the binary literal and validate
// its a correct literal when the AST is being constructed. This
// allows us to provide more meaningful error messages to the user
BINARY_LITERAL
: 'X\'' (~'\'')* '\''
;
INTEGER_VALUE
: DIGIT+
;
DECIMAL_VALUE
: DIGIT+ '.' DIGIT*
| '.' DIGIT+
| DIGIT+ ('.' DIGIT*)? EXPONENT
| '.' DIGIT+ EXPONENT
;
IDENTIFIER
: (LETTER | '_') (LETTER | DIGIT | '_' | '@' )*
;
DIGIT_IDENTIFIER
: DIGIT (LETTER | DIGIT | '_' | '@' )+
;
QUOTED_IDENTIFIER
: '"' ( ~'"' | '""' )* '"'
;
BACKQUOTED_IDENTIFIER
: '`' ( ~'`' | '``' )* '`'
;
TIME_WITH_TIME_ZONE
: 'TIME' WS 'WITH' WS 'TIME' WS 'ZONE'
;
TIMESTAMP_WITH_TIME_ZONE
: 'TIMESTAMP' WS 'WITH' WS 'TIME' WS 'ZONE'
;
fragment EXPONENT
: 'E' [+-]? DIGIT+
;
fragment DIGIT
: [0-9]
;
fragment LETTER
: [A-Z]
;
SIMPLE_COMMENT
: '--' ~[\r\n]* '\r'? '\n'? -> channel(HIDDEN)
;
BRACKETED_COMMENT
: '/*' .*? '*/' -> channel(HIDDEN)
;
WS
: [ \r\n\t]+ -> channel(HIDDEN)
;
// Catch-all for anything we can't recognize.
// We use this to be able to ignore and recover all the text
// when splitting statements with DelimiterLexer
UNRECOGNIZED
: .
;
|
tools-src/gnu/gcc/gcc/ada/s-io.adb | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 17266 | <reponame>enfoTek/tomato.linksys.e2000.nvram-mod<filename>tools-src/gnu/gcc/gcc/ada/s-io.adb
------------------------------------------------------------------------------
-- --
-- GNAT RUNTIME COMPONENTS --
-- --
-- S Y S T E M . I O --
-- --
-- B o d y --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2000 Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNAT; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
package body System.IO is
--------------
-- New_Line --
--------------
procedure New_Line (Spacing : Positive := 1) is
begin
for J in 1 .. Spacing loop
Put (ASCII.LF);
end loop;
end New_Line;
---------
-- Put --
---------
procedure Put (X : Integer) is
procedure Put_Int (X : Integer);
pragma Import (C, Put_Int, "put_int");
begin
Put_Int (X);
end Put;
procedure Put (C : Character) is
procedure Put_Char (C : Character);
pragma Import (C, Put_Char, "put_char");
begin
Put_Char (C);
end Put;
procedure Put (S : String) is
begin
for J in S'Range loop
Put (S (J));
end loop;
end Put;
--------------
-- Put_Line --
--------------
procedure Put_Line (S : String) is
begin
Put (S);
New_Line;
end Put_Line;
end System.IO;
|
Opus/asm/editn2.asm | Computer-history-Museum/MS-Word-for-Windows-v1.1 | 2 | 100657 | include w2.inc
include noxport.inc
include consts.inc
include structs.inc
createSeg edit_PCODE,edit2,byte,public,CODE
; DEBUGGING DECLARATIONS
ifdef DEBUG
midEditn2 equ 22 ; module ID, for native asserts
endif
; EXTERNAL FUNCTIONS
externFP <N_PdodMother>
externFP <IInPlcRef>
externFP <CpPlc>
externFP <GetPlc>
externFP <PutCpPlc>
externFP <InvalParaSect>
externFP <XDeleteFields>
externFP <XDeleteBkmks>
externFP <N_FOpenPlc>
externFP <N_QcpQfooPlcfoo>
externFP <InvalCp1>
externFP <InvalText>
externFP <IInPlcCheck>
externFP <FlushRulerSprms>
externFP <FChngSizePhqLcb>
externFP <CpMac2Doc>
externFP <CpMacDoc>
externFP <XDelReferencedText>
externFP <XDelInHplcEdit>
externFP <XDeleteHdrText>
externFP <CpMac1Doc>
externFP <XCopyFields>
externFP <XCopyBkmks>
externFP <XAddHdrText>
externFP <FSectLimAtCp>
externFP <XAddToHplcEdit>
externFP <XAddReferencedText>
externFP <CopyMultPlc>
externFP <PutPlc>
externFP <AdjustHplcCpsToLim>
externNP <LN_PxsInit>
externNP <LN_PostTn>
externNP <LN_FDoTns>
externNP <LN_CloseTns>
externFP <AdjustHplc>
externFP <N_AdjustCp>
externFP <IInPlc>
externFP <SetErrorMatProc>
ifdef DEBUG
externFP <AssertProcForNative>
externFP <FCkFldForDelete>
externFP <S_XReplace>
externFP <S_AdjustCp>
externFP <S_XRepl1>
externFP <AssertSzProc>
externFP <LockHeap, UnlockHeap>
externFP <S_FOpenPlc>
externFP <S_FStretchPlc>
externFP <S_XDelFndSedPgdPad>
externFP <S_XReplaceCps>
endif ;DEBUG
sBegin data
; EXTERNALS
externW caPage
externW caPara
externW caSect
externW caTable
externW caTap
externW mpdochdod
externW vdocFetch
externW vlcb
externW vrulss
externW vtcc
externW vsab
externW mpsbps
externW caHdt
externW vtcxs
externW vdocFetchVisi
externW vcaCell
externW asd
externW vfInCommit
externW vfNoInval
externW vmerr
externW docSeqCache
externW vcbc
externW vdocScratch
externW caTapAux
ifdef DEBUG
externW cHpFreeze
externW vdbs
externW fDocScratchInUse
endif ;DEBUG
sEnd data
; CODE SEGMENT _EDIT
sBegin edit2
assumes cs,edit2
assumes ds,dgroup
assumes ss,dgroup
;-------------------------------------------------------------------------
; FReplace(pca, fn, fc, dfc)
;-------------------------------------------------------------------------
;/* F R E P L A C E */
;/* Replace cpFirst through (cpLim-1) in doc by fc through (fc+dfc-1) in fn */
;BOOL FReplace(pca, fn, fc, dfc)
;struct CA *pca;
;int fn;
;FC fc, dfc;
;{
; struct XBC xbc;
; struct XSR *pxsr;
;#define ixsrReplaceMax 4
; struct XSR rgxsr[ixsrReplaceMax];
; %%Function:N_FReplace %%Owner:BRADV
cProc N_FReplace,<PUBLIC,FAR>,<si,di>
ParmW pca
OFFBP_pca = -2
ParmW fn
OFFBP_fn = -4
ParmD fc
OFFBP_fc = -8
ParmD dfc
OFFBP_dfc = -12
LocalV xbc,cbXbcMin
LocalV rgxsr,4*cbXsrMin
cBegin
; if (vrulss.caRulerSprm.doc != docNil)
; FlushRulerSprms();
;LN_FlushRulerSprms performs
;if (vrulss.caRulerSprm.doc != docNil)
; FlushRulerSprms();
;ax, bx, cx, dx are altered.
call LN_FlushRulerSprms
; pxsr = PxsInit(rgxsr, ixsrReplaceMax, &xbc);
;LN_PxsInit takes pxs in si, ixsMax in cx, pxbc in bx
;and performs PxsInit(pxs, ixsMax, pxbc).
;ax, bx, cx, dx, di are altered. The result is returned in si.
lea si,[rgxsr]
mov cx,4
lea bx,[xbc]
call LN_PxsInit
; pxsr->pcaDel = pca;
; pxsr->fn = fn;
; pxsr->fc = fc;
; pxsr->dfc = dfc;
errnz <OFFBP_fc - OFFBP_dfc - 4>
errnz <fcXsr - dfcXsr - 4>
errnz <OFFBP_fn - OFFBP_fc - 4>
errnz <fnXsr - fcXsr - 4>
errnz <OFFBP_pca - OFFBP_fn - 2>
errnz <pcaDelXsr - fnXsr - 2>
ifdef DEBUG
;Assert es == ds with a call so as not to mess up short jumps.
call FR06
endif ;DEBUG
push si ;save pxsr
mov di,si
lea si,[dfc]
mov cx,(OFFBP_pca - OFFBP_dfc + 2) SHR 1
rep movsw
pop si ;restore pxsr
; XReplace(fTrue, &xbc, pxsr);
lea di,[xbc]
mov ax,fTrue
push ax
push di
push si
ifdef DEBUG
cCall S_XReplace,<>
else ;!DEBUG
push cs
call near ptr N_XReplace
endif ;!DEBUG
; if (!FDoTns(&xbc))
; {
;LN_FDoTns takes pxbc in di and performs FDoTns(pxbc).
;fTrue is returned iff carry is true upon return.
;ax, bx, cx, dx are altered.
call LN_FDoTns
jc FR02
; SetErrorMat(matReplace);
mov ax,matReplace
cCall SetErrorMatProc,<ax>
; return fFalse;
; }
jmp short FR05
FR02:
; BeginCommit();
;#define BeginCommit() AssertDo(!vfInCommit++)
ifdef DEBUG
cmp [vfInCommit],0
je FR03
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1001
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FR03:
endif ;DEBUG
inc [vfInCommit]
; XReplace(fFalse, &xbc, pxsr);
xor ax,ax
push ax
push di
push si
ifdef DEBUG
cCall S_XReplace,<>
else ;!DEBUG
push cs
call near ptr N_XReplace
endif ;!DEBUG
; EndCommit();
;#define EndCommit() AssertDo(!--vfInCommit)
dec [vfInCommit]
ifdef DEBUG
je FR04
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1002
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FR04:
endif ;DEBUG
; CloseTns(&xbc);
;LN_CloseTns takes &xbc in di and performs CloseTns.
;ax, bx, cx, dx are altered.
call LN_CloseTns
; return fTrue;
db 0B8h ;turns next "xor ax,ax" into "mov ax,immediate"
FR05:
xor ax,ax
;}
cEnd
ifdef DEBUG
FR06:
push ax
push bx
push cx
push dx
mov ax,ds
mov bx,es
cmp ax,bx
je FR07
mov ax,midEditn2
mov bx,1003
cCall AssertProcForNative,<ax,bx>
FR07:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
;-------------------------------------------------------------------------
; XReplace(fPlan, pxbc, pxsr)
;-------------------------------------------------------------------------
;/* X R E P L A C E */
;/* Perform a bifuricated replacement */
;XReplace(fPlan, pxbc, pxsr)
;BOOL fPlan;
;struct XBC *pxbc;
;struct XSR *pxsr;
;{
; struct CA *pca = pxsr->pcaDel;
; %%Function:N_XReplace %%Owner:BRADV
cProc N_XReplace,<PUBLIC,FAR>,<si,di>
ParmW fPlan
ParmW pxbc
ParmW pxsr
ifdef DEBUG
LocalV rgchAttempt,42
LocalV rgchEditn,10
endif ;DEBUG
cBegin
mov di,[pxsr]
mov si,[di.pcaDelXsr]
; Assert(pca->cpFirst >= cp0 && pca->cpLim <= CpMac1Doc(pca->doc));
ifdef DEBUG
push ax
push bx
push cx
push dx
cmp [si.HI_cpFirstCa],0
jge XR01
mov ax,midEditn2
mov bx,1004
cCall AssertProcForNative,<ax,bx>
XR01:
cCall CpMac1Doc,<[si.docCa]>
sub ax,[si.LO_cpLimCa]
sbb dx,[si.HI_cpLimCa]
jge XR02
mov ax,midEditn2
mov bx,1005
cCall AssertProcForNative,<ax,bx>
XR02:
pop dx
pop cx
pop bx
pop ax
endif ;DEBUG
; /* check that deleted portion may be deleted WRT fields */
; AssertSz(!vdbs.fCkFldDel || FCkFldForDelete(pca->doc, pca->cpFirst, pca->cpLim),
; "Attempt to delete unmatched field char! " );
;#define AssertSz(f,sz) ((f) ? 0 : AssertSzProc(SzFrame(sz),(CHAR *)szAssertFile,__LINE__))
ifdef DEBUG
push ax
push bx
push cx
push dx
cmp [vdbs.fCkFldDelDbs],fFalse
je Ltemp005
push [si.docCa]
push [si.HI_cpFirstCa]
push [si.LO_cpFirstCa]
push [si.HI_cpLimCa]
push [si.LO_cpLimCa]
cCall FCkFldForDelete,<>
or ax,ax
je Ltemp006
Ltemp005:
jmp XR04
Ltemp006:
push si
push di
push ds
push es
push cs
pop ds
push ss
pop es
mov si,offset szAttempt1
lea di,[rgchAttempt]
mov cx,cbSzAttempt1
rep movsb
jmp short XR03
szAttempt1:
db 'Attempt to delete unmatched field char! ',0
cbSzAttempt1 equ $ - szAttempt1
errnz <cbSzAttempt1 - 41>
XR03:
mov si,offset szEditn1
lea di,[rgchEditn]
mov cx,cbSzEditn1
rep movsb
jmp short XR035
szEditn1:
db 'editn.asm',0
cbSzEditn1 equ $ - szEditn1
errnz <cbSzEditn1 - 10>
XR035:
pop es
pop ds
pop di
pop si
lea ax,[rgchAttempt]
lea bx,[rgchEditn]
mov cx,1027
cCall AssertSzProc,<ax,bx,cx>
XR04:
pop dx
pop cx
pop bx
pop ax
endif ;DEBUG
; if (DcpCa(pca) != 0)
;/* delete structures for text being deleted */
; XDeleteStruct(fPlan, pxbc, pxsr);
;Assumes bx = pxbc, cx = fPlan, si = pca, di = pxsr
;ax, bx, cx, dx are altered.
mov bx,[pxbc]
mov cx,[fPlan]
call LN_XDeleteStruct
; if (!fPlan && !vfNoInval)
; /* may call CachePara or FetchCp, must call BEFORE changing piece tbl */
; InvalText (pca, fTrue /* fEdit */);
mov ax,[vfNoInval]
or ax,[fPlan]
jne XR05
errnz <fTrue - fFalse - 1>
inc ax
cCall InvalText,<si,ax>
XR05:
; XRepl1(fPlan, pxbc, pxsr);
push [fPlan]
push [pxbc]
push di
ifdef DEBUG
cCall S_XRepl1,<>
else ;!DEBUG
call LN_XRepl1
endif ;!DEBUG
; if (!fPlan)
; {
cmp [fPlan],fFalse
jne XR10
; if (!vfNoInval)
; InvalCp1(pca);
; else
; /* inval the caches even if vfNoInval on */
; InvalCaFierce();
;LN_DoInval assumes pca passed in si and performs
;if (!vfNoInval) { InvalCp1(pca); }
;else InvalCaFierce();
;ax, bx, cx, dx are altered.
call LN_DoInval
; AdjustCp(pca, pxsr->dfc);
; }
push si
push [di.HI_dfcXsr]
push [di.LO_dfcXsr]
ifdef DEBUG
cCall S_AdjustCp,<>
else ;!DEBUG
push cs
call near ptr N_AdjustCp
endif ;!DEBUG
XR10:
;}
cEnd
;-------------------------------------------------------------------------
; IpcdSplit(hplcpcd, cp)
;-------------------------------------------------------------------------
;/* I P C D S P L I T */
;/* Ensure cp is the beginning of a piece. Return index of that piece. */
;/* NATIVE (pj 3/9): pcode version takes 4% of detokenize time and 2.4% of RTF time */
;NATIVE int IpcdSplit(hplcpcd, cp)
;struct PLC **hplcpcd;
;CP cp;
;{
; int ipcd;
; struct PCD pcd;
; CP dcp;
; %%Function:N_IpcdSplit %%Owner:BRADV
cProc N_IpcdSplit,<PUBLIC,FAR>,<di>
ParmW hplcpcd
ParmD cp
cBegin
mov di,[hplcpcd]
mov ax,[OFF_cp]
mov dx,[SEG_cp]
call LN_IpcdSplit
cEnd
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
; %%Function:LN_IpcdSplit %%Owner:BRADV
PUBLIC LN_IpcdSplit
LN_IpcdSplit:
; vdocFetch = docNil; /* ensure fetch cache isn't lying */
; if ((ipcd = IInPlcCheck(hplcpcd, cp)) == -1)
; return(IMacPlc(hplcpcd));
push si ;save caller's si
push dx
push ax ;save cp
push di ;argument for IInPlcCheck
push dx ;argument for IInPlcCheck
push ax ;argument for IInPlcCheck
errnz <docNil>
xor ax,ax
mov [vdocFetch],ax
cCall IInPlcCheck,<>
xchg ax,si
inc si
je IS02
dec si
; if ((dcp = cp - CpPlc(hplcpcd, ipcd)) != cp0)
; {{ /* !NATIVE (at least 50% of calls don't hit this code) */
cCall CpPlc,<di, si>
pop bx
pop cx ;restore cp
sub ax,bx
sbb dx,cx
push ax
or ax,dx
pop ax
jne IS05
IS005:
xchg ax,si
IS01:
pop si ;restore caller's si
ret
IS02:
mov bx,[di]
mov bx,[bx]
mov si,[bx.iMacPlcStr]
IS03:
pop ax
pop dx ;restore cp
jmp short IS005
IS04:
pop di ;restore hplcpcd
pop ax
pop dx ;restore -dcp
mov ax,matReplace
cCall SetErrorMatProc,<ax>
mov si,iNil
jmp short IS03
IS05:
; Assert(!vfInCommit);
ifdef DEBUG
call IS07
endif ;DEBUG
;/* Insert a new piece flush with the one at ipcd */
; if (!FOpenPlc(hplcpcd, ++ipcd, 1))
; {
push di ;save hplcpcd
push dx
push ax ;save -dcp
push cx
push bx ;save cp
inc si
mov ax,1
ifdef DEBUG
cCall S_FOpenPlc,<di, si, ax>
else ;not DEBUG
cCall N_FOpenPlc,<di, si, ax>
endif ;DEBUG
xchg ax,cx
jcxz IS04
; SetErrorMat( matReplace );
; return iNil;
; }
; QcpQfooPlcfoo takes hplcfoo in bx, ifoo in si, it returns pplcfoo
; in bx, cbfoo in cx, qcp in es:di, qfoo in es:si.
; if DEBUG it returns hpcp in dx:di, hpfoo in dx:si.
; Changes ax, bx, cx, dx, si, di.
push si ;save ipcd
mov bx,di
ifdef DEBUG
xor di,di ;Not O.K. to pass ifldMac
endif ;DEBUG
cCall N_QcpQfooPlcfoo,<>
ifdef DEBUG
;Check that es == mpsbps[dx];
call IS09
endif ;DEBUG
pop ax ;restore ipcd
pop cx
pop dx ;restore cp
; PutCpPlc(hplcpcd, ipcd, cp);
cmp ax,[bx.icpAdjustPlc]
jl IS06
sub cx,[bx.LO_dcpAdjustPlc]
sbb dx,[bx.HI_dcpAdjustPlc]
IS06:
mov es:[di],cx
mov es:[di+2],dx
; /* We are doing effectively:
; pcd.fn = pcdPrev.fn;
; pcd.fc = pcdPrev.fc + dcp;
; pcd.prm = pcdPrev.prm;
; pcd.fNoParaLastValid = pcdPrev.fNoParaLast;
; pcd.fNoParaLast = pcdPrev.fNoParaLast;
; */
; GetPlc(hplcpcd, ipcd - 1, &pcd);
; pcd.fc += dcp;
; PutPlc(hplcpcd, ipcd, &pcd);
pop cx
pop dx ;restore -dcp
push es
pop ds
mov di,si
sub si,cbPcdMin
push ax ;save ipcd
errnz <cbPcdMin - 8>
movsw
errnz <(LO_fcPcd) - 2>
lodsw
sub ax,cx
stosw
errnz <(HI_fcPcd) - 4>
lodsw
sbb ax,dx
stosw
movsw
push ss
pop ds
pop ax ;restore ipcd
pop di ;restore hplcpcd
; }}
; return ipcd;
;}
jmp short IS01
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps.
IS07:
cmp [vfInCommit],fFalse
je IS08
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1006
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
IS08:
ret
endif ;DEBUG
ifdef DEBUG
IS09:
push ax
push bx
push cx
push dx
push es ;save es from QcpQfooPlcfoo
mov bx,dx
shl bx,1
mov ax,mpsbps[bx]
mov es,ax
shr ax,1
jc IS10
;Assembler note: There is no way we should have to call ReloadSb here.
; reload sb trashes ax, cx, and dx
; cCall ReloadSb,<>
mov ax,midEditn2
mov bx,1007
cCall AssertProcForNative,<ax,bx>
IS10:
pop ax ;restore es from QcpQfooPlcfoo
mov bx,es ;compare with es rederived from the SB of QcpQfooPlcfoo
cmp ax,bx
je IS11
mov ax,midEditn2
mov bx,1008
cCall AssertProcForNative,<ax,bx>
IS11:
pop dx
pop cx
pop bx
pop ax
ret
endif ;/* DEBUG */
;-------------------------------------------------------------------------
; XRepl1(fPlan, pxbc, pxsr)
;-------------------------------------------------------------------------
;/* X R E P L 1 */
;/* perform Bifuricated replacement */
;/* NATIVE (pj 3/9): taking 5.6% of RTF time, 9.9% of detokenize time */
;NATIVE XRepl1(fPlan, pxbc, pxsr)
;BOOL fPlan;
;struct XBC *pxbc;
;struct XSR *pxsr;
;{
; struct PLC **hplcpcd;
; int ipcdFirst, ipcdLim;
; int cpcd;
; struct PCD pcd;
; struct PCD pcdPrev;
ifdef DEBUG
; %%Function:N_XRepl1 %%Owner:BRADV
cProc N_XRepl1,<PUBLIC,FAR>,<si,di>
else ;!DEBUG
; %%Function:LN_XRepl1 %%Owner:BRADV
cProc LN_XRepl1,<PUBLIC,NEAR>,<si,di>
endif ;!DEBUG
ParmW fPlan
ParmW pxbc
ParmW pxsr
LocalW OFF_qpcd
cBegin
; hplcpcd = PdodDoc(pxsr->pcaDel->doc)->hplcpcd;
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
mov di,[pxsr]
mov si,[di.pcaDelXsr]
call LN_PdodDocCa
mov di,[bx.hplcpcdDod]
; if (fPlan)
; {
mov ax,[si.LO_cpFirstCa]
mov dx,[si.HI_cpFirstCa]
cmp [fPlan],fFalse
je XR103
;Requires dx:ax = pxsr->pcaDel->cpFirst,
;si is pxsr->pcaDel, di is hplcpcd
; pxsr->fNotEmptyPcaDel = (pxsr->pcaDel->cpFirst != pxsr->pcaDel->cpLim);
mov bx,[si.LO_cpLimCa]
mov cx,[si.HI_cpLimCa]
sub bx,ax
sbb cx,dx
or cx,bx
mov bx,[pxsr]
mov [bx.fNotEmptyPcaDelXsr],cx
; if ((ipcdFirst = IpcdSplit(hplcpcd, pxsr->pcaDel->cpFirst))
; == iNil)
; {
;LPostAbort:
; PostTn(pxbc, tntAbort, NULL, 0);
; return;
; }
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
call LN_IpcdSplit
mov bx,[pxsr]
errnz <iNil - (-1)>
inc ax
je XR102
dec ax
; if (!pxsr->fNotEmptyPcaDel)
; cpcd = 0;
mov cx,[bx.fNotEmptyPcaDelXsr]
jcxz XR101
; else
; {
; int ipcdLim;
; if ((ipcdLim = IpcdSplit(hplcpcd, pxsr->pcaDel->cpLim))
; == iNil)
; goto LPostAbort;
push ax ;save ipcdFirst
mov ax,[si.LO_cpLimCa]
mov dx,[si.HI_cpLimCa]
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
call LN_IpcdSplit
mov bx,[pxsr]
pop cx ;restore ipcdFirst
errnz <iNil - (-1)>
inc ax
je XR102
dec ax
; cpcd = ipcdFirst - ipcdLim;
; }
sub cx,ax
XR101:
; pxsr->cpcd = cpcd;
; }
mov [bx.cpcdXsr],cx
;Assembler note: the following assert is performed below in the
;C source.
; /* number of pieces to be added (negative or zero) */
; Assert(cpcd <= 0);
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps.
call XR110
endif ;DEBUG
;Assembler note: Why check fPlan twice? Do the stuff in the following
;"if (fPlan)" here.
; PostTn(pxbc, tntHplc, hplcpcd, cpcd+1);
;LN_PostTn takes pxbc in bx, tnt in ax, c in cx, h in dx and
;performs PostTn(pxbc, tnt, h, c).
;ax, bx, cx, dx are altered.
mov ax,tntHplc
mov dx,di
inc cx
XR1015:
mov bx,[pxbc]
call LN_PostTn
jmp XR109
XR102:
;LN_PostTn takes pxbc in bx, tnt in ax, c in cx, h in dx and
;performs PostTn(pxbc, tnt, h, c).
;ax, bx, cx, dx are altered.
mov ax,tntAbort
errnz <NULL>
xor cx,cx
xor dx,dx
jmp short XR1015
; else
; {
XR103:
;Assume dx:ax = pxsr->pcaDel->cpFirst,
;si is pxsr->pcaDel, di is hplcpcd
; ipcdFirst = IpcdSplit(hplcpcd, pxsr->pcaDel->cpFirst);
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
call LN_IpcdSplit
mov bx,[pxsr]
; cpcd = pxsr->cpcd;
; Assert(!pxsr->fNotEmptyPcaDel ||
; IInPlc(hplcpcd, pxsr->pcaDel->cpLim) == ipcdFirst - cpcd);
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps.
call XR112
endif ;DEBUG
; /* set so vhprc chain is checked when we run out of memory */
; vmerr.fReclaimHprcs = fTrue;
or [vmerr.fReclaimHprcsMerr],maskFReclaimHprcsMerr
; }
; /* number of pieces to be added (negative or zero) */
; Assert(cpcd <= 0);
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps.
call XR110
endif ;DEBUG
; if (fPlan)
; /* simplified, may be one less */
; PostTn(pxbc, tntHplc, hplcpcd, cpcd+1);
;Assembler note: the "if (fPlan)" case is done above
;in the assembler version.
; else
; {
; if (ipcdFirst > 0)
; GetPlc(hplcpcd, ipcdFirst - 1, &pcdPrev);
;
; if (pxsr->dfc == fc0 ||
; (ipcdFirst > 0 && pcdPrev.fn == pxsr->fn &&
; pcdPrev.prm == prmNil && pcdPrev.fc +
; (pxsr->pcaDel->cpFirst - CpPlc(hplcpcd,ipcdFirst-1))
; == pxsr->fc))
; /* Either pure delete or extension of previous piece */
; {
mov cx,[bx.LO_dfcXsr]
or cx,[bx.HI_dfcXsr]
je XR106 ;carry clear, pass cpcd to FOpenPlc
cmp ax,1
jc XR106 ;carry set, pass cpcd+1 to FOpenPlc
; QcpQfooPlcfoo takes hplcfoo in bx, ifoo in si, it returns pplcfoo
; in bx, cbfoo in cx, qcp in es:di, qfoo in es:si.
; if DEBUG it returns hpcp in dx:di, hpfoo in dx:si.
; Changes ax, bx, cx, dx, si, di.
push di ;save hplcpcd
push ax ;save ipcdFirst
push si ;save pxsr->pcaDel
xchg ax,si
dec si
mov bx,di
ifdef DEBUG
xor di,di ;Not O.K. to pass ifldMac
endif ;DEBUG
cCall N_QcpQfooPlcfoo,<>
ifdef DEBUG
;Check that es == mpsbps[dx];
call XR114
endif ;DEBUG
; (ipcdFirst > 0 && pcdPrev.fn == pxsr->fn &&
; pcdPrev.prm == prmNil && pcdPrev.fc +
; (pxsr->pcaDel->cpFirst - CpPlc(hplcpcd,ipcdFirst-1))
; == pxsr->fc))
mov [OFF_qpcd],si ;save for later
push bx ;save pplcpcd
mov bx,[pxsr]
mov cx,[bx.fnXsr]
mov ax,[bx.LO_fcXsr]
mov dx,[bx.HI_fcXsr]
pop bx ;restore pplcpcd
cmp es:[si.fnPcd],cl
jne XR105
cmp es:[si.prmPcd],prmNil
jne XR105
sub ax,es:[si.LO_fcPcd]
sbb dx,es:[si.HI_fcPcd]
pop si ;restore pxsr->pcaDel
pop cx ;restore ipcdFirst
push cx ;save ipcdFirst
push si ;save pxsr->pcaDel
sub ax,[si.LO_cpFirstCa]
sbb dx,[si.HI_cpFirstCa]
;***Begin in-line CpPlc
add ax,es:[di]
adc dx,es:[di+2]
cmp cx,[bx.icpAdjustPlc]
;Assembler note: use jle instead of jl here because cx is ipcd+1,
;not ipcd.
jle XR104
add ax,[bx.LO_dcpAdjustPlc]
adc dx,[bx.HI_dcpAdjustPlc]
XR104:
;***End in-line CpPlc
or ax,dx
XR105:
pop si ;restore pxsr->pcaDel
pop ax ;restore ipcdFirst
pop di ;restore hplcpcd
; FOpenPlc(hplcpcd, ipcdFirst, cpcd);
; if (pxsr->dfc != fc0)
; /* If extending, say we might have inserted Eop*/
; {
; Debug(pcdPrev.fNoParaLastValid = fFalse);
; pcdPrev.fNoParaLast = fFalse;
; PutPlc(hplcpcd, ipcdFirst - 1, &pcdPrev);
; }
; }
; else
; /* Insert one piece */
; {
; AssertDo(FOpenPlc(hplcpcd, ipcdFirst, cpcd + 1));
stc
jne XR106 ;carry set, pass cpcd+1 to FOpenPlc
;Assembler note: set the FNoParaLast flags before the call
;to FOpenPlc rather than after because we have the pointers now.
mov bx,[OFF_qpcd] ;restore from above
ifdef DEBUG
errnz <(fNoParaLastValidPcd) - (fNoParaLastPcd)>
and es:[bx.fNoParaLastPcd],NOT (maskFNoParaLastPcd + maskFNoParaLastValidPcd)
else ;!DEBUG
and es:[bx.fNoParaLastPcd],NOT maskFNoParaLastPcd
endif ;!DEBUG
;carry clear, pass cpcd to FOpenPlc
;ax = ipcdFirst, si = pxsr->pcaDel, di = hplcpcd,
;we want to pass cpcd + carry to FOpenPlc
XR106:
push ax ;save ipcdFirst
pushf
mov bx,[pxsr]
mov cx,[bx.cpcdXsr]
adc cx,0
ifdef DEBUG
cCall S_FOpenPlc,<di, ax, cx>
else ;not DEBUG
cCall N_FOpenPlc,<di, ax, cx>
endif ;DEBUG
ifdef DEBUG
;Perform the AssertDo with a call so as not to mess up short jumps.
call XR117
endif ;DEBUG
popf
pop ax ;restore ipcdFirst
jnc XR108 ;if we called FOpenPlc with cpcd we're done
; QcpQfooPlcfoo takes hplcfoo in bx, ifoo in si, it returns pplcfoo
; in bx, cbfoo in cx, qcp in es:di, qfoo in es:si.
; if DEBUG it returns hpcp in dx:di, hpfoo in dx:si.
; Changes ax, bx, cx, dx, si, di.
push di ;save hplcpcd
push ax ;save ipcdFirst
push si ;save pxsr->pcaDel
xchg ax,si
mov bx,di
ifdef DEBUG
xor di,di ;Not O.K. to pass ifldMac
endif ;DEBUG
cCall N_QcpQfooPlcfoo,<>
ifdef DEBUG
;Check that es == mpsbps[dx];
call XR114
endif ;DEBUG
; GetPlc(hplcpcd, ipcdFirst, &pcd);
; PutCpPlc(hplcpcd, ipcdFirst, pxsr->pcaDel->cpFirst);
; pcd.fn = pxsr->fn;
; pcd.fc = pxsr->fc;
; pcd.prm = prmNil;
; Debug(pcd.fNoParaLastValid = fFalse);
; pcd.fNoParaLast = fFalse; /* Para state unknown */
; pcd.fPaphNil = fFalse;
; pcd.fCopied = fTrue;
; PutPlc(hplcpcd, ipcdFirst, &pcd);
push bx ;save pplcpcd
mov bx,[pxsr]
ifdef DEBUG
errnz <(fNoParaLastValidPcd) - (fNoParaLastPcd)>
endif ;!DEBUG
errnz <(fPaphNilPcd) - (fNoParaLastPcd)>
errnz <(fCopiedPcd) - (fNoParaLastPcd)>
mov cl,maskFCopiedPcd
errnz <(fnPcd) - (fNoParaLastPcd) - 1>
mov ch,bptr ([bx.fnXsr])
mov wptr (es:[si.fNoParaLastPcd]),cx
mov ax,[bx.LO_fcXsr]
mov dx,[bx.HI_fcXsr]
mov es:[si.LO_fcPcd],ax
mov es:[si.HI_fcPcd],dx
pop bx ;restore pplcpcd
mov es:[si.prmPcd],prmNil
pop si ;restore pxsr->pcaDel
pop ax ;restore ipcdFirst
mov cx,[si.LO_cpFirstCa]
mov dx,[si.HI_cpFirstCa]
;***Begin in-line PutCpPlc
cmp ax,[bx.icpAdjustPlc]
jl XR107
sub cx,[bx.LO_dcpAdjustPlc]
sbb dx,[bx.HI_dcpAdjustPlc]
XR107:
mov es:[di],cx
mov es:[di+2],dx
;***End in-line PutCpPlc
pop di ;restore hplcpcd
; ipcdFirst++;
; }
inc ax
XR108:
; AdjustHplc(hplcpcd, pxsr->pcaDel->cpLim, pxsr->dfc - pxsr->pcaDel->cpLim +
; pxsr->pcaDel->cpFirst, ipcdFirst);
;ax = ipcdFirst, si = pxsr->pcaDel, di = hplcpcd
mov bx,[pxsr]
push di
push [si.HI_cpLimCa]
push [si.LO_cpLimCa]
mov dx,[bx.HI_dfcXsr]
mov cx,[bx.LO_dfcXsr]
sub cx,[si.LO_cpLimCa]
sbb dx,[si.HI_cpLimCa]
add cx,[si.LO_cpFirstCa]
adc dx,[si.HI_cpFirstCa]
push dx
push cx
push ax
push cs
call near ptr AdjustHplc
; InvalVisiCache();
;#define InvalVisiCache() vdocFetchVisi = docNil; vcbc.w = 0
errnz <docNil - 0>
xor ax,ax
mov [vdocFetchVisi],ax
mov [vcbc],ax
; InvalCellCache();
;#define InvalCellCache() (vcaCell.doc = docNil)
mov [vcaCell.docCa],ax
; }
XR109:
;}
cEnd
; Assert(cpcd <= 0);
ifdef DEBUG
XR110:
push ax
push bx
push cx
push dx
mov bx,[pxsr]
cmp [bx.cpcdXsr],0
jle XR111
mov ax,midEditn2
mov bx,1009
cCall AssertProcForNative,<ax,bx>
XR111:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
; Assert(!pxsr->fNotEmptyPcaDel ||
; IpcdSplit(hplcpcd, pxsr->pcaDel->cpLim) == ipcdFirst - cpcd);
ifdef DEBUG
XR112:
push ax
push bx
push cx
push dx
mov bx,[pxsr]
cmp [bx.fNotEmptyPcaDelXsr],0
je XR113
sub ax,[bx.cpcdXsr]
push ax ;save ipcdFirst - cpcd
mov dx,[si.HI_cpLimCa]
mov ax,[si.LO_cpLimCa]
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
call LN_IpcdSplit
pop cx ;restore ipcdFirst - cpcd
cmp ax,cx
je XR113
mov ax,midEditn2
mov bx,1010
cCall AssertProcForNative,<ax,bx>
XR113:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
ifdef DEBUG
XR114:
push ax
push bx
push cx
push dx
push es ;save es from QcpQfooPlcfoo
mov bx,dx
shl bx,1
mov ax,mpsbps[bx]
mov es,ax
shr ax,1
jc XR115
;Assembler note: There is no way we should have to call ReloadSb here.
; reload sb trashes ax, cx, and dx
; cCall ReloadSb,<>
mov ax,midEditn2
mov bx,1011
cCall AssertProcForNative,<ax,bx>
XR115:
pop ax ;restore es from QcpQfooPlcfoo
mov bx,es ;compare with es rederived from the SB of QcpQfooPlcfoo
cmp ax,bx
je XR116
mov ax,midEditn2
mov bx,1012
cCall AssertProcForNative,<ax,bx>
XR116:
pop dx
pop cx
pop bx
pop ax
ret
endif ;/* DEBUG */
; AssertDo(FOpenPlc(hplcpcd, ipcdFirst, cpcd + carry));
ifdef DEBUG
XR117:
or ax,ax
jne XR118
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1013
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XR118:
ret
endif ;DEBUG
;LN_DoInval assumes pca passed in si and performs
;if (!vfNoInval) { InvalCp1(pca); }
;else InvalCaFierce();
;ax, bx, cx, dx are altered.
LN_DoInval:
mov ax,[vfNoInval]
or ax,ax
jne LN_InvalCaFierce
errnz <fTrue - 1>
inc ax
cCall InvalCp1,<si>
ret
;-------------------------------------------------------------------------
; InvalCaFierce()
;-------------------------------------------------------------------------
;/* I n v a l C a F i e r c e */
;/* NATIVE (pj 3/9) called very frequently for operations with vfNoInval */
;NATIVE InvalCaFierce()
;{
;/* unconditionally invalidate CAs and other important docs */
; InvalLlc();
;#define InvalLlc()
; %%Function:N_InvalCaFierce %%Owner:BRADV
PUBLIC N_InvalCaFierce
N_InvalCaFierce:
call LN_InvalCaFierce
db 0CBh ;far ret
LN_InvalCaFierce:
errnz <docNil>
xor ax,ax
; vdocFetch = docNil;
mov [vdocFetch],ax
; caSect.doc = docNil;
mov [caSect.docCa],ax
; caPara.doc = docNil;
mov [caPara.docCa],ax
; caPage.doc = docNil;
mov [caPage.docCa],ax
; caTable.doc = docNil;
mov [caTable.docCa],ax
; caTap.doc = docNil;
mov [caTap.docCa],ax
; caHdt.doc = docNil;
mov [caHdt.docCa],ax
; vtcc.ca.doc = docNil;
mov [vtcc.caTcc.docCa],ax
; vtcc.caTap.doc = docNil;
mov [vtcc.caTapTcc.docCa],ax
; caTapAux.doc = docNil;
mov [caTapAux.docCa],ax
; vtcxs.ca.doc = docNil;
mov [vtcxs.caTcxs.docCa],ax
; Win( vlcb.ca.doc = docNil );
mov [vlcb.caLcb.docCa],ax
; Win( InvalVisiCache() );
;#define InvalVisiCache() (vdocFetchVisi = docNil)
mov [vdocFetchVisi],ax
; Win( InvalCellCache() );
;#define InvalCellCache() (vcaCell.doc = docNil)
mov [vcaCell.docCa],ax
; Win( docSeqCache = docNil );
mov [docSeqCache],ax
;}
ret
;-------------------------------------------------------------------------
; FRepl1(fPlan, pxbc, pxsr)
;-------------------------------------------------------------------------
;/* F R E P L 1 */
;/* delete pca and insert the specified piece (does not do checking or
;adjustment) */
;BOOL FRepl1(pca, fn, fc, dfc)
;struct CA *pca;
;int fn;
;FC fc, dfc;
;{
; struct XBC xbc;
; struct XSR *pxsr;
;#define ixsrRepl1Max 1
; struct XSR rgxsr[ixsrRepl1Max];
; %%Function:N_FRepl1 %%Owner:BRADV
cProc N_FRepl1,<PUBLIC,FAR>,<si,di>
ParmW pca
OFFBP_pca = -2
ParmW fn
OFFBP_fn = -4
ParmD fc
OFFBP_fc = -8
ParmD dfc
OFFBP_dfc = -12
LocalV xbc,cbXbcMin
LocalV rgxsr,1*cbXsrMin
cBegin
; pxsr = (struct XSR *)PxsInit(rgxsr, ixsrRepl1Max, &xbc);
;LN_PxsInit takes pxs in si, ixsMax in cx, pxbc in bx
;and performs PxsInit(pxs, ixsMax, pxbc).
;ax, bx, cx, dx, di are altered. The result is returned in si.
lea si,[rgxsr]
mov cx,1
lea bx,[xbc]
call LN_PxsInit
; pxsr->pcaDel = pca;
; pxsr->fn = fn;
; pxsr->fc = fc;
; pxsr->dfc = dfc;
errnz <OFFBP_fc - OFFBP_dfc - 4>
errnz <fcXsr - dfcXsr - 4>
errnz <OFFBP_fn - OFFBP_fc - 4>
errnz <fnXsr - fcXsr - 4>
errnz <OFFBP_pca - OFFBP_fn - 2>
errnz <pcaDelXsr - fnXsr - 2>
ifdef DEBUG
;Assert es == ds with a call so as not to mess up short jumps.
call FR105
endif ;DEBUG
push si ;save pxsr
mov di,si
lea si,[dfc]
mov cx,(OFFBP_pca - OFFBP_dfc + 2) SHR 1
rep movsw
pop si ;restore pxsr
; XRepl1(fTrue, &xbc, pxsr);
mov ax,fTrue
lea di,[xbc]
push ax
push di
push si
ifdef DEBUG
cCall S_XRepl1,<>
else ;!DEBUG
call LN_XRepl1
endif ;!DEBUG
; if (!FDoTns(&xbc))
; {
;LN_FDoTns takes pxbc in di and performs FDoTns(pxbc).
;fTrue is returned iff carry is true upon return.
;ax, bx, cx, dx are altered.
call LN_FDoTns
jc FR101
; SetErrorMat(matReplace);
; return fFalse;
mov ax,matReplace
cCall SetErrorMatProc,<ax>
jmp short FR104
; }
FR101:
; BeginCommit();
;#define BeginCommit() AssertDo(!vfInCommit++)
ifdef DEBUG
cmp [vfInCommit],0
je FR102
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1014
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FR102:
endif ;DEBUG
inc [vfInCommit]
; XRepl1(fFalse, &xbc, pxsr);
errnz <fFalse>
xor ax,ax
push ax
push di
push si
ifdef DEBUG
cCall S_XRepl1,<>
else ;!DEBUG
call LN_XRepl1
endif ;!DEBUG
; EndCommit();
;#define EndCommit() AssertDo(!--vfInCommit)
dec [vfInCommit]
ifdef DEBUG
je FR103
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1015
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FR103:
endif ;DEBUG
; CloseTns(&xbc);
;LN_CloseTns takes &xbc in di and performs CloseTns.
;ax, bx, cx, dx are altered.
call LN_CloseTns
; return fTrue;
db 0B8h ;turns next "xor ax,ax" into "mov ax,immediate"
FR104:
xor ax,ax
;}
cEnd
ifdef DEBUG
FR105:
push ax
push bx
push cx
push dx
mov ax,ds
mov bx,es
cmp ax,bx
je FR106
mov ax,midEditn2
mov bx,1016
cCall AssertProcForNative,<ax,bx>
FR106:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
;-------------------------------------------------------------------------
; FReplaceCps(pcaDel, pcaIns)
;-------------------------------------------------------------------------
;/* F R E P L A C E C P S */
;/* General replace routine */
;/* Replace characters from [pcaDel->cpFirst,pcaDel->cpLim) with characters
; from [pcaIns->cpFirst,pcaIns->cpLim) */
;BOOL FReplaceCps(pcaDel, pcaIns)
;struct CA *pcaDel, *pcaIns;
;{
; struct XBC xbc;
; struct XSR *pxsr;
;#define ixsrReplaceCpsMax WinMac(10,8)
; struct XSR rgxsr[ixsrReplaceCpsMax];
; %%Function:N_FReplaceCps %%Owner:BRADV
cProc N_FReplaceCps,<PUBLIC,FAR>,<si,di>
ParmW pcaDel
ParmW pcaIns
LocalV xbc,cbXbcMin
LocalV rgxsr,10*cbXsrMin
cBegin
; Assert(pcaDel->cpFirst >= cp0 && pcaDel->cpLim <= CpMac1Doc(pcaDel->doc));
; Assert(DcpCa(pcaDel) >= cp0 && DcpCa(pcaIns) >= cp0);
ifdef DEBUG
push ax
push bx
push cx
push dx
push si
mov si,[pcaDel]
cmp [si.HI_cpFirstCa],0
jge FRC01
mov ax,midEditn2
mov bx,1017
cCall AssertProcForNative,<ax,bx>
FRC01:
cCall CpMac1Doc,<[si.docCa]>
sub ax,[si.LO_cpLimCa]
sbb dx,[si.HI_cpLimCa]
jge FRC02
mov ax,midEditn2
mov bx,1018
cCall AssertProcForNative,<ax,bx>
FRC02:
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
call LN_DcpCa
or dx,dx
jge FRC03
mov ax,midEditn2
mov bx,1019
cCall AssertProcForNative,<ax,bx>
FRC03:
mov si,[pcaIns]
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
call LN_DcpCa
or dx,dx
jge FRC04
mov ax,midEditn2
mov bx,1020
cCall AssertProcForNative,<ax,bx>
FRC04:
pop si
pop dx
pop cx
pop bx
pop ax
endif ;DEBUG
; if (vrulss.caRulerSprm.doc != docNil)
; FlushRulerSprms();
;LN_FlushRulerSprms performs
;if (vrulss.caRulerSprm.doc != docNil)
; FlushRulerSprms();
;ax, bx, cx, dx are altered.
call LN_FlushRulerSprms
; pxsr = (struct XSR *)PxsInit(rgxsr, ixsrReplaceCpsMax, &xbc);
;LN_PxsInit takes pxs in si, ixsMax in cx, pxbc in bx
;and performs PxsInit(pxs, ixsMax, pxbc).
;ax, bx, cx, dx, di are altered. The result is returned in si.
lea si,[rgxsr]
mov cx,10
lea bx,[xbc]
call LN_PxsInit
; pxsr->pcaDel = pcaDel;
; pxsr->pcaIns = pcaIns;
mov ax,[pcaDel]
mov [si.pcaDelXsr],ax
mov ax,[pcaIns]
mov [si.pcaInsXsr],ax
; XReplaceCps(fTrue, &xbc, pxsr);
mov ax,fTrue
lea di,[xbc]
push ax
push di
push si
ifdef DEBUG
cCall S_XReplaceCps,<>
else ;!DEBUG
push cs
call near ptr N_XReplaceCps
endif ;!DEBUG
; if (!FDoTns(&xbc))
; {
;LN_FDoTns takes pxbc in di and performs FDoTns(pxbc).
;fTrue is returned iff carry is true upon return.
;ax, bx, cx, dx are altered.
call LN_FDoTns
jc FRC05
; SetErrorMat(matReplace);
; return fFalse;
mov ax,matReplace
cCall SetErrorMatProc,<ax>
jmp short FRC08
; }
FRC05:
; BeginCommit();
;#define BeginCommit() AssertDo(!vfInCommit++)
ifdef DEBUG
cmp [vfInCommit],0
je FRC06
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1021
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FRC06:
endif ;DEBUG
inc [vfInCommit]
; XReplaceCps(fFalse, &xbc, pxsr);
errnz <fFalse>
xor ax,ax
push ax
push di
push si
ifdef DEBUG
cCall S_XReplaceCps,<>
else ;!DEBUG
push cs
call near ptr N_XReplaceCps
endif ;!DEBUG
; EndCommit();
;#define EndCommit() AssertDo(!--vfInCommit)
dec [vfInCommit]
ifdef DEBUG
je FRC07
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1022
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
FRC07:
endif ;DEBUG
; CloseTns(&xbc);
;LN_CloseTns takes &xbc in di and performs CloseTns.
;ax, bx, cx, dx are altered.
call LN_CloseTns
; return fTrue;
db 0B8h ;turns next "xor ax,ax" into "mov ax,immediate"
FRC08:
xor ax,ax
;}
cEnd
;-------------------------------------------------------------------------
; XReplaceCps(fPlan, pxbc, pxsr)
;-------------------------------------------------------------------------
;/* X R E P L A C E C P S */
;XReplaceCps(fPlan, pxbc, pxsr)
;BOOL fPlan;
;struct XBC *pxbc;
;struct XSR *pxsr;
;{
; struct PLC **hplcpcdDest, **hplcpcdSrc;
; int ipcdFirst, ipcdInsFirst, ipcdLim;
; int cpcd;
; struct CA *pcaDel = pxsr->pcaDel;
; struct CA *pcaIns = pxsr->pcaIns;
; int docDel = pcaDel->doc;
; int docIns = pcaIns->doc;
; CP dcpDel = DcpCa(pcaDel);
; CP dcpIns = DcpCa(pcaIns);
; struct DOD **hdodSrc = mpdochdod[docIns];
; struct DOD **hdodDest = mpdochdod[docDel];
; struct PCD pcd;
; %%Function:N_XReplaceCps %%Owner:BRADV
cProc N_XReplaceCps,<PUBLIC,FAR>,<si,di>
ParmW fPlan
ParmW pxbc
ParmW pxsr
LocalW ipcdFirst
LocalW ipcdLim
LocalW ipcdInsFirst
LocalW hplcpcdSrc
LocalW hplcpcdDest
LocalD dcpIns
LocalD dcpDel
LocalV pcd,cbPcdMin
LocalV caDel,cbCaMin
LocalV caIns,cbCaMin
LocalV xbc,cbXbcMin
LocalV rgxsr,10*cbXsrMin
ifdef DEBUG
LocalV rgchAttempt,42
LocalV rgchEditn,10
endif ;DEBUG
cBegin
;#ifdef DEBUG
ifdef DEBUG
; if (fPlan)
; /* no point doing all this twice! */
; {
cmp [fPlan],fFalse
jne Ltemp009
jmp XRC12
Ltemp009:
push ax
push bx
push cx
push dx
push si
; Assert(pcaDel->cpFirst >= cp0 && pcaDel->cpLim <= CpMac1Doc(docDel));
mov bx,[pxsr]
mov si,[bx.pcaDelXsr]
cmp [si.HI_cpFirstCa],0
jge XRC01
mov ax,midEditn2
mov bx,1023
cCall AssertProcForNative,<ax,bx>
XRC01:
cCall CpMac1Doc,<[si.docCa]>
sub ax,[si.LO_cpLimCa]
sbb dx,[si.HI_cpLimCa]
jge XRC02
mov ax,midEditn2
mov bx,1024
cCall AssertProcForNative,<ax,bx>
XRC02:
; Assert(dcpDel >= 0 && dcpIns >= cp0);
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
mov bx,[pxsr]
mov si,[bx.pcaDelXsr]
call LN_DcpCa
or dx,dx
jge XRC03
mov ax,midEditn2
mov bx,1025
cCall AssertProcForNative,<ax,bx>
XRC03:
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
mov bx,[pxsr]
mov si,[bx.pcaInsXsr]
call LN_DcpCa
or dx,dx
jge XRC04
mov ax,midEditn2
mov bx,1026
cCall AssertProcForNative,<ax,bx>
XRC04:
; Assert(docDel != docIns);
mov bx,[pxsr]
mov si,[bx.pcaDelXsr]
mov ax,[si.docCa]
mov si,[bx.pcaInsXsr]
cmp ax,[si.docCa]
jne XRC05
mov ax,midEditn2
mov bx,1027
cCall AssertProcForNative,<ax,bx>
XRC05:
; /* assured by caller */
; Assert(vrulss.caRulerSprm.doc == docNil);
cmp [vrulss.caRulerSprmRulss.docCa],docNil
je XRC06
mov ax,midEditn2
mov bx,1028
cCall AssertProcForNative,<ax,bx>
XRC06:
; /* assure that if vdocScratch is being used, it has been "Acquired" */
; Assert ((vdocScratch == docNil || (docDel != vdocScratch &&
; docIns != vdocScratch) || fDocScratchInUse));
mov ax,[vdocScratch]
cmp ax,docNil
je XRC08
cmp [fDocScratchInUse],fFalse
jne XRC08
cmp ax,[si.docCa]
je XRC07
mov bx,[pxsr]
mov bx,[bx.pcaDelXsr]
cmp ax,[bx.docCa]
jne XRC08
XRC07:
mov ax,midEditn2
mov bx,1029
cCall AssertProcForNative,<ax,bx>
XRC08:
; /* check that deleted portion is legal WRT fields */
; AssertSz(!vdbs.fCkFldDel || FCkFldForDelete(docDel, pcaDel->cpFirst, pcaDel->cpLim)
; && FCkFldForDelete(pcaIns->doc, pcaIns->cpFirst, pcaIns->cpLim),
; "Attempt to delete unmatched field char!");
;#define AssertSz(f,sz) ((f) ? 0 : AssertSzProc(SzFrame(sz),(CHAR *)szAssertFile,__LINE__))
cmp [vdbs.fCkFldDelDbs],fFalse
je Ltemp007
mov bx,[pxsr]
mov si,[bx.pcaDelXsr]
push [si.docCa]
push [si.HI_cpFirstCa]
push [si.LO_cpFirstCa]
push [si.HI_cpLimCa]
push [si.LO_cpLimCa]
cCall FCkFldForDelete,<>
or ax,ax
je Ltemp008
mov bx,[pxsr]
mov si,[bx.pcaInsXsr]
push [si.docCa]
push [si.HI_cpFirstCa]
push [si.LO_cpFirstCa]
push [si.HI_cpLimCa]
push [si.LO_cpLimCa]
cCall FCkFldForDelete,<>
or ax,ax
je Ltemp008
Ltemp007:
jmp XRC11
Ltemp008:
push si
push di
push ds
push es
push cs
pop ds
push ss
pop es
mov si,offset szAttempt2
lea di,[rgchAttempt]
mov cx,cbSzAttempt2
rep movsb
jmp short XRC09
szAttempt2:
db 'Attempt to delete unmatched field char! ',0
cbSzAttempt2 equ $ - szAttempt2
errnz <cbSzAttempt2 - 41>
XRC09:
mov si,offset szEditn2
lea di,[rgchEditn]
mov cx,cbSzEditn2
rep movsb
jmp short XRC10
szEditn2:
db 'editn.asm',0
cbSzEditn2 equ $ - szEditn2
errnz <cbSzEditn2 - 10>
XRC10:
pop es
pop ds
pop di
pop si
lea ax,[rgchAttempt]
lea bx,[rgchEditn]
mov cx,1027
cCall AssertSzProc,<ax,bx,cx>
XRC11:
; }
;#endif /* DEBUG */
pop si
pop dx
pop cx
pop bx
pop ax
XRC12:
endif ;DEBUG
; if (dcpIns == 0)
; /* This is just too easy . . . */
; {
mov di,[pxsr]
mov si,[di.pcaInsXsr]
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
call LN_DcpCa
mov [OFF_dcpIns],ax
mov [SEG_dcpIns],dx
or ax,dx
jne XRC13
; pxsr->fn = fnNil;
; pxsr->fc = fc0;
; pxsr->dfc = fc0;
errnz <fcXsr - dfcXsr - 4>
errnz <fnXsr - fcXsr - 4>
push ds
pop es
errnz <fnNil - 0>
xor ax,ax
push di ;save pxsr
errnz <([dfcXsr]) - 0>
errnz <(([fnXsr]) - ([dfcXsr])) AND 1>
mov cx,(([fnXsr]) - ([dfcXsr]) + 2) SHR 1
rep stosw
pop di ;restore pxsr
; XReplace(fPlan, pxbc, pxsr);
push [fPlan]
push [pxbc]
push di
ifdef DEBUG
cCall S_XReplace,<>
else ;!DEBUG
push cs
call near ptr N_XReplace
endif ;!DEBUG
; return;
; }
jmp XRC40
XRC13:
; hplcpcdDest = (*hdodDest)->hplcpcd;
;Assembler note: We initialize hplcpcdDest when
;it is most convenient, not here.
; hplcpcdSrc = (*hdodSrc)->hplcpcd;
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
mov cx,[bx.hplcpcdDod]
mov [hplcpcdSrc],cx
; if (dcpDel != cp0)
; {
;/* delete structures for text being deleted */
; XDeleteStruct(fPlan, pxbc, pxsr);
;Assumes bx = pxbc, cx = fPlan, si = pca, di = pxsr
;ax, bx, cx, dx are altered.
mov bx,[pxbc]
mov cx,[fPlan]
call LN_XDeleteStruct
; if (!fPlan && !vfNoInval)
; InvalParaSect(pcaDel, pcaIns, fFalse);
mov ax,[vfNoInval]
or ax,[fPlan]
jne XRC14
cCall InvalParaSect,<si, [di.pcaInsXsr], ax>
XRC14:
;/* Get the first and last pieces for insertion */
; if (fPlan)
; {
; ipcdInsFirst = pxsr->ipcdInsFirst =
; IInPlc(hplcpcdSrc, pcaIns->cpFirst);
; pxsr->ipcdInsLast = IInPlc(hplcpcdSrc, pcaIns->cpLim - 1);
; pxsr->fNotEmptyPcaDel = (dcpDel != 0);
; }
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
mov cx,[bx.hplcpcdDod]
mov [hplcpcdDest],cx
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
call LN_DcpCa
mov [OFF_dcpDel],ax
mov [SEG_dcpDel],dx
cmp [fPlan],fFalse
je XRC15
or ax,dx
mov [di.fNotEmptyPcaDelXsr],ax
mov bx,[di.pcaInsXsr]
mov cx,[hplcpcdSrc]
push cx ;for IInPlc(hplcpcdSrc, pcaIns->cpFirst);
push [bx.HI_cpFirstCa] ;for IInPlc(hplcpcdSrc, pcaIns->cpFirst);
push [bx.LO_cpFirstCa] ;for IInPlc(hplcpcdSrc, pcaIns->cpFirst);
mov ax,-1
cwd
add ax,[bx.LO_cpLimCa]
adc dx,[bx.HI_cpLimCa]
cCall IInPlc,<cx,dx,ax>
mov [di.ipcdInsLastXsr],ax
cCall IInPlc,<>
mov [di.ipcdInsFirstXsr],ax
; else
; ipcdInsFirst = pxsr->ipcdInsFirst;
XRC15:
mov ax,[di.ipcdInsFirstXsr]
mov [ipcdInsFirst],ax
;/* get the limiting pieces for deletion */
; if (fPlan)
; {
; ipcdFirst = IpcdSplit(hplcpcdDest, pcaDel->cpFirst);
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
push [di.fNotEmptyPcaDelXsr]
mov di,[hplcpcdDest]
mov dx,[si.HI_cpFirstCa]
mov ax,[si.LO_cpFirstCa]
call LN_IpcdSplit
mov [ipcdFirst],ax
pop cx ;restore pxsr->fNotEmptyPcaDel
; ipcdLim = (pxsr->fNotEmptyPcaDel) ?
; IpcdSplit(hplcpcdDest, pcaDel->cpLim) : ipcdFirst;
;
;/* check for failure of IpcdSplit */
; if (ipcdFirst == iNil || ipcdLim == iNil)
; {
; PostTn(pxbc, tntAbort, NULL, 0);
; return;
; }
cmp [fPlan],fFalse
je XRC19
jcxz XRC16
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
mov dx,[si.HI_cpLimCa]
mov ax,[si.LO_cpLimCa]
call LN_IpcdSplit
XRC16:
mov [ipcdLim],ax
errnz <iNil - (-1)>
inc ax
je XRC17
mov ax,[ipcdFirst]
errnz <iNil - (-1)>
inc ax
jne XRC18
XRC17:
;LN_PostTn takes pxbc in bx, tnt in ax, c in cx, h in dx and
;performs PostTn(pxbc, tnt, h, c).
;ax, bx, cx, dx are altered.
mov ax,tntAbort
mov bx,[pxbc]
errnz <NULL>
xor cx,cx
xor dx,dx
call LN_PostTn
jmp XRC40
XRC18:
; /* number of pieces to be added */
; pxsr->cpcd = cpcd = ipcdFirst - ipcdLim + pxsr->ipcdInsLast - ipcdInsFirst +1;
; }
mov dx,di ;save hplcpcdDest for call to PostTn
mov di,[pxsr]
mov ax,[ipcdFirst]
sub ax,[ipcdLim]
add ax,[di.ipcdInsLastXsr]
sub ax,[ipcdInsFirst]
inc ax
mov [di.cpcdXsr],ax
;Assembler note: This PostTn call has been moved from below
;LN_PostTn takes pxbc in bx, tnt in ax, c in cx, h in dx and
;performs PostTn(pxbc, tnt, h, c).
;ax, bx, cx, dx are altered.
; PostTn(pxbc, tntHplc, hplcpcdDest, cpcd);
xchg ax,cx
mov ax,tntHplc
mov bx,[pxbc]
call LN_PostTn
jmp XRC27
; else
; {
; ipcdFirst = IpcdSplit(hplcpcdDest, pcaDel->cpFirst);
; cpcd = pxsr->cpcd;
XRC19:
;Assembler note: ipcdFirst has already been computed
mov di,[pxsr]
; Assert(cpcd == ipcdFirst + pxsr->ipcdInsLast - ipcdInsFirst + 1
; - ((pxsr->fNotEmptyPcaDel) ?
; IpcdSplit(hplcpcdDest, pcaDel->cpLim) : ipcdFirst));
; }
ifdef DEBUG
push ax
push bx
push cx
push dx
mov ax,[ipcdFirst]
;LN_IpcdSplit takes hplcpcd in di, cp in dx:ax and performs
;IpcdSplit(hplcpcd, cp). The result is returned in ax.
;ax, bx, cx, dx are altered.
cmp [di.fNotEmptyPcaDelXsr],fFalse
je XRC20
push di ;save pxsr
mov di,[hplcpcdDest]
mov dx,[si.HI_cpLimCa]
mov ax,[si.LO_cpLimCa]
call LN_IpcdSplit
pop di ;restore pxsr
XRC20:
neg ax
add ax,[ipcdFirst]
add ax,[di.ipcdInsLastXsr]
sub ax,[ipcdInsFirst]
inc ax
cmp ax,[di.cpcdXsr]
je XRC21
mov ax,midEditn2
mov bx,1030
cCall AssertProcForNative,<ax,bx>
XRC21:
pop dx
pop cx
pop bx
pop ax
endif ;DEBUG
; if (fPlan)
; PostTn(pxbc, tntHplc, hplcpcdDest, cpcd);
;
; else
; {
;Assembler note: The fPlan test, and the call to PostTn have been
;done above
; if (!vfNoInval)
; /* may call CachePara or FetchCp, must call BEFORE changing piece tbl */
; InvalText (pcaDel, fTrue /* fEdit */);
mov ax,[vfNoInval]
or ax,ax
jne XRC215
errnz <fTrue - fFalse - 1>
inc ax
cCall InvalText,<si,ax>
XRC215:
;/* set so vhprc chain is checked when we run out of memory */
; vmerr.fReclaimHprcs = fTrue;
or [vmerr.fReclaimHprcsMerr],maskFReclaimHprcsMerr
;/* adjust pctb size; get pointer to the first new piece, ppcdDest, and to the
;first piece we are inserting. */
; AssertDo(FOpenPlc(hplcpcdDest, ipcdFirst, cpcd));
push [hplcpcdDest]
push [ipcdFirst]
push [di.cpcdXsr]
ifdef DEBUG
cCall S_FOpenPlc,<>
else ;not DEBUG
cCall N_FOpenPlc,<>
endif ;DEBUG
ifdef DEBUG
;Perform the AssertDo with a call so as not to mess up short jumps.
call XRC41
endif ;DEBUG
; FreezeHp();
ifdef DEBUG
call LN_FreezeHpEdit
endif ;DEBUG
;/* ensure rgcp in hplcpcdSrc is adjusted before we copy cps. */
; if (((struct PLC *)*hplcpcdSrc)->icpAdjust < ipcdInsFirst + 1)
; AdjustHplcCpsToLim(hplcpcdSrc, ipcdInsFirst + 1);
mov si,[hplcpcdSrc]
mov bx,[si]
mov ax,[ipcdInsFirst]
push ax ;save ipcdInsFirst
inc ax
cmp [bx.icpAdjustPlc],ax
jge XRC22
push si
push ax
push cs
call near ptr AdjustHplcCpsToLim
XRC22:
pop ax ;restore ipcdInsFirst
;/* fill first new piece and split it appropriately */
; GetPlc(hplcpcdSrc, ipcdInsFirst, &pcd);
push si ;argument for CpPlc
push ax ;argument for CpPlc
lea bx,[pcd]
cCall GetPlc,<si, ax, bx>
; pcd.fc += (pcaIns->cpFirst - CpPlc(hplcpcdSrc, ipcdInsFirst));
cCall CpPlc,<>
mov si,[di.pcaInsXsr]
sub ax,[si.LO_cpFirstCa]
sbb dx,[si.HI_cpFirstCa]
sub [pcd.LO_fcPcd],ax
sbb [pcd.HI_fcPcd],dx
; pcd.fCopied = fTrue; /* para heights invalid */
or [pcd.fCopiedPcd],maskFCopiedPcd
; PutPlc(hplcpcdDest, ipcdFirst, &pcd);
; PutCpPlc(hplcpcdDest, ipcdFirst, pcaDel->cpFirst);
; ipcdLim = ipcdFirst + 1;
mov si,[di.pcaDelXsr]
mov cx,[hplcpcdDest]
mov ax,[ipcdFirst]
push cx ;argument for PutCpPlc
push ax ;argument for PutCpPlc
push [si.HI_cpFirstCa] ;argument for PutCpPlc
push [si.LO_cpFirstCa] ;argument for PutCpPlc
lea bx,[pcd]
push cx
push ax
push bx
inc ax
mov [ipcdLim],ax
cCall PutPlc,<>
cCall PutCpPlc,<>
; if ((cpcd = pxsr->ipcdInsLast - ipcdInsFirst) != 0)
; {
mov cx,[di.ipcdInsLastXsr]
sub cx,[ipcdInsFirst]
jcxz XRC23
;/* fill in rest of inserted pieces */
; ipcdLim += cpcd;
add [ipcdLim],cx
; CopyMultPlc(cpcd, hplcpcdSrc, ipcdInsFirst + 1,
; hplcpcdDest, ipcdFirst + 1,
; pcaDel->cpFirst - pcaIns->cpFirst, 0, 0);
push cx
push [hplcpcdSrc]
mov cx,[ipcdInsFirst]
inc cx
push cx
push [hplcpcdDest]
mov cx,[ipcdFirst]
inc cx
push cx
mov ax,[si.LO_cpFirstCa]
mov dx,[si.HI_cpFirstCa]
mov bx,[di.pcaInsXsr]
sub ax,[bx.LO_cpFirstCa]
sbb dx,[bx.HI_cpFirstCa]
push dx
push ax
xor cx,cx
push cx
push cx
cCall CopyMultPlc,<>
; }
XRC23:
;/* adjust rest of pieces in destination doc */
; AdjustHplc(hplcpcdDest, pcaDel->cpLim, /*dcpAdj*/dcpIns - dcpDel,
; ipcdLim);
push [hplcpcdDest]
push [si.HI_cpLimCa]
push [si.LO_cpLimCa]
mov ax,[OFF_dcpIns]
mov dx,[SEG_dcpIns]
sub ax,[OFF_dcpDel]
sbb dx,[SEG_dcpDel]
push dx
push ax
push [ipcdLim]
push cs
call near ptr AdjustHplc
;/* and inform anyone else who cares */
; (*hdodDest)->fFormatted |= (pcaIns->doc == docScrap) ?
; vsab.fFormatted : (*hdodSrc)->fFormatted;
; PdodMother(docDel)->fMayHavePic |= (docIns == docScrap) ?
; vsab.fMayHavePic : PdodMother(docIns)->fMayHavePic;
mov si,[di.pcaInsXsr]
errnz <(fMayHavePicSab) - (fFormattedSab) - 1>
mov ax,wptr ([vsab.fFormattedSab])
and ax,maskFFormattedSab + (maskFMayHavePicSab SHL 8)
add al,0FFh
sbb al,al
add ah,0FFh
sbb ah,ah
cmp [si.docCa],docScrap
je XRC24
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
mov al,[bx.fFormattedDod]
push ax ;save flags
cCall N_PdodMother,<[si.docCa]>
xchg ax,bx
pop ax ;restore flags
mov ah,[bx.fMayHavePicDod]
XRC24:
and ax,maskFFormattedDod + (maskFMayHavePicDod SHL 8)
mov si,[di.pcaDelXsr]
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
or [bx.fFormattedDod],al
push ax ;save flags
cCall N_PdodMother,<[si.docCa]>
xchg ax,bx
pop ax ;restore flags
or [bx.fMayHavePicDod],ah
; if (!vfNoInval)
; {
; InvalCp1(pcaDel);
; Win( InvalText (pcaDel, fTrue /* fEdit */) );
; }
; else
; /* inval the caches even if vfNoInval on */
; InvalCaFierce();
;LN_DoInval assumes pca passed in si and performs
;if (!vfNoInval) { InvalCp1(pca); }
;else InvalCaFierce();
;ax, bx, cx, dx are altered.
call LN_DoInval
; /* invalidate FetchCpPccpVisible */
;#define InvalVisiCache() (vdocFetchVisi = docNil)
;#define InvalCellCache() (vcaCell.doc = docNil)
; InvalVisiCache();
; InvalCellCache();
;FUTURE: It seems like we should not have to invalidate
; vdocFetchVisi and vcaCell here because both InvalCaFierce
; and InvalCp1 do it for us, but InvalText calls InvalDde
; which indirectly causes vcaCell to get set up again if
; there is a table.
errnz <docNil>
xor ax,ax
mov [vdocFetchVisi],ax
mov [vcaCell.docCa],ax
; MeltHp();
ifdef DEBUG
call LN_MeltHpEdit
endif ;DEBUG
; AdjustCp(pcaDel, dcpIns);
;/* NOTE after this point pcaDel->cpLim may be untrustworthy because it may
; have been adjusted as a side effect of AdjustCp (eg. selCur.ca) */
push si
push [SEG_dcpIns]
push [OFF_dcpIns]
ifdef DEBUG
cCall S_AdjustCp,<>
else ;!DEBUG
push cs
call near ptr N_AdjustCp
endif ;!DEBUG
; }
XRC27:
;/* copy enclosed structures and subdocs */
;/* copy any enclosed fields */
; if (FFieldsInPca(pcaIns))
; XCopyFields(fPlan, pxbc, pcaIns, pcaDel);
;LN_FFieldsInPca assumes pca passed in si and performs
;FFieldsInPca(pca). ax, bx, cx, dx are altered.
;The sign bit set reflects a true result
mov si,[di.pcaInsXsr]
call LN_FFieldsInPca
jns XRC28
cCall XCopyFields,<[fPlan], [pxbc], si, [di.pcaDelXsr]>
XRC28:
;/* page table: if there is a table to be updated, call routine. Even if
;the source table is empty, the destination will have to be invalidated. */
; if ((*hdodDest)->hplcpgd)
; {
; XAddToHplcEdit(fPlan, pxbc, &pxsr->xsaPgdCopy, pcaIns, pcaDel,
; edcPgd);
; InvalLlc();
;#define InvalLlc()
; }
;#define edcPgd (offset(DOD, hplcpgd) / sizeof(int))
;XRC43 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov si,[di.pcaDelXsr]
mov dx,([xsaPgdDelXsr])
mov al,([hplcpgdDod]) SHR 1
call XRC43
; if (!(*hdodSrc)->fShort && !(*hdodDest)->fShort)
; {
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
push wptr ([bx.fShortDod])
mov si,[di.pcaInsXsr]
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
pop ax
or al,[bx.fShortDod]
je Ltemp011
jmp XRC40
Ltemp011:
;/* copy any bookmarks in the source document which are fully enclosed
; in the insertion range to the destination document */
; if ((*hdodSrc)->hsttbBkmk != hNil)
; XCopyBkmks(fPlan, pxbc, &pxsr->xsbCopy, pcaIns, pcaDel);
cmp [bx.hsttbBkmkDod],hNil
je XRC29
lea dx,[di.xsbCopyXsr]
cCall XCopyBkmks,<[fPlan], [pxbc], dx, si, [di.pcaDelXsr]>
XRC29:
;/* copy any anotations along with their reference marks */
; if ((*hdodSrc)->docAtn != docNil)
; XAddReferencedText(fPlan, pxbc, &pxsr->xsfAtnCopy, pcaIns, pcaDel,
; edcDrpAtn);
;#define edcDrpAtn (offset(DOD,drpAtn)/sizeof(int))
;XRC47 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddReferencedText(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov dx,([xsfAtnCopyXsr])
mov al,([drpAtnDod]) SHR 1
call XRC47
;/* copy any footnotes along with their reference marks */
; if ((*hdodSrc)->docFtn != docNil)
; XAddReferencedText(fPlan, pxbc, &pxsr->xsfFtnCopy, pcaIns, pcaDel,
; edcDrpFtn);
;#define edcDrpFtn (offset(DOD,drpFtn)/sizeof(int))
;XRC47 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddReferencedText(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov dx,([xsfFtnCopyXsr])
mov al,([drpFtnDod]) SHR 1
call XRC47
;/* if there are any sections call AddHplcEdit to copy entries from
;one hplcsed to the other */
; if ((*hdodSrc)->hplcsed)
; {
xor ax,ax
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
errnz <docNil - 0>
cmp [bx.hplcSedDod],ax
je XRC31
; caSect.doc = docNil;
mov [caSect.docCa],ax
; if ((*hdodSrc)->docHdr != docNil || (*hdodDest)->docHdr != docNil)
; {
mov ax,[bx.docHdrDod]
push si ;save pcaIns
mov si,[di.pcaDelXsr]
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
pop si ;restore pcaIns
errnz <docNil - 0>
or ax,[bx.docHdrDod]
je XRC30
; XAddHdrText(fPlan, pxbc, pcaIns, pcaDel);
cCall XAddHdrText,<[fPlan], [pxbc], si, [di.pcaDelXsr]>
; caSect.doc = docNil; /* XAdd.. called CacheSect */
errnz <docNil - 0>
xor ax,ax
mov [caSect.docCa],ax
; }
XRC30:
; XAddToHplcEdit(fPlan, pxbc, &pxsr->xsaSedCopy, pcaIns, pcaDel,
; edcSed);
; InvalLlc();
;#define InvalLlc()
;XRC43 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaSedCopyXsr])
mov al,([hplcsedDod]) SHR 1
call XRC43
; }
XRC31:
; if ((*hdodSrc)->fSea && (*hdodSrc)->hplcsea)
; XAddToHplcEdit(fPlan, pxbc, &pxsr->xsaSeaCopy, pcaIns, pcaDel,
; edcSea);
;#define edcSea (offset(DOD, hplcsea) / sizeof(int))
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
test [bx.fSeaDod],maskFSeaDod
je XRC32
;XRC43 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaSeaCopyXsr])
mov al,([hplcseaDod]) SHR 1
call XRC43
XRC32:
;/* outline table: as for page table */
; if (fPlan)
; pxsr->fNotDelPassCpMac = (pcaDel->cpFirst < (CpMacDoc(docDel)+dcpIns-dcpDel));
mov si,[di.pcaDelXsr]
cmp [fPlan],fFalse
je XRC34
cCall CpMacDoc,<[si.docCa]>
mov bx,[OFF_dcpDel]
mov cx,[SEG_dcpDel]
sub bx,[OFF_dcpIns]
sbb cx,[SEG_dcpIns]
sub bx,ax
sbb cx,dx
errnz <fFalse>
xor ax,ax
add bx,[si.LO_cpFirstCa]
adc cx,[si.HI_cpFirstCa]
jge XRC33
errnz <fTrue - fFalse - 1>
inc ax
XRC33:
mov [di.fNotDelPassCpMacXsr],ax
XRC34:
; if (((*hdodDest)->hplcpad || (*hdodSrc)->hplcpad) &&
; pxsr->fNotDelPassCpMac && (*hdodDest)->dk != dkGlsy)
; {
; XAddToHplcEdit(fPlan, pxbc, &pxsr->xsaPadCopy, pcaIns, pcaDel,
; edcPad);
; }
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
cmp [bx.dkDod],dkGlsy
je XRC35
cmp [di.fNotDelPassCpMacXsr],fFalse
je XRC35
push si ;save pcaDel
mov si,[di.pcaInsXsr]
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
pop si ;restore pcaDel
;XRC44 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if ((cx | hplc) != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov cx,[bx.hplcpadDod]
mov dx,([xsaPadCopyXsr])
mov al,([hplcpadDod]) SHR 1
call XRC44
XRC35:
;/* height table */
; if ((*hdodDest)->hplcphe)
; XAddToHplcEdit(fPlan, pxbc, &pxsr->xsaPheCopy, pcaIns, pcaDel,
; edcPhe);
;XRC43 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaPheCopyXsr])
mov al,([hplcpheDod]) SHR 1
call XRC43
;/* we will replace docDest's hidden section character with the hidden section
; mark from docSrc only if we are not already copying the section mark,
; we are copying the tail of docIns to the tail of docDel, the text
; copied from docIns does not end with a section mark, and if docSrc is
; guarded (ie. == docScrap or docUndo) the hidden section character had to
; have been copied from the original document. */
; if (fPlan)
; {
cmp [fPlan],fFalse
jne Ltemp010
jmp XRC39
Ltemp010:
; CP cpTailIns = CpTail(docIns);
; struct DOD *pdodIns;
;/* Note that no cps have been adjusted yet */
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
mov cx,si
mov si,[di.pcaInsXsr]
mov di,bx
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
; pxsr->fReplHidnSect =
; pcaDel->cpFirst + dcpDel <= CpMacDoc(docDel) &&
;*hdodSrc in bx, pcaDel in cx, pcaIns in si, *hdodDest in di
;***Begin in line CpMacDoc
;return ((*mpdochdod[doc]->cpMac - 2*ccpEop);
mov ax,-2*ccpEop
cwd
add ax,[di.LO_cpMacDod]
adc dx,[di.HI_cpMacDod]
;***End in line CpMacDoc
xchg cx,si
sub ax,[si.LO_cpFirstCa]
sbb dx,[si.HI_cpFirstCa]
xchg cx,si
sub ax,[OFF_dcpDel]
sbb dx,[SEG_dcpDel]
jl XRC38
; pcaIns->cpFirst < CpMacDoc(docIns) &&
;*hdodSrc in bx, pcaDel in cx, pcaIns in si, *hdodDest in di
;***Begin in line CpMacDoc
;return ((*mpdochdod[doc]->cpMac - 2*ccpEop);
mov ax,2*ccpEop
cwd
sub ax,[bx.LO_cpMacDod]
sbb dx,[bx.HI_cpMacDod]
;***End in line CpMacDoc
add ax,[si.LO_cpFirstCa]
adc dx,[si.HI_cpFirstCa]
jge XRC38
; pcaIns->cpLim >= cpTailIns &&
; !FSectLimAtCp(docIns, cpTailIns) &&
;Assembler note: do these two lines involving cpTailIns later
;to avoid messing up registers
; pcaDel->cpLim >= CpTail(docDel) -
; ((!PdodDoc(docDel)->fGuarded) ? ccpEop : cp0) &&
;*hdodSrc in bx, pcaDel in cx, pcaIns in si, *hdodDest in di
;***Begin in line CpTail
;return (PdodDoc(doc)->fGuarded ? CpMacDocEdit(doc) : CpMacDoc(doc));
;Assembler note: The following line is CpMacDocEdit.
;return(CpMacDoc(doc) - ccpEop);
;Assembler note: This means that the above expression involving
;CpTail reduces to (CpMacDoc(doc) - ccpEop).
mov ax,3*ccpEop
cwd
sub ax,[di.LO_cpMacDod]
sbb dx,[di.HI_cpMacDod]
;***End in line CpTail
xchg cx,si
add ax,[si.LO_cpLimCa]
adc dx,[si.HI_cpLimCa]
xchg cx,si
jl XRC38
; (!(pdodIns=PdodDoc(docIns))->fGuarded ||
test [bx.fGuardedDod],maskFGuardedDod
je XRC36
; (pdodIns->fSedMacEopCopied && (dcpDel > cp0 || dcpIns == CpMacDocEdit(docIns))));
test [bx.fSedMacEopCopiedDod],maskFSedMacEopCopiedDod
je XRC38
xor ax,ax
cmp ax,[OFF_dcpDel]
sbb ax,[SEG_dcpDel]
jl XRC36
;***Begin in line CpMacDocEdit
;return(CpMacDoc(doc) - ccpEop);
mov ax,-3*ccpEop
cwd
add ax,[bx.LO_cpMacDod]
adc dx,[bx.HI_cpMacDod]
;***End in line CpMacDocEdit
sub ax,[OFF_dcpIns]
sbb dx,[SEG_dcpIns]
or ax,dx
jne XRC38
XRC36:
; CP cpTailIns = CpTail(docIns);
; pcaIns->cpLim >= cpTailIns &&
; !FSectLimAtCp(docIns, cpTailIns) &&
;Assembler note: These three lines are done above in the C version
;*hdodSrc in bx, pcaDel in cx, pcaIns in si, *hdodDest in di
;***Begin in line CpTail
;return (PdodDoc(doc)->fGuarded ? CpMacDocEdit(doc) : CpMacDoc(doc));
;Assembler note: The following line is CpMacDocEdit.
;return(CpMacDoc(doc) - ccpEop);
mov al,-3*ccpEop
test [bx.fGuardedDod],maskFGuardedDod
jne XRC37
mov al,-2*ccpEop
XRC37:
cbw
cwd
add ax,[bx.LO_cpMacDod]
adc dx,[bx.HI_cpMacDod]
;***End in line CpTail
cmp [si.LO_cpLimCa],ax
mov cx,[si.HI_cpLimCa]
sbb cx,dx
jl XRC38
cCall FSectLimAtCp,<[si.docCa], dx, ax>
or ax,ax
jne XRC38
; }
db 0B8h ;turns next "xor ax,ax" into "mov ax,immediate"
XRC38:
xor ax,ax
mov di,[pxsr]
mov [di.fReplHidnSectXsr],ax
XRC39:
; if (pxsr->fReplHidnSect)
; {
cmp [di.fReplHidnSectXsr],fFalse
je XRC40
; struct XSR *pxsrT = PxsAlloc(pxbc);
;***Begin in line PxsAlloc
mov bx,[pxbc]
; Assert(pxbc->ixsMac < pxbc->ixsMax);
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps
call XRC50
endif ;DEBUG
; return pxbc->rgxs + (cbXSR * pxbc->ixsMac++);
mov ax,cbXsrMin
mul [bx.ixsMacXbc]
inc [bx.ixsMacXbc]
mov si,[bx.rgxsXbc]
add si,ax
;***End in line PxsAlloc
; struct CA caDel, caIns;
; CheckPxs(fPlan, pxsrT, nxsHidnSect, 0);
;#ifdef DEBUG
;#define CheckPxs(fPlan,pxs,nxsT,wT) (fPlan ? (pxs->nxs=nxsT, pxs->w=wT) : \
; Assert(pxs->nxs==nxsT && pxs->w==wT))
;#else
;#define CheckPxs(fPlan,pxs,nxsT,wT)
;#endif /* DEBUG */
ifdef DEBUG
;Do this assert with a call so as not to mess up short jumps
call XRC52
endif ;DEBUG
; pxsrT->pcaDel = PcaSetDcp(&caDel, docDel, CpMac1Doc(docDel)-ccpEop,
; ccpEop);
mov bx,[di.pcaDelXsr]
lea ax,[caDel]
mov [si.pcaDelXsr],ax
call LN_PcaSetDcp
; pxsrT->pcaIns = PcaSetDcp(&caIns, docIns, CpMac1Doc(docIns)-ccpEop,
; ccpEop);
mov bx,[di.pcaInsXsr]
lea ax,[caIns]
mov [si.pcaInsXsr],ax
call LN_PcaSetDcp
; XReplaceCps(fPlan, pxbc, pxsrT);
push [fPlan]
push [pxbc]
push si
ifdef DEBUG
cCall S_XReplaceCps,<>
else ;!DEBUG
push cs
call near ptr N_XReplaceCps
endif ;!DEBUG
; if (!fPlan && PdodDoc(docDel)->fGuarded)
; PdodDoc(docDel)->fSedMacEopCopied = fTrue;
cmp [fPlan],fFalse
jne XRC40
mov si,[di.pcaDelXsr]
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
test [bx.fGuardedDod],maskFGuardedDod
je XRC40
or [bx.fSedMacEopCopiedDod],maskFSedMacEopCopiedDod
; }
; }
XRC40:
;}
cEnd
; AssertDo(FOpenPlc(hplcpcd, ipcdFirst, cpcd));
ifdef DEBUG
XRC41:
or ax,ax
jne XRC42
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1032
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XRC42:
ret
endif ;DEBUG
;XRC43 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
XRC43:
xor cx,cx
;XRC44 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if ((cx | hplc) != hNil)
; XAddToHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
XRC44:
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
ifdef DEBUG
or al,al
jns XRC45
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1033
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XRC45:
endif ;/* DEBUG */
cbw
add bx,ax
add bx,ax
or cx,[bx]
jcxz XRC46
push [fPlan]
push [pxbc]
add dx,di
push dx
push [di.pcaInsXsr]
push [di.pcaDelXsr]
push ax
cCall XAddToHplcEdit,<>
XRC46:
ret
;XRC47 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XAddReferencedText(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
;ax, bx, cx and dx are altered.
XRC47:
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
ifdef DEBUG
or al,al
jns XRC48
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1034
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XRC48:
endif ;/* DEBUG */
; XAddReferencedText(fPlan, pxbc, ((char *)pxsr) + dx,
; ((struct XSR *)di)->pcaIns, ((struct XSR *)di)->pcaDel, al);
cbw
add bx,ax
add bx,ax
mov cx,[bx]
jcxz XRC49
push [fPlan]
push [pxbc]
add dx,di
push dx
push [di.pcaInsXsr]
push [di.pcaDelXsr]
push ax
cCall XAddReferencedText,<>
XRC49:
ret
ifdef DEBUG
XRC50:
push ax
push bx
push cx
push dx
mov ax,[bx.ixsMacXbc]
cmp ax,[bx.ixsMaxXbc]
jl XRC51
mov ax,midEditn2
mov bx,1035
cCall AssertProcForNative,<ax,bx>
XRC51:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
ifdef DEBUG
XRC52:
push ax
push bx
push cx
push dx
cmp [fPlan],fFalse
je XRC53
mov [si.nxsXsr],nxsHidnSect
mov [si.wXsr],0
jmp short XRC55
XRC53:
cmp [si.nxsXsr],nxsHidnSect
jne XRC54
cmp [si.wXsr],0
je XRC55
XRC54:
mov ax,midEditn2
mov bx,1036
cCall AssertProcForNative,<ax,bx>
XRC55:
pop dx
pop cx
pop bx
pop ax
ret
endif ;DEBUG
LN_PcaSetDcp:
mov cx,[bx.docCa]
xchg ax,bx
mov [bx.docCa],cx
push bx
cCall CpMac1Doc,<cx>
pop bx
mov [bx.LO_cpLimCa],ax
mov [bx.HI_cpLimCa],dx
sub ax,ccpEop
sbb dx,0
mov [bx.LO_cpFirstCa],ax
mov [bx.HI_cpFirstCa],dx
ret
;-------------------------------------------------------------------------
; XDelFndSedPgdPad(fPlan, pxbc, pxsr)
;-------------------------------------------------------------------------
;/* X D E L F N D S E D P G D P A D */
;/* Delete all footnote/annotation text corresponding to refs in [cpFirst:cpLim)
;Also delete SED's for section marks and invalidate PGD's in the page table.
;*/
;EXPORT XDelFndSedPgdPad(fPlan, pxbc, pxsr)
;BOOL fPlan;
;struct XBC *pxbc;
;struct XSR *pxsr;
;{
; struct PLC **hplc;
; struct DOD **hdod;
; struct CA caT;
ifdef DEBUG
; %%Function:N_XDelFndSedPgdPad %%Owner:BRADV
cProc N_XDelFndSedPgdPad,<PUBLIC,FAR>,<si,di>
else ;!DEBUG
; %%Function:LN_XDelFndSedPgdPad %%Owner:BRADV
cProc LN_XDelFndSedPgdPad,<PUBLIC,NEAR>,<si,di>
endif ;!DEBUG
ParmW fPlan
ParmW pxbc
ParmW pxsr
LocalV caT,cbCaMin
cBegin
; caT = *pxsr->pcaDel;
push ds
pop es
mov di,[pxsr]
push di ;save pxsr
mov si,[di.pcaDelXsr]
lea di,[caT]
push di
errnz <cbCaMin AND 1>
mov cx,cbCaMin SHR 1
rep movsw
pop si
pop di ;restore pxsr
; hdod = mpdochdod[caT.doc];
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
;/* FUTURE: why does this have to be done here? Can it be done below with the
;rest of the !fShort processing? */
; if (!(*hdod)->fShort)
cmp [bx.fShortDod],fFalse
jne XDFSPP02
; if ((hplc = (*hdod)->hplcsed) != 0)
; {
mov cx,[bx.hplcsedDod]
jcxz XDFSPP02
mov dx,[fPlan]
push dx ;argument for XDelInHplcEdit
push [pxbc] ;argument for XDelInHplcEdit
errnz <NULL>
xor ax,ax
push ax ;argument for XDelInHplcEdit
push [di.pcaDelXsr] ;argument for XDelInHplcEdit
push cx ;argument for XDelInHplcEdit
errnz <edcNone - 0>
push ax ;argument for XDelInHplcEdit
; if ((*hdod)->docHdr != docNil)
; XDeleteHdrText(fPlan, pxbc, &pxsr->xsp, pxsr->pcaDel);
errnz <docNil - 0>
cmp [bx.docHdrDod],ax
je XDFSPP01
lea bx,[di.xspXsr]
cCall XDeleteHdrText,<dx, [pxbc], bx, [di.pcaDelXsr]>
XDFSPP01:
; XDelInHplcEdit(fPlan, pxbc, NULL, pxsr->pcaDel, hplc,
; edcNone);
cCall XDelInHplcEdit,<>
; InvalLlc();
;#define InvalLlc()
; }
XDFSPP02:
;/* protect PLCs from lookups with cp > cpMac */
; Assert(caT.cpLim <= CpMac2Doc(caT.doc));
ifdef DEBUG
call XDFSPP12
endif ;/* DEBUG */
; caT.cpLim = CpMin(caT.cpLim, CpMac2Doc(caT.doc));
cCall CpMac2Doc,<[caT.docCa]>
cmp ax,[caT.LO_cpLimCa]
mov cx,dx
sbb cx,[caT.HI_cpLimCa]
jge XDFSPP03
mov [caT.LO_cpLimCa],ax
mov [caT.HI_cpLimCa],dx
XDFSPP03:
; if (caT.cpLim <= caT.cpFirst)
; return;
mov ax,[caT.LO_cpFirstCa]
mov dx,[caT.HI_cpFirstCa]
sub ax,[caT.LO_cpLimCa]
sbb dx,[caT.HI_cpLimCa]
jge XDFSPP05
;/* these PLCs are in short and long docs */
; if ((hplc = (*hdod)->hplcpgd) != 0)
; {
; XDelInHplcEdit(fPlan, pxbc, &pxsr->xsaPgdDel, &caT, hplc, edcPgd);
; InvalLlc();
; }
;#define InvalLlc()
;#define edcPgd (offset(DOD, hplcpgd) / sizeof(int))
;XDFSPP06 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XDelInHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx, si, hplc, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaPgdDelXsr])
mov al,([hplcpgdDod]) SHR 1
call XDFSPP06
; if ((hplc = (*hdod)->hplcphe) != 0)
; XDelInHplcEdit(fPlan, pxbc, &pxsr->xsaPheDel, &caT, hplc, edcPhe);
;#define edcPhe (offset(DOD, hplcphe) / sizeof(int))
;XDFSPP06 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XDelInHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx, si, hplc, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaPheDelXsr])
mov al,([hplcpheDod]) SHR 1
call XDFSPP06
; if ((*hdod)->fShort)
; return;
;/* PLCs for long docs only */
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
cmp [bx.fShortDod],fFalse
jne XDFSPP05
; if ((*hdod)->docFtn != docNil)
; XDelReferencedText(fPlan, pxbc, &pxsr->xsfFtnDel, &caT, edcDrpFtn);
;#define edcDrpFtn (offset(DOD,drpFtn)/sizeof(int))
;XDFSPP09 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + cx);
;if (hplc != hNil)
; XDelReferencedText(fPlan, pxbc, ((char *)pxsr) + dx, si, al);
;ax, bx, cx and dx are altered.
mov dx,([xsfFtnDelXsr])
mov al,([drpFtnDod]) SHR 1
mov cx,([docFtnDod])
call XDFSPP09
; if ((*hdod)->docAtn != docNil)
; XDelReferencedText(fPlan, pxbc, &pxsr->xsfAtnDel, &caT, edcDrpAtn);
;#define edcDrpAtn (offset(DOD,drpAtn)/sizeof(int))
;XDFSPP09 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + cx);
;if (hplc != hNil)
; XDelReferencedText(fPlan, pxbc, ((char *)pxsr) + dx, si, al);
;ax, bx, cx and dx are altered.
mov dx,([xsfAtnDelXsr])
mov al,([drpAtnDod]) SHR 1
mov cx,([docAtnDod])
call XDFSPP09
; if ((hplc = (*hdod)->hplcpad) != 0 && caT.cpFirst < CpMacDoc(caT.doc))
; XDelInHplcEdit(fPlan, pxbc, &pxsr->xsaPadDel, &caT, hplc, edcPad);
;#define edcPad (offset(DOD, hplcpad) / sizeof(int))
cCall CpMacDoc,<[caT.docCa]>
cmp [caT.LO_cpFirstCa],ax
mov cx,[caT.HI_cpFirstCa]
sbb cx,dx
jge XDFSPP04
;XDFSPP06 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XDelInHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx, si, hplc, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaPadDelXsr])
mov al,([hplcpadDod]) SHR 1
call XDFSPP06
XDFSPP04:
; if ((*hdod)->fSea && (hplc = (*hdod)->hplcsea) != 0)
; XDelInHplcEdit(fPlan, pxbc, &pxsr->xsaSeaDel, &caT, hplc, edcSea);
;#define edcSea (offset(DOD, hplcsea) / sizeof(int))
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
test [bx.fSeaDod],maskfSeaDod
je XDFSPP05
;XDFSPP06 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XDelInHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx, si, hplc, al);
;ax, bx, cx and dx are altered.
mov dx,([xsaSeaDelXsr])
mov al,([hplcseaDod]) SHR 1
call XDFSPP06
XDFSPP05:
;}
cEnd
;XDFSPP06 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + al);
;if (hplc != hNil)
; XDelInHplcEdit(fPlan, pxbc, ((char *)pxsr) + dx, si, hplc, al);
;ax, bx, cx and dx are altered.
XDFSPP06:
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
ifdef DEBUG
or al,al
jns XDFSPP07
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1037
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XDFSPP07:
endif ;/* DEBUG */
cbw
add bx,ax
add bx,ax
mov cx,[bx]
jcxz XDFSPP08
push [fPlan]
push [pxbc]
add dx,di
push dx
push si
push cx
push ax
cCall XDelInHplcEdit,<>
XDFSPP08:
ret
;XDFSPP09 performs
;hplc = *(((int *)(PdodDoc(((struct CA *)si)->doc))) + cx);
;if (hplc != hNil)
; XDelReferencedText(fPlan, pxbc, ((char *)pxsr) + dx, si, al);
;ax, bx, cx and dx are altered.
XDFSPP09:
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
ifdef DEBUG
or al,al
jns XDFSPP10
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1038
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
XDFSPP10:
endif ;/* DEBUG */
cbw
add bx,cx
mov cx,[bx]
jcxz XDFSPP11
push [fPlan]
push [pxbc]
add dx,di
push dx
push si
push ax
cCall XDelReferencedText,<>
XDFSPP11:
ret
; Assert(caT.cpLim <= CpMac2Doc(caT.doc));
ifdef DEBUG
XDFSPP12:
push ax
push bx
push cx
push dx
cCall CpMac2Doc,<[caT.docCa]>
sub ax,[caT.LO_cpLimCa]
sbb dx,[caT.HI_cpLimCa]
jge XDFSPP13
mov ax,midEditn2
mov bx,1040
cCall AssertProcForNative,<ax,bx>
XDFSPP13:
pop dx
pop cx
pop bx
pop ax
ret
endif ;/* DEBUG */
; if (DcpCa(pca) != 0)
;/* delete structures for text being deleted */
; XDeleteStruct(fPlan, pxbc, pxsr);
;/* X D E L E T E S T R U C T */
;/* Delete structures from the deletion range */
;/* %%Function:XDeleteStruct %%owner:peterj %%reviewed: 6/28/89 */
;XDeleteStruct(fPlan, pxbc, pxsr)
;BOOL fPlan;
;struct XBC *pxbc;
;struct XSR *pxsr;
;{
; struct CA *pca = pxsr->pcaDel;
;
;/* check for deleting para and sect boundaries; delete entries from parallel
;structures */
; if (!fPlan && !vfNoInval)
; InvalParaSect(pca, pca, fTrue);
; if (FFieldsInPca(pca))
; XDeleteFields(fPlan, pxbc, &pxsr->xslDelete, pca);
;
; if (!PdodDoc(pca->doc)->fShort)
; if (PdodDoc(pca->doc)->hsttbBkmk != hNil)
; XDeleteBkmks(fPlan, pxbc, pca, fFalse);
; XDelFndSedPgdPad(fPlan, pxbc, pxsr);
;}
PUBLIC LN_XDeleteStruct
LN_XDeleteStruct:
;Assumes bx = pxbc, cx = fPlan, si = pca, di = pxsr
;ax, bx, cx, dx are altered.
; if (dcpDel != cp0)
; {
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
mov si,[di.pcaDelXsr]
call LN_DcpCa
or ax,dx
je XDS05
; if (!fPlan && !vfNoInval)
; /* check for deleting para and sect boundaries; delete entries
; from parallel structures */
; InvalParaSect(pcaDel, pcaDel, fTrue);
push cx ;save fPlan
or cx,[vfNoInval]
jne XDS01
errnz <fTrue - 1>
inc cx
push bx ;save pxbc
cCall InvalParaSect,<si, si, cx>
pop bx ;restore pxbc
XDS01:
pop cx ;restore fPlan
; if (FFieldsInPca(pcaDel))
; {
;LN_FFieldsInPca assumes pca passed in si and performs
;FFieldsInPca(pca). ax, bx, cx, dx are altered.
;The sign bit set reflects a true result
push bx ;save pxbc
push cx ;save fPlan
call LN_FFieldsInPca
pop cx ;restore fPlan
pop bx ;restore pxbc
jns XDS03
; if (!fPlan)
; (*hdodDest)->fFldNestedValid = fFalse;
or cx,cx
jne XDS02
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
push bx ;save pxbc
call LN_PdodDocCa
and [bx.fFldNestedValidDod],NOT maskFFldNestedValidDod
pop bx ;restore pxbc
XDS02:
; XDeleteFields(fPlan, pxbc, &pxsr->xslDelete, pcaDel);
lea ax,[di.xslDeleteXsr]
push bx ;save pxbc
push cx ;save fPlan
cCall XDeleteFields,<cx, bx, ax, si>
pop cx ;restore fPlan
pop bx ;restore pxbc
; }
XDS03:
; if (!(*hdodDest)->fShort)
; if ((*hdodDest)->hsttbBkmk != hNil)
; XDeleteBkmks(fPlan, pxbc, pcaDel, fFalse);
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
push bx ;save pxbc
call LN_PdodDocCa
xor ax,ax
errnz <fFalse>
cmp [bx.fShortDod],al
jne XDS035 ;do this extra conditional jmp to avoid GP faults
mov dx,[bx.hsttbBkmkDod]
XDS035:
pop bx ;restore pxbc
jne XDS04
errnz <hNil>
or dx,dx
je XDS04
errnz <fFalse>
push bx ;save pxbc
push cx ;save fPlan
cCall XDeleteBkmks,<cx, bx, si, ax>
pop cx ;restore fPlan
pop bx ;restore pxbc
XDS04:
; XDelFndSedPgdPad(fPlan, pxbc, pxsr);
push cx
push bx
push di
ifdef DEBUG
cCall S_XDelFndSedPgdPad,<>
else ;!DEBUG
call LN_XDelFndSedPgdPad
endif ;!DEBUG
; }
XDS05:
ret
;LN_FlushRulerSprms performs
;if (vrulss.caRulerSprm.doc != docNil)
; FlushRulerSprms();
;ax, bx, cx, dx are altered.
LN_FlushRulerSprms:
cmp [vrulss.caRulerSprmRulss.docCa],docNil
je FRS01
cCall FlushRulerSprms,<>
FRS01:
ret
;/* F F I E L D S I N P C A */
;/* return fTrue if there are any field characters in pca */
;BOOL FFieldsInPca(pca)
;struct CA *pca;
;{
; struct PLC **hplcfld = PdodDoc(pca->doc)->hplcfld;
;
; return (hplcfld != hNil &&
; IInPlcRef(hplcfld, pca->cpFirst) <=
; IInPlcCheck(hplcfld, CpMax(0,pca->cpLim-1)));
;}
;LN_FFieldsInPca assumes pca passed in si and performs
;FFieldsInPca(pca). ax, bx, cx, dx are altered.
;The sign bit set reflects a true result
; %%Function:LN_FFieldsInPca %%Owner:BRADV
PUBLIC LN_FFieldsInPca
LN_FFieldsInPca:
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
call LN_PdodDocCa
mov cx,[bx.hplcfldDod]
or cx,cx
je LN_FFIP02
push di ;save caller's di
mov ax,[si.LO_cpLimCa]
mov dx,[si.HI_cpLimCa]
sub ax,1
sbb dx,0
jge LN_FFIP01
xor ax,ax
cwd
LN_FFIP01:
push cx ;argument for IInPlcCheck
push dx ;argument for IInPlcCheck
push ax ;argument for IInPlcCheck
cCall IInPlcRef,<cx, [si.HI_cpFirstCa], [si.LO_cpFirstCa]>
xchg ax,di
cCall IInPlcCheck,<>
sub di,ax
dec di
pop di ;restore caller's di
LN_FFIP02:
ret
;LN_PdodDocCa assumes pca passed in si and performs
;PdodDoc(pca->doc). Only bx is altered.
; %%Function:LN_PdodDocCa %%Owner:BRADV
PUBLIC LN_PdodDocCa
LN_PdodDocCa:
mov bx,[si.docCa]
;LN_PdodDocEdit assumes doc passed in bx and performs
;PdodDoc(doc). Only bx is altered.
; %%Function:LN_PdodDocEdit %%Owner:BRADV
PUBLIC LN_PdodDocEdit
LN_PdodDocEdit:
shl bx,1
mov bx,[bx.mpdochdod]
ifdef DEBUG
cmp bx,hNil
jne LN_PDC01
push ax
push bx
push cx
push dx
mov ax,midEditn2
mov bx,1039
cCall AssertProcForNative,<ax,bx>
pop dx
pop cx
pop bx
pop ax
LN_PDC01:
endif ;/* DEBUG */
mov bx,[bx]
ret
;LN_DcpCa assumes pca passed in si and returns DcpCa in dx:ax.
;Only ax and dx are altered.
LN_DcpCa:
;***Begin in line DcpCa
;return (pca->cpLim - pca->cpFirst);
mov ax,[si.LO_cpLimCa]
mov dx,[si.HI_cpLimCa]
sub ax,[si.LO_cpFirstCa]
sbb dx,[si.HI_cpFirstCa]
;***End in line DcpCa
ret
ifdef DEBUG
PUBLIC LN_FreezeHpEdit
LN_FreezeHpEdit:
;#define FreezeHp() (cHpFreeze++?0:LockHeap(sbDds))
cmp [cHpFreeze],0
jne LN_FH01
push ax
push bx
push cx
push dx
mov ax,sbDds
cCall LockHeap,<ax>
pop dx
pop cx
pop bx
pop ax
LN_FH01:
inc [cHpFreeze]
ret
endif ;DEBUG
ifdef DEBUG
; %%Function:LN_MeltHpEdit %%Owner:BRADV
PUBLIC LN_MeltHpEdit
LN_MeltHpEdit:
;#define MeltHp() (--cHpFreeze?0:UnlockHeap(sbDds))
dec [cHpFreeze]
jne LN_MH01
push ax
push bx
push cx
push dx
mov ax,sbDds
cCall UnlockHeap,<ax>
pop dx
pop cx
pop bx
pop ax
LN_MH01:
ret
endif ;DEBUG
sEnd edit2
end
|
test0/test.asm | herumi/opti | 15 | 27782 | <reponame>herumi/opti
default rel
global func1
global func2
global func3
global func4
segment .data
align 16
flag0:
dd 0
flag1:
dd 1
%ifdef _WIN64
%define _p1 rcx
%define _p2 rdx
%else
%define _p1 rdi
%define _p2 rsi
%endif
%macro _OP 0
cmpxchg8b [r8]
; cpuid
%endmacro
segment .text
align 16
func1:
push rbx
mov r8, _p1
mov r9, _p2
.lp:
_OP
dec r9
jnz .lp
pop rbx
ret
align 16
func2:
push rbx
mov r8, _p1
mov r9, _p2
.lp:
call call_cmpxchg8b
dec r9
jnz .lp
pop rbx
ret
align 16
func3:
push rbx
mov r8, _p1
mov r9, _p2
.lp:
call call_cmpxchg8b2
dec r9
jnz .lp
pop rbx
ret
align 16
func4:
push rbx
mov r8, _p1
mov r9, _p2
.lp:
call call_cmpxchg8b3
dec r9
jnz .lp
pop rbx
ret
align 16
call_cmpxchg8b:
_OP
ret
align 16
call_cmpxchg8b2:
cmp [rel flag0], byte 0
jz call_cmpxchg8b
ret
align 16
call_cmpxchg8b3:
cmp [rel flag1], byte 0
jnz call_cmpxchg8b
ret
align 16
do_nothing:
ret
|
oeis/028/A028099.asm | neoneye/loda-programs | 11 | 14950 | ; A028099: Expansion of 1/((1 - 3*x)*(1 - 8*x)*(1 - 9*x)*(1 - 10*x)).
; Submitted by <NAME>
; 1,30,577,9066,126829,1646094,20280169,240528882,2771673157,31228927158,345616983361,3769863028698,40631819886685,433596513609822,4588506840332953,48214238728174914,503555280142266613
mov $1,1
mov $2,$0
mov $3,$0
lpb $2
mov $0,$3
sub $2,1
sub $0,$2
seq $0,18069 ; Expansion of 1/((1-3x)(1-8x)(1-10x)).
mul $1,9
add $1,$0
lpe
mov $0,$1
|
src/fot/GroupTheory/Commutator/PropertiesATP.agda | asr/fotc | 11 | 10200 | <reponame>asr/fotc
------------------------------------------------------------------------------
-- Properties related with the group commutator
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module GroupTheory.Commutator.PropertiesATP where
open import GroupTheory.Base
open import GroupTheory.Commutator
------------------------------------------------------------------------------
-- From: <NAME>. The Theory of Groups, vol. 1. Chelsea Publising
-- Company, 2nd edition, 1960. p. 99.
postulate commutatorInverse : ∀ a b → [ a , b ] · [ b , a ] ≡ ε
{-# ATP prove commutatorInverse #-}
-- If the commutator is associative, then commutator of any two
-- elements lies in the center of the group, i.e. a [b,c] = [b,c] a.
-- From: TPTP 6.4.0 problem GRP/GRP024-5.p.
postulate commutatorAssocCenter : (∀ a b c → commutatorAssoc a b c) →
(∀ a b c → a · [ b , c ] ≡ [ b , c ] · a)
{-# ATP prove commutatorAssocCenter #-}
|
src/firmware/Platform/Isr.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 178805 | #include "Platform.inc"
#include "TailCalls.inc"
#include "Lcd/Isr.inc"
#include "PowerManagement/Isr.inc"
#include "Clock.inc"
#include "Motor/Isr.inc"
#include "InitialisationChain.inc"
radix decimal
extern INITIALISE_AFTER_ISR
MOTOR_ADC_CHANNEL equ b'00011100'
MOTOR_LOAD_FLAGS_MASK equ (1 << MOTOR_FLAG_NOLOAD) | (1 << MOTOR_FLAG_NOMINALLOAD) | (1 << MOTOR_FLAG_OVERLOAD)
ADRESH_90MA equ 23
udata_shr
contextSavingW res 1
contextSavingStatus res 1
contextSavingPclath res 1
lcdContrastAccumulator res 1
Isr code 0x0004
global isr
global initialiseIsr
; TODO: BUG (HERE ?) - LCD CONTRAST GOES FROM ABOUT 1.24V TO 2.38V
; SEEMINGLY RANDOMLY, TURNING OFF THE LCD. VOLTAGE IS ROCK SOLID UNTIL
; IT HAPPENS, AND THERE IS NO CONSISTENT TIME UNTIL IT HAPPENS...
;
; *** UPDATE: I THINK THIS IS BECAUSE UNDER CERTAIN (UNKNOWN) CONDITIONS,
; THE ADC IS TURNED OFF - PORTC5=1, TRISC=0x88, PSTRCON=0x11, CCPR1L=0xff,
; ADCON=0x1f, ADCON1=0x20, motorState=0x05. NOTICED DURING RAISING OF THE
; DOOR DURING SIMULATION.
isr:
movwf contextSavingW
swapf contextSavingW
swapf STATUS, W
movwf contextSavingStatus
movf PCLATH, W
movwf contextSavingPclath
clrf PCLATH
preventSleepForSinglePollLoopIteration:
.setBankFor powerManagementFlags
bsf powerManagementFlags, POWER_FLAG_PREVENTSLEEP
adcSampled:
.safelySetBankFor PIR1
btfss PIR1, ADIF
goto endOfAdcBlock
bcf PIR1, ADIF
disableMotorOutputsIfNotMonitoringCurrent:
.setBankFor ADCON0
bsf ADCON0, GO
movlw b'00111100'
andwf ADCON0, W
xorlw MOTOR_ADC_CHANNEL
btfss STATUS, Z
goto disableMotorOutputs
motorCurrentMonitoring:
.setBankFor PSTRCON
movlw MOTOR_PSTRCON_OUTPUT_MASK
andwf PSTRCON, W
btfsc STATUS, Z
goto endOfMotorCurrentMonitoring
setMotorFlags:
.setBankFor ADRESH
movlw ADRESH_90MA
subwf ADRESH, W
movlw ~MOTOR_LOAD_FLAGS_MASK | (1 << MOTOR_FLAG_NOLOAD)
btfsc STATUS, C
movlw ~MOTOR_LOAD_FLAGS_MASK | (1 << MOTOR_FLAG_NOMINALLOAD)
btfsc ADRESH, 7
movlw ~MOTOR_LOAD_FLAGS_MASK | (1 << MOTOR_FLAG_OVERLOAD)
.setBankFor motorFlags
andwf motorFlags
andlw MOTOR_LOAD_FLAGS_MASK
iorwf motorFlags
disableMotorOutputsIfFlagsMasked:
swapf motorFlags, W
andlw MOTOR_LOAD_FLAGS_MASK
andwf motorFlags, W
btfsc STATUS, Z
goto endOfMotorCurrentMonitoring
disableMotorOutputs:
.safelySetBankFor MOTOR_PORT
bcf MOTOR_PORT, MOTOR_PWMA_PIN
bcf MOTOR_PORT, MOTOR_PWMB_PIN
.setBankFor PSTRCON
movlw ~MOTOR_PSTRCON_OUTPUT_MASK
andwf PSTRCON
endOfMotorCurrentMonitoring:
lcdDeltaSigmaContrastControl:
.safelySetBankFor lcdFlags
btfss lcdFlags, LCD_FLAG_ENABLED
goto endOfContrastControl
movf lcdContrast, W
addwf lcdContrastAccumulator
.setBankFor LCD_CONTRAST_PORT
btfss STATUS, C
bcf LCD_CONTRAST_PORT, LCD_CONTRAST_PIN
btfsc STATUS, C
bsf LCD_CONTRAST_PORT, LCD_CONTRAST_PIN
endOfContrastControl:
endOfAdcBlock:
clockTicked:
.safelySetBankFor PIR1
btfss PIR1, TMR1IF
goto endOfClockTicked
bcf PIR1, TMR1IF
.setBankFor clockFlags
bsf clockFlags, CLOCK_FLAG_TICKED
endOfClockTicked:
clearButtonFlagIfJustWokenUp:
.safelySetBankFor powerManagementFlags
btfss powerManagementFlags, POWER_FLAG_SLEEPING
goto endOfIsr
.setBankFor INTCON
bcf INTCON, RABIF
endOfIsr:
movf contextSavingPclath, W
movwf PCLATH
swapf contextSavingStatus, W
movwf STATUS
swapf contextSavingW, W
retfie
initialiseIsr:
clrf lcdContrastAccumulator
tcall INITIALISE_AFTER_ISR
end
|
oeis/027/A027876.asm | neoneye/loda-programs | 11 | 5175 | <reponame>neoneye/loda-programs
; A027876: a(n) = Product_{i=1..n} (8^i - 1).
; Submitted by <NAME>
; 1,7,441,225351,922812345,30237792108615,7926625536728661945,16623330670976050126618695,278893192683059452825059069034425,37432410397693271164043156886536608251975,40192744579703327974513031326024821900712479850425,345253046972421373486087454167687216169544498212556213551175,23725608729109172761893932652851760440319928960465005802009662144413625,13043291336835924980192290605135684592428832036326461110665998992440006142247010375
mov $1,2
lpb $0
sub $0,1
add $2,7
mul $1,$2
mul $2,8
lpe
div $1,2
mov $0,$1
|
prototyping/Properties/Step.agda | FreakingBarbarians/luau | 1 | 4010 | <filename>prototyping/Properties/Step.agda
module Properties.Step where
open import Agda.Builtin.Equality using (_≡_; refl)
open import FFI.Data.Maybe using (just; nothing)
open import Luau.Heap using (Heap; lookup; alloc; ok; function_⟨_⟩_end)
open import Luau.Syntax using (Block; Expr; nil; var; addr; function⟨_⟩_end; block_is_end; _$_; local_←_; function_⟨_⟩_end; return; done; _∙_)
open import Luau.OpSem using (_⊢_⟶ᴱ_⊣_; _⊢_⟶ᴮ_⊣_; app ; beta; function; block; return; done; local; subst)
open import Luau.RuntimeError using (RuntimeErrorᴱ; RuntimeErrorᴮ; NilIsNotAFunction; UnboundVariable; SEGV; app; block; local; return)
open import Luau.Substitution using (_[_/_]ᴮ)
open import Luau.Value using (nil; addr; val)
open import Properties.Remember using (remember; _,_)
data StepResultᴮ (H : Heap) (B : Block) : Set
data StepResultᴱ (H : Heap) (M : Expr) : Set
data StepResultᴮ H B where
step : ∀ H′ B′ → (H ⊢ B ⟶ᴮ B′ ⊣ H′) → StepResultᴮ H B
return : ∀ V {B′} → (B ≡ (return (val V) ∙ B′)) → StepResultᴮ H B
done : (B ≡ done) → StepResultᴮ H B
error : (RuntimeErrorᴮ H B) → StepResultᴮ H B
data StepResultᴱ H M where
step : ∀ H′ M′ → (H ⊢ M ⟶ᴱ M′ ⊣ H′) → StepResultᴱ H M
value : ∀ V → (M ≡ val V) → StepResultᴱ H M
error : (RuntimeErrorᴱ H M) → StepResultᴱ H M
stepᴱ : ∀ H M → StepResultᴱ H M
stepᴮ : ∀ H B → StepResultᴮ H B
stepᴱ H nil = value nil refl
stepᴱ H (var x) = error (UnboundVariable x)
stepᴱ H (addr a) = value (addr a) refl
stepᴱ H (M $ N) with stepᴱ H M
stepᴱ H (M $ N) | step H′ M′ D = step H′ (M′ $ N) (app D)
stepᴱ H (nil $ N) | value nil refl = error NilIsNotAFunction
stepᴱ H (addr a $ N) | value (addr a) refl with remember (lookup H a)
stepᴱ H (addr a $ N) | value (addr a) refl | (nothing , p) = error (app (SEGV a p))
stepᴱ H (addr a $ N) | value (addr a) refl | (just(function f ⟨ x ⟩ B end) , p) = step H (block f is local x ← N ∙ B end) (beta p)
stepᴱ H (M $ N) | error E = error (app E)
stepᴱ H (function⟨ x ⟩ B end) with alloc H (function "anon" ⟨ x ⟩ B end)
stepᴱ H (function⟨ x ⟩ B end) | ok a H′ p = step H′ (addr a) (function p)
stepᴱ H (block b is B end) with stepᴮ H B
stepᴱ H (block b is B end) | step H′ B′ D = step H′ (block b is B′ end) (block D)
stepᴱ H (block b is (return _ ∙ B′) end) | return V refl = step H (val V) return
stepᴱ H (block b is done end) | done refl = step H nil done
stepᴱ H (block b is B end) | error E = error (block b E)
stepᴮ H (function f ⟨ x ⟩ C end ∙ B) with alloc H (function f ⟨ x ⟩ C end)
stepᴮ H (function f ⟨ x ⟩ C end ∙ B) | ok a H′ p = step H′ (B [ addr a / f ]ᴮ) (function p)
stepᴮ H (local x ← M ∙ B) with stepᴱ H M
stepᴮ H (local x ← M ∙ B) | step H′ M′ D = step H′ (local x ← M′ ∙ B) (local D)
stepᴮ H (local x ← _ ∙ B) | value V refl = step H (B [ V / x ]ᴮ) subst
stepᴮ H (local x ← M ∙ B) | error E = error (local x E)
stepᴮ H (return M ∙ B) with stepᴱ H M
stepᴮ H (return M ∙ B) | step H′ M′ D = step H′ (return M′ ∙ B) (return D)
stepᴮ H (return _ ∙ B) | value V refl = return V refl
stepᴮ H (return M ∙ B) | error E = error (return E)
stepᴮ H done = done refl
|
grammar/FramParser.g4 | goulashify/fram | 1 | 6763 | grammar FramParser;
import FramLexer;
program
: scope EOF
;
scope
: (statement+)?
;
statement
: varDeclaration
| listenerDeclaration
| animationCall
;
varDeclaration
: identifier Is expression SemiColon
;
listenerDeclaration
: When identifier Is event OpenBrace scope CloseBrace
;
animationCall
: Animate identifier Colon Set propertyAssignments animationOptions SemiColon
;
animationOptions
: animationOptionTime
;
animationOptionTime
: In expression
;
identifier
: Identifier
;
expression
: integerLiteral
| durationLiteral
| percentageLiteral
| stringLiteral
| identifier
;
event
: EventVerb
;
propertyAssignments
: propertyAssignment (Comma propertyAssignment)*
;
propertyAssignment
: propertyName To expression
;
propertyName
: Identifier
| PropertyName
| StringLiteral
;
durationLiteral
: integerLiteral timeUnit
;
percentageLiteral
: integerLiteral '%'
;
integerLiteral
: IntegerLiteral
;
// TODO: This doesn't work for some reason when used with NumericUnit from Lexer, figure it out.
timeUnit
: 'ms'
| 's'
;
stringLiteral
: StringLiteral
;
|
alloy4fun_models/trashltl/models/15/LPptqCQYEE8pYFPNG.als | Kaixi26/org.alloytools.alloy | 0 | 2411 | <filename>alloy4fun_models/trashltl/models/15/LPptqCQYEE8pYFPNG.als
open main
pred idLPptqCQYEE8pYFPNG_prop16 {
all f:Protected | always after f in Protected
}
pred __repair { idLPptqCQYEE8pYFPNG_prop16 }
check __repair { idLPptqCQYEE8pYFPNG_prop16 <=> prop16o } |
pkgs/tools/yasm/src/modules/parsers/nasm/tests/charconstmath.asm | manggoguy/parsec-modified | 2,151 | 18247 | <reponame>manggoguy/parsec-modified
db "string", " "+80h
|
immersed-presets-template-generator/src/main/antlr/CPP14Parser.g4 | masterav10/immersed-presets | 0 | 3330 | /*******************************************************************************
* The MIT License (MIT)
*
* Copyright (c) 2015 <NAME> (Camiloasc1) 2020 <NAME> (Marti2203)
*
* 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.
* ****************************************************************************
*/
parser grammar CPP14Parser;
options {
tokenVocab = CPP14Lexer;
}
/*Basic concepts*/
translationUnit: declarationseq? EOF;
/*Expressions*/
primaryExpression:
literal+
| This
| LeftParen expression RightParen
| idExpression
| lambdaExpression;
idExpression: unqualifiedId | qualifiedId;
unqualifiedId:
Identifier
| operatorFunctionId
| conversionFunctionId
| literalOperatorId
| Tilde (className | decltypeSpecifier)
| templateId;
qualifiedId: nestedNameSpecifier Template? unqualifiedId;
nestedNameSpecifier:
(theTypeName | namespaceName | decltypeSpecifier)? Doublecolon
| nestedNameSpecifier (
Identifier
| Template? simpleTemplateId
) Doublecolon;
lambdaExpression:
lambdaIntroducer lambdaDeclarator? compoundStatement;
lambdaIntroducer: LeftBracket lambdaCapture? RightBracket;
lambdaCapture:
captureList
| captureDefault (Comma captureList)?;
captureDefault: And | Assign;
captureList: capture (Comma capture)* Ellipsis?;
capture: simpleCapture | initcapture;
simpleCapture: And? Identifier | This;
initcapture: And? Identifier initializer;
lambdaDeclarator:
LeftParen parameterDeclarationClause? RightParen Mutable? exceptionSpecification?
attributeSpecifierSeq? trailingReturnType?;
postfixExpression:
primaryExpression
| postfixExpression LeftBracket (expression | bracedInitList) RightBracket
| postfixExpression LeftParen expressionList? RightParen
| (simpleTypeSpecifier | typeNameSpecifier) (
LeftParen expressionList? RightParen
| bracedInitList
)
| postfixExpression (Dot | Arrow) (
Template? idExpression
| pseudoDestructorName
)
| postfixExpression (PlusPlus | MinusMinus)
| (
Dynamic_cast
| Static_cast
| Reinterpret_cast
| Const_cast
) Less theTypeId Greater LeftParen expression RightParen
| typeIdOfTheTypeId LeftParen (expression | theTypeId) RightParen;
/*
add a middle layer to eliminate duplicated function declarations
*/
typeIdOfTheTypeId: Typeid_;
expressionList: initializerList;
pseudoDestructorName:
nestedNameSpecifier? (theTypeName Doublecolon)? Tilde theTypeName
| nestedNameSpecifier Template simpleTemplateId Doublecolon Tilde theTypeName
| Tilde decltypeSpecifier;
unaryExpression:
postfixExpression
| (PlusPlus | MinusMinus | unaryOperator | Sizeof) unaryExpression
| Sizeof (
LeftParen theTypeId RightParen
| Ellipsis LeftParen Identifier RightParen
)
| Alignof LeftParen theTypeId RightParen
| noExceptExpression
| newExpression
| deleteExpression;
unaryOperator: Or | Star | And | Plus | Tilde | Minus | Not;
newExpression:
Doublecolon? New newPlacement? (
newTypeId
| (LeftParen theTypeId RightParen)
) newInitializer?;
newPlacement: LeftParen expressionList RightParen;
newTypeId: typeSpecifierSeq newDeclarator?;
newDeclarator:
pointerOperator newDeclarator?
| noPointerNewDeclarator;
noPointerNewDeclarator:
LeftBracket expression RightBracket attributeSpecifierSeq?
| noPointerNewDeclarator LeftBracket constantExpression RightBracket attributeSpecifierSeq?;
newInitializer:
LeftParen expressionList? RightParen
| bracedInitList;
deleteExpression:
Doublecolon? Delete (LeftBracket RightBracket)? castExpression;
noExceptExpression: Noexcept LeftParen expression RightParen;
castExpression:
unaryExpression
| LeftParen theTypeId RightParen castExpression;
pointerMemberExpression:
castExpression ((DotStar | ArrowStar) castExpression)*;
multiplicativeExpression:
pointerMemberExpression (
(Star | Div | Mod) pointerMemberExpression
)*;
additiveExpression:
multiplicativeExpression (
(Plus | Minus) multiplicativeExpression
)*;
shiftExpression:
additiveExpression (shiftOperator additiveExpression)*;
shiftOperator: Greater Greater | Less Less;
relationalExpression:
shiftExpression (
(Less | Greater | LessEqual | GreaterEqual) shiftExpression
)*;
equalityExpression:
relationalExpression (
(Equal | NotEqual) relationalExpression
)*;
andExpression: equalityExpression (And equalityExpression)*;
exclusiveOrExpression: andExpression (Caret andExpression)*;
inclusiveOrExpression:
exclusiveOrExpression (Or exclusiveOrExpression)*;
logicalAndExpression:
inclusiveOrExpression (AndAnd inclusiveOrExpression)*;
logicalOrExpression:
logicalAndExpression (OrOr logicalAndExpression)*;
conditionalExpression:
logicalOrExpression (
Question expression Colon assignmentExpression
)?;
assignmentExpression:
conditionalExpression
| logicalOrExpression assignmentOperator initializerClause
| throwExpression;
assignmentOperator:
Assign
| StarAssign
| DivAssign
| ModAssign
| PlusAssign
| MinusAssign
| RightShiftAssign
| LeftShiftAssign
| AndAssign
| XorAssign
| OrAssign;
expression: assignmentExpression (Comma assignmentExpression)*;
constantExpression: conditionalExpression;
/*Statements*/
statement:
labeledStatement
| declarationStatement
| attributeSpecifierSeq? (
expressionStatement
| compoundStatement
| selectionStatement
| iterationStatement
| jumpStatement
| tryBlock
);
labeledStatement:
attributeSpecifierSeq? (
Identifier
| Case constantExpression
| Default
) Colon statement;
expressionStatement: expression? Semi;
compoundStatement: LeftBrace statementSeq? RightBrace;
statementSeq: statement+;
selectionStatement:
If LeftParen condition RightParen statement (Else statement)?
| Switch LeftParen condition RightParen statement;
condition:
expression
| attributeSpecifierSeq? declSpecifierSeq declarator (
Assign initializerClause
| bracedInitList
);
iterationStatement:
While LeftParen condition RightParen statement
| Do statement While LeftParen expression RightParen Semi
| For LeftParen (
forInitStatement condition? Semi expression?
| forRangeDeclaration Colon forRangeInitializer
) RightParen statement;
forInitStatement: expressionStatement | simpleDeclaration;
forRangeDeclaration:
attributeSpecifierSeq? declSpecifierSeq declarator;
forRangeInitializer: expression | bracedInitList;
jumpStatement:
(
Break
| Continue
| Return (expression | bracedInitList)?
| Goto Identifier
) Semi;
declarationStatement: blockDeclaration;
/*Declarations*/
declarationseq: declaration+;
declaration:
blockDeclaration
| functionDefinition
| templateDeclaration
| explicitInstantiation
| explicitSpecialization
| linkageSpecification
| namespaceDefinition
| emptyDeclaration
| attributeDeclaration;
blockDeclaration:
simpleDeclaration
| asmDefinition
| namespaceAliasDefinition
| usingDeclaration
| usingDirective
| staticAssertDeclaration
| aliasDeclaration
| opaqueEnumDeclaration;
aliasDeclaration:
Using Identifier attributeSpecifierSeq? Assign theTypeId Semi;
simpleDeclaration:
declSpecifierSeq? initDeclaratorList? Semi
| attributeSpecifierSeq declSpecifierSeq? initDeclaratorList Semi;
staticAssertDeclaration:
Static_assert LeftParen constantExpression Comma StringLiteral RightParen Semi;
emptyDeclaration: Semi;
attributeDeclaration: attributeSpecifierSeq Semi;
declSpecifier:
storageClassSpecifier
| typeSpecifier
| functionSpecifier
| Friend
| Typedef
| Constexpr;
declSpecifierSeq: declSpecifier+? attributeSpecifierSeq?;
storageClassSpecifier:
Register
| Static
| Thread_local
| Extern
| Mutable;
functionSpecifier: Inline | Virtual | Explicit;
typedefName: Identifier;
typeSpecifier:
trailingTypeSpecifier
| classSpecifier
| enumSpecifier;
trailingTypeSpecifier:
simpleTypeSpecifier
| elaboratedTypeSpecifier
| typeNameSpecifier
| cvQualifier;
typeSpecifierSeq: typeSpecifier+ attributeSpecifierSeq?;
trailingTypeSpecifierSeq:
trailingTypeSpecifier+ attributeSpecifierSeq?;
simpleTypeLengthModifier:
Short
| Long;
simpleTypeSignednessModifier:
Unsigned
| Signed;
simpleTypeSpecifier:
nestedNameSpecifier? theTypeName
| nestedNameSpecifier Template simpleTemplateId
| simpleTypeSignednessModifier
| simpleTypeSignednessModifier? simpleTypeLengthModifier+
| simpleTypeSignednessModifier? Char
| simpleTypeSignednessModifier? Char16
| simpleTypeSignednessModifier? Char32
| simpleTypeSignednessModifier? Wchar
| Bool
| simpleTypeSignednessModifier? simpleTypeLengthModifier* Int
| Float
| simpleTypeLengthModifier? Double
| Void
| Auto
| decltypeSpecifier;
theTypeName:
className
| enumName
| typedefName
| simpleTemplateId;
decltypeSpecifier:
Decltype LeftParen (expression | Auto) RightParen;
elaboratedTypeSpecifier:
classKey (
attributeSpecifierSeq? nestedNameSpecifier? Identifier
| simpleTemplateId
| nestedNameSpecifier Template? simpleTemplateId
)
| Enum nestedNameSpecifier? Identifier;
enumName: Identifier;
enumSpecifier:
enumHead LeftBrace (enumeratorList Comma?)? RightBrace;
enumHead:
enumkey attributeSpecifierSeq? (
nestedNameSpecifier? Identifier
)? enumbase?;
opaqueEnumDeclaration:
enumkey attributeSpecifierSeq? Identifier enumbase? Semi;
enumkey: Enum (Class | Struct)?;
enumbase: Colon typeSpecifierSeq;
enumeratorList:
enumeratorDefinition (Comma enumeratorDefinition)*;
enumeratorDefinition: enumerator (Assign constantExpression)?;
enumerator: Identifier;
namespaceName: originalNamespaceName | namespaceAlias;
originalNamespaceName: Identifier;
namespaceDefinition:
Inline? Namespace (Identifier | originalNamespaceName)? LeftBrace namespaceBody = declarationseq
? RightBrace;
namespaceAlias: Identifier;
namespaceAliasDefinition:
Namespace Identifier Assign qualifiednamespacespecifier Semi;
qualifiednamespacespecifier: nestedNameSpecifier? namespaceName;
usingDeclaration:
Using ((Typename_? nestedNameSpecifier) | Doublecolon) unqualifiedId Semi;
usingDirective:
attributeSpecifierSeq? Using Namespace nestedNameSpecifier? namespaceName Semi;
asmDefinition: Asm LeftParen StringLiteral RightParen Semi;
linkageSpecification:
Extern StringLiteral (
LeftBrace declarationseq? RightBrace
| declaration
);
attributeSpecifierSeq: attributeSpecifier+;
attributeSpecifier:
LeftBracket LeftBracket attributeList? RightBracket RightBracket
| alignmentspecifier;
alignmentspecifier:
Alignas LeftParen (theTypeId | constantExpression) Ellipsis? RightParen;
attributeList: attribute (Comma attribute)* Ellipsis?;
attribute: (attributeNamespace Doublecolon)? Identifier attributeArgumentClause?;
attributeNamespace: Identifier;
attributeArgumentClause: LeftParen balancedTokenSeq? RightParen;
balancedTokenSeq: balancedtoken+;
balancedtoken:
LeftParen balancedTokenSeq RightParen
| LeftBracket balancedTokenSeq RightBracket
| LeftBrace balancedTokenSeq RightBrace
| ~(
LeftParen
| RightParen
| LeftBrace
| RightBrace
| LeftBracket
| RightBracket
)+;
/*Declarators*/
initDeclaratorList: initDeclarator (Comma initDeclarator)*;
initDeclarator: declarator initializer?;
declarator:
pointerDeclarator
| noPointerDeclarator parametersAndQualifiers trailingReturnType;
pointerDeclarator: (pointerOperator Const?)* noPointerDeclarator;
noPointerDeclarator:
declaratorid attributeSpecifierSeq?
| noPointerDeclarator (
parametersAndQualifiers
| LeftBracket constantExpression? RightBracket attributeSpecifierSeq?
)
| LeftParen pointerDeclarator RightParen;
parametersAndQualifiers:
LeftParen parameterDeclarationClause? RightParen cvqualifierseq? refqualifier?
exceptionSpecification? attributeSpecifierSeq?;
trailingReturnType:
Arrow trailingTypeSpecifierSeq abstractDeclarator?;
pointerOperator:
(And | AndAnd) attributeSpecifierSeq?
| nestedNameSpecifier? Star attributeSpecifierSeq? cvqualifierseq?;
cvqualifierseq: cvQualifier+;
cvQualifier: Const | Volatile;
refqualifier: And | AndAnd;
declaratorid: Ellipsis? idExpression;
theTypeId: typeSpecifierSeq abstractDeclarator?;
abstractDeclarator:
pointerAbstractDeclarator
| noPointerAbstractDeclarator? parametersAndQualifiers trailingReturnType
| abstractPackDeclarator;
pointerAbstractDeclarator:
noPointerAbstractDeclarator
| pointerOperator+ noPointerAbstractDeclarator?;
noPointerAbstractDeclarator:
noPointerAbstractDeclarator (
parametersAndQualifiers
| noPointerAbstractDeclarator LeftBracket constantExpression? RightBracket
attributeSpecifierSeq?
)
| parametersAndQualifiers
| LeftBracket constantExpression? RightBracket attributeSpecifierSeq?
| LeftParen pointerAbstractDeclarator RightParen;
abstractPackDeclarator:
pointerOperator* noPointerAbstractPackDeclarator;
noPointerAbstractPackDeclarator:
noPointerAbstractPackDeclarator (
parametersAndQualifiers
| LeftBracket constantExpression? RightBracket attributeSpecifierSeq?
)
| Ellipsis;
parameterDeclarationClause:
parameterDeclarationList (Comma? Ellipsis)?;
parameterDeclarationList:
parameterDeclaration (Comma parameterDeclaration)*;
parameterDeclaration:
attributeSpecifierSeq? declSpecifierSeq (
(declarator | abstractDeclarator?) (
Assign initializerClause
)?
);
functionDefinition:
attributeSpecifierSeq? declSpecifierSeq? declarator virtualSpecifierSeq? functionBody;
functionBody:
constructorInitializer? compoundStatement
| functionTryBlock
| Assign (Default | Delete) Semi;
initializer:
braceOrEqualInitializer
| LeftParen expressionList RightParen;
braceOrEqualInitializer:
Assign initializerClause
| bracedInitList;
initializerClause: assignmentExpression | bracedInitList;
initializerList:
initializerClause Ellipsis? (
Comma initializerClause Ellipsis?
)*;
bracedInitList: LeftBrace (initializerList Comma?)? RightBrace;
/*Classes*/
className: Identifier | simpleTemplateId;
classSpecifier:
classHead LeftBrace memberSpecification? RightBrace;
classHead:
classKey attributeSpecifierSeq? (
classHeadName classVirtSpecifier?
)? baseClause?
| Union attributeSpecifierSeq? (
classHeadName classVirtSpecifier?
)?;
classHeadName: nestedNameSpecifier? className;
classVirtSpecifier: Final;
classKey: Class | Struct;
memberSpecification:
(memberdeclaration | accessSpecifier Colon)+;
memberdeclaration:
attributeSpecifierSeq? declSpecifierSeq? memberDeclaratorList? Semi
| functionDefinition
| usingDeclaration
| staticAssertDeclaration
| templateDeclaration
| aliasDeclaration
| emptyDeclaration;
memberDeclaratorList:
memberDeclarator (Comma memberDeclarator)*;
memberDeclarator:
declarator (
virtualSpecifierSeq? pureSpecifier?
| braceOrEqualInitializer?
)
| Identifier? attributeSpecifierSeq? Colon constantExpression;
virtualSpecifierSeq: virtualSpecifier+;
virtualSpecifier: Override | Final;
/*
purespecifier: Assign '0'//Conflicts with the lexer ;
*/
pureSpecifier:
Assign val = OctalLiteral {if($val.text.compareTo("0")!=0) throw new InputMismatchException(this);
};
/*Derived classes*/
baseClause: Colon baseSpecifierList;
baseSpecifierList:
baseSpecifier Ellipsis? (Comma baseSpecifier Ellipsis?)*;
baseSpecifier:
attributeSpecifierSeq? (
baseTypeSpecifier
| Virtual accessSpecifier? baseTypeSpecifier
| accessSpecifier Virtual? baseTypeSpecifier
);
classOrDeclType:
nestedNameSpecifier? className
| decltypeSpecifier;
baseTypeSpecifier: classOrDeclType;
accessSpecifier: Private | Protected | Public;
/*Special member functions*/
conversionFunctionId: Operator conversionTypeId;
conversionTypeId: typeSpecifierSeq conversionDeclarator?;
conversionDeclarator: pointerOperator conversionDeclarator?;
constructorInitializer: Colon memInitializerList;
memInitializerList:
memInitializer Ellipsis? (Comma memInitializer Ellipsis?)*;
memInitializer:
meminitializerid (
LeftParen expressionList? RightParen
| bracedInitList
);
meminitializerid: classOrDeclType | Identifier;
/*Overloading*/
operatorFunctionId: Operator theOperator;
literalOperatorId:
Operator (
StringLiteral Identifier
| UserDefinedStringLiteral
);
/*Templates*/
templateDeclaration:
Template Less templateparameterList Greater declaration;
templateparameterList:
templateParameter (Comma templateParameter)*;
templateParameter: typeParameter | parameterDeclaration;
typeParameter:
(
(Template Less templateparameterList Greater)? Class
| Typename_
) ((Ellipsis? Identifier?) | (Identifier? Assign theTypeId));
simpleTemplateId:
templateName Less templateArgumentList? Greater;
templateId:
simpleTemplateId
| (operatorFunctionId | literalOperatorId) Less templateArgumentList? Greater;
templateName: Identifier;
templateArgumentList:
templateArgument Ellipsis? (Comma templateArgument Ellipsis?)*;
templateArgument: theTypeId | constantExpression | idExpression;
typeNameSpecifier:
Typename_ nestedNameSpecifier (
Identifier
| Template? simpleTemplateId
);
explicitInstantiation: Extern? Template declaration;
explicitSpecialization: Template Less Greater declaration;
/*Exception handling*/
tryBlock: Try compoundStatement handlerSeq;
functionTryBlock:
Try constructorInitializer? compoundStatement handlerSeq;
handlerSeq: handler+;
handler:
Catch LeftParen exceptionDeclaration RightParen compoundStatement;
exceptionDeclaration:
attributeSpecifierSeq? typeSpecifierSeq (
declarator
| abstractDeclarator
)?
| Ellipsis;
throwExpression: Throw assignmentExpression?;
exceptionSpecification:
dynamicExceptionSpecification
| noeExceptSpecification;
dynamicExceptionSpecification:
Throw LeftParen typeIdList? RightParen;
typeIdList: theTypeId Ellipsis? (Comma theTypeId Ellipsis?)*;
noeExceptSpecification:
Noexcept LeftParen constantExpression RightParen
| Noexcept;
/*Preprocessing directives*/
/*Lexer*/
theOperator:
New (LeftBracket RightBracket)?
| Delete (LeftBracket RightBracket)?
| Plus
| Minus
| Star
| Div
| Mod
| Caret
| And
| Or
| Tilde
| Not
| Assign
| Greater
| Less
| GreaterEqual
| PlusAssign
| MinusAssign
| StarAssign
| ModAssign
| XorAssign
| AndAssign
| OrAssign
| Less Less
| Greater Greater
| RightShiftAssign
| LeftShiftAssign
| Equal
| NotEqual
| LessEqual
| AndAnd
| OrOr
| PlusPlus
| MinusMinus
| Comma
| ArrowStar
| Arrow
| LeftParen RightParen
| LeftBracket RightBracket;
literal:
IntegerLiteral
| CharacterLiteral
| FloatingLiteral
| StringLiteral
| BooleanLiteral
| PointerLiteral
| UserDefinedLiteral;
|
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_21829_2645.asm | ljhsiun2/medusa | 9 | 244223 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r15
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0x5f6, %rdi
nop
nop
nop
nop
cmp $290, %rax
mov (%rdi), %cx
nop
nop
cmp $51020, %r10
lea addresses_normal_ht+0x1e941, %rcx
add %r11, %r11
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
vmovups %ymm5, (%rcx)
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x11bc5, %r11
nop
nop
nop
nop
and %rbx, %rbx
mov (%r11), %eax
nop
and $51865, %r10
lea addresses_WT_ht+0x7caf, %rcx
nop
nop
nop
nop
nop
inc %r15
and $0xffffffffffffffc0, %rcx
movntdqa (%rcx), %xmm6
vpextrq $0, %xmm6, %rdi
nop
nop
nop
nop
sub $11373, %r10
lea addresses_WC_ht+0x1b7c9, %rax
clflush (%rax)
inc %rcx
mov (%rax), %rbx
nop
nop
nop
nop
dec %r15
lea addresses_WC_ht+0x17289, %rsi
lea addresses_A_ht+0x3b7d, %rdi
nop
nop
nop
nop
and $34083, %rbx
mov $122, %rcx
rep movsq
nop
nop
nop
nop
and $51867, %rdi
lea addresses_UC_ht+0x8e49, %rbx
nop
nop
nop
nop
inc %r10
movb (%rbx), %r11b
nop
nop
nop
nop
nop
dec %rcx
lea addresses_A_ht+0x133c9, %rsi
lea addresses_UC_ht+0xc86f, %rdi
nop
and %rbx, %rbx
mov $115, %rcx
rep movsl
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0x8dc9, %rax
nop
nop
nop
nop
nop
xor %r15, %r15
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
vmovups %ymm3, (%rax)
nop
nop
nop
nop
nop
cmp $59198, %r15
lea addresses_normal_ht+0x5ba9, %rdi
nop
nop
nop
cmp %rsi, %rsi
mov $0x6162636465666768, %rax
movq %rax, (%rdi)
nop
cmp %rdi, %rdi
lea addresses_WC_ht+0x91e9, %rcx
clflush (%rcx)
nop
nop
nop
cmp $64994, %r10
movw $0x6162, (%rcx)
nop
nop
nop
nop
cmp %rcx, %rcx
lea addresses_WT_ht+0xc5a9, %rcx
nop
nop
nop
add $15253, %r10
and $0xffffffffffffffc0, %rcx
vmovaps (%rcx), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $0, %xmm5, %r15
nop
nop
add $40315, %rcx
lea addresses_UC_ht+0x2209, %rcx
sub %rdi, %rdi
mov $0x6162636465666768, %r10
movq %r10, %xmm6
vmovups %ymm6, (%rcx)
xor $43434, %rcx
lea addresses_WC_ht+0xb4b1, %rax
nop
nop
nop
nop
nop
sub %rcx, %rcx
movw $0x6162, (%rax)
nop
nop
nop
inc %rbx
lea addresses_WT_ht+0x99c9, %rsi
nop
nop
sub $54237, %r15
mov (%rsi), %edi
nop
nop
nop
nop
nop
xor %r10, %r10
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r15
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r13
push %r14
push %r15
push %rbp
push %rbx
push %rdx
// Store
lea addresses_WC+0x9fc9, %rbx
add $39141, %rbp
movb $0x51, (%rbx)
xor %r13, %r13
// Store
lea addresses_WT+0x1a7e9, %rbx
nop
nop
nop
nop
sub $29158, %rdx
mov $0x5152535455565758, %rbp
movq %rbp, (%rbx)
nop
nop
cmp $41579, %r13
// Store
mov $0x259, %r13
nop
nop
nop
and $48704, %rdx
movl $0x51525354, (%r13)
nop
nop
nop
nop
nop
add $32770, %r14
// Faulty Load
lea addresses_WT+0x1dfc9, %rdx
nop
nop
dec %r15
mov (%rdx), %ebp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rdx
pop %rbx
pop %rbp
pop %r15
pop %r14
pop %r13
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_WT', 'same': False, 'size': 1, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_WC', 'same': False, 'size': 1, 'congruent': 8, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WT', 'same': False, 'size': 8, 'congruent': 2, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_P', 'same': False, 'size': 4, 'congruent': 4, 'NT': False, 'AVXalign': True}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_WT', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 2, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 16, 'congruent': 1, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'same': False, 'size': 8, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_UC_ht', 'same': False, 'size': 1, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_A_ht', 'congruent': 10, 'same': True}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 1, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': True}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 32, 'congruent': 6, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'dst': {'type': 'addresses_WC_ht', 'same': True, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'src': {'type': 'addresses_WT_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'}
{'39': 21829}
39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39 39
*/
|
docs/www.playvectrex.com/designit/chrissalo/line1.asm | mikepea/vectrex-playground | 5 | 94772 | <reponame>mikepea/vectrex-playground<filename>docs/www.playvectrex.com/designit/chrissalo/line1.asm
;***************************************************************************
; DEFINE SECTION
;***************************************************************************
INCLUDE "VECTREX.I"
; start of vectrex memory with cartridge name...
ORG 0
;***************************************************************************
; HEADER SECTION
;***************************************************************************
DB "g GCE 1998", $80 ; 'g' is copyright sign
DW music1 ; music from the rom
DB $F8, $50, $20, -$45 ; height, width, rel y, rel x
; (from 0,0)
DB "SINGLE LINE",$80 ; some game information,
; ending with $80
DB 0 ; end of game header
;***************************************************************************
; CODE SECTION
;***************************************************************************
; here the cartridge program starts off
main:
JSR Wait_Recal ; Vectrex BIOS recalibration
LDA #$80 ; scaling factor of $80 to A
STA VIA_t1_cnt_lo ; move to time 1 lo, this
; means scaling
LDA #0 ; to 0 (y)
LDB #0 ; to 0 (x)
JSR Moveto_d ; move the vector beam the
; relative position
JSR Intensity_5F ; Sets the intensity of the
; vector beam to $5f
CLR Vec_Misc_Count ; in order for drawing only 1
; vector, this must be set to
; 0
LDA #100 ; to 100 (y)
LDB #50 ; to 50 (x)
JSR Draw_Line_d ; draw the line now
BRA main ; and repeat forever
;***************************************************************************
END main
;***************************************************************************
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_109.asm | ljhsiun2/medusa | 9 | 92307 | <reponame>ljhsiun2/medusa<gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r8
push %rax
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1a2a7, %r14
nop
nop
nop
nop
nop
add %rdi, %rdi
mov (%r14), %r12d
nop
nop
nop
nop
dec %rax
lea addresses_UC_ht+0x37fb, %r8
clflush (%r8)
nop
nop
add %rsi, %rsi
movw $0x6162, (%r8)
nop
nop
nop
and $33008, %r10
lea addresses_A_ht+0x1be27, %rsi
lea addresses_WT_ht+0xe5b7, %rdi
nop
nop
nop
nop
cmp %r10, %r10
mov $52, %rcx
rep movsl
nop
and %r14, %r14
lea addresses_WC_ht+0x1827, %rsi
lea addresses_WC_ht+0x3c7b, %rdi
clflush (%rdi)
nop
nop
add %rax, %rax
mov $36, %rcx
rep movsl
and $50630, %r12
lea addresses_D_ht+0x1a42f, %rsi
lea addresses_WC_ht+0x14fa7, %rdi
xor %r8, %r8
mov $114, %rcx
rep movsw
nop
sub $29490, %rdi
lea addresses_A_ht+0x2c07, %r8
add %r14, %r14
mov (%r8), %rcx
nop
cmp %rsi, %rsi
lea addresses_WT_ht+0x8f7e, %rsi
lea addresses_WT_ht+0x178a7, %rdi
nop
nop
cmp %r14, %r14
mov $102, %rcx
rep movsb
nop
nop
nop
sub %rsi, %rsi
lea addresses_normal_ht+0xc63f, %r14
nop
cmp %r12, %r12
mov (%r14), %r10w
nop
nop
xor $361, %rdi
lea addresses_WT_ht+0xcca3, %rcx
sub %rdi, %rdi
mov $0x6162636465666768, %r14
movq %r14, (%rcx)
nop
nop
nop
nop
xor %r8, %r8
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r9
push %rcx
push %rdx
// Store
lea addresses_WC+0x57a7, %rcx
dec %rdx
movl $0x51525354, (%rcx)
nop
nop
cmp %r12, %r12
// Faulty Load
lea addresses_normal+0x1e7a7, %r14
nop
nop
nop
dec %r15
mov (%r14), %rcx
lea oracles, %r15
and $0xff, %rcx
shlq $12, %rcx
mov (%r15,%rcx,1), %rcx
pop %rdx
pop %rcx
pop %r9
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 8, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 1, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 11, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 8, 'same': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'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
*/
|
library/text parsing/parseByTags.applescript | NYHTC/applescript-fm-helper | 1 | 4530 | <filename>library/text parsing/parseByTags.applescript
-- parseByTags({sourceTEXT:"", itemStartStr:"", itemEndStr:"", includeMarkers:false})
-- <NAME>, NYHTC
-- parse sourceText by tags, optionally including them
(*
HISTORY:
2019-12-11 ( eshagdar ): created
*)
on run
parseByTags({sourceTEXT:"a*bc|d*ef|g", itemStartStr:"*", itemEndStr:"|", includeMarkers:true})
end run
--------------------
-- START OF CODE
--------------------
on parseByTags(prefs)
-- version 2019-12-11
set prefs to prefs & {sourceTEXT:null, itemStartStr:null, itemEndStr:null, includeMarkers:false}
set sourceTEXT to sourceTEXT of prefs
set itemStartStr to itemStartStr of prefs
set itemEndStr to itemEndStr of prefs
set includeMarkers to includeMarkers of prefs
set itemList to {}
try
-- ensure there are the same number of start and end strings.
--NOTE: if the start and end strings don't alternate, this will break ( not a guarantee to be safe )
set numStart to patternCount({sourceTEXT:sourceTEXT, searchString:itemStartStr})
set numEnd to patternCount({sourceTEXT:sourceTEXT, searchString:itemEndStr})
if numStart is not equal to numEnd then error "there must be the same number of start and end strings" number -1024
repeat with oneItem from 1 to numStart
copy getTextBetween({sourceTEXT:sourceTEXT, beforeTEXT:itemStartStr, afterTEXT:itemEndStr, textItemNum:oneItem + 1, includeMarkers:includeMarkers}) to end of itemList
end repeat
return itemList
on error errMsg number errNum
error "unable to parseByTags - " & errMsg number errNum
end try
end parseByTags
--------------------
-- END OF CODE
--------------------
on patternCount(prefs)
tell application "htcLib" to patternCount(prefs)
end patternCount
on getTextBetween(prefs)
tell application "htcLib" to getTextBetween(prefs)
end getTextBetween
|
oeis/127/A127595.asm | neoneye/loda-programs | 11 | 92884 | <reponame>neoneye/loda-programs
; A127595: a(n) = F(4n) - 2F(2n) where F(n) = Fibonacci numbers A000045.
; Submitted by <NAME>(s1)
; 0,1,15,128,945,6655,46080,317057,2176335,14925184,102320625,701373311,4807434240,32951037313,225850798095,1548007091840,10610205501105,72723448842367,498453982018560,3416454544730369,23416728143799375,160500643280538496,1100087776963284465,7540113801073722623,51680708845243269120,354224848154089377025,2427893228334072522255,16641027750448028519552,114059301025492267684785,781774079429804656743679,5358359254987870623360000,36726740705497673776823681,251728825683528267730708815
mov $3,1
lpb $0
sub $0,$3
mov $1,$4
add $2,1
add $2,$4
add $4,$2
lpe
mov $0,$4
add $0,$1
mul $0,$2
|
data/jpred4/jp_batch_1613899824__CwoSIJ8/jp_batch_1613899824__CwoSIJ8.als | jonriege/predict-protein-structure | 0 | 4814 | <filename>data/jpred4/jp_batch_1613899824__CwoSIJ8/jp_batch_1613899824__CwoSIJ8.als
SILENT_MODE
BLOCK_FILE jp_batch_1613899824__CwoSIJ8.concise.blc
MAX_NSEQ 839
MAX_INPUT_LEN 841
OUTPUT_FILE jp_batch_1613899824__CwoSIJ8.concise.ps
PORTRAIT
POINTSIZE 8
IDENT_WIDTH 12
X_OFFSET 2
Y_OFFSET 2
DEFINE_FONT 0 Helvetica DEFAULT
DEFINE_FONT 1 Helvetica REL 0.75
DEFINE_FONT 7 Helvetica REL 0.6
DEFINE_FONT 3 Helvetica-Bold DEFAULT
DEFINE_FONT 4 Times-Bold DEFAULT
DEFINE_FONT 5 Helvetica-BoldOblique DEFAULT
#
DEFINE_COLOUR 3 1 0.62 0.67 # Turquiose
DEFINE_COLOUR 4 1 1 0 # Yellow
DEFINE_COLOUR 5 1 0 0 # Red
DEFINE_COLOUR 7 1 0 1 # Purple
DEFINE_COLOUR 8 0 0 1 # Blue
DEFINE_COLOUR 9 0 1 0 # Green
DEFINE_COLOUR 10 0.41 0.64 1.00 # Pale blue
DEFINE_COLOUR 11 0.41 0.82 0.67 # Pale green
DEFINE_COLOUR 50 0.69 0.18 0.37 # Pink (helix)
DEFINE_COLOUR 51 1.00 0.89 0.00 # Gold (strand)
NUMBER_INT 10
SETUP
#
# Highlight specific residues.
# Avoid highlighting Lupas 'C' predictions by
# limiting the highlighting to the alignments
Scol_CHARS C 1 1 136 828 4
Ccol_CHARS H ALL 5
Ccol_CHARS P ALL 8
SURROUND_CHARS LIV ALL
#
# Replace known structure types with whitespace
SUB_CHARS 1 829 136 838 H SPACE
SUB_CHARS 1 829 136 838 E SPACE
SUB_CHARS 1 829 136 838 - SPACE
HELIX 3 832 18
COLOUR_TEXT_REGION 3 832 18 832 50
HELIX 20 832 30
COLOUR_TEXT_REGION 20 832 30 832 50
HELIX 34 832 37
COLOUR_TEXT_REGION 34 832 37 832 50
HELIX 53 832 71
COLOUR_TEXT_REGION 53 832 71 832 50
HELIX 76 832 87
COLOUR_TEXT_REGION 76 832 87 832 50
HELIX 95 832 110
COLOUR_TEXT_REGION 95 832 110 832 50
HELIX 116 832 134
COLOUR_TEXT_REGION 116 832 134 832 50
HELIX 3 837 18
COLOUR_TEXT_REGION 3 837 18 837 50
HELIX 20 837 30
COLOUR_TEXT_REGION 20 837 30 837 50
HELIX 34 837 36
COLOUR_TEXT_REGION 34 837 36 837 50
HELIX 53 837 71
COLOUR_TEXT_REGION 53 837 71 837 50
HELIX 76 837 87
COLOUR_TEXT_REGION 76 837 87 837 50
HELIX 97 837 110
COLOUR_TEXT_REGION 97 837 110 837 50
HELIX 116 837 134
COLOUR_TEXT_REGION 116 837 134 837 50
HELIX 3 838 15
COLOUR_TEXT_REGION 3 838 15 838 50
HELIX 20 838 30
COLOUR_TEXT_REGION 20 838 30 838 50
HELIX 34 838 37
COLOUR_TEXT_REGION 34 838 37 838 50
HELIX 53 838 71
COLOUR_TEXT_REGION 53 838 71 838 50
HELIX 76 838 87
COLOUR_TEXT_REGION 76 838 87 838 50
HELIX 94 838 111
COLOUR_TEXT_REGION 94 838 111 838 50
HELIX 116 838 134
COLOUR_TEXT_REGION 116 838 134 838 50
|
Transynther/x86/_processed/NONE/_zr_un_/i9-9900K_12_0xa0.log_21829_301.asm | ljhsiun2/medusa | 9 | 161053 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r14
push %r8
push %r9
push %rax
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_UC_ht+0xbd65, %rsi
nop
nop
xor %r9, %r9
movups (%rsi), %xmm3
vpextrq $0, %xmm3, %rbx
nop
nop
and $11714, %r14
lea addresses_D_ht+0x1e775, %rax
nop
nop
sub $60377, %r12
mov $0x6162636465666768, %r8
movq %r8, %xmm7
vmovups %ymm7, (%rax)
nop
nop
nop
nop
nop
cmp $9633, %r8
lea addresses_WC_ht+0xc9d, %r9
nop
nop
nop
nop
add $43141, %rsi
mov $0x6162636465666768, %r14
movq %r14, %xmm1
vmovups %ymm1, (%r9)
inc %rbx
lea addresses_A_ht+0xdd95, %rsi
lea addresses_normal_ht+0x146bd, %rdi
nop
nop
nop
nop
nop
add $52867, %r12
mov $40, %rcx
rep movsq
nop
nop
nop
nop
nop
dec %rax
lea addresses_D_ht+0xfff5, %r8
clflush (%r8)
nop
nop
nop
nop
add $7532, %rdi
mov (%r8), %r12d
nop
nop
nop
nop
nop
xor $15194, %rcx
lea addresses_WT_ht+0xb12d, %rax
nop
nop
sub $38334, %r14
vmovups (%rax), %ymm2
vextracti128 $1, %ymm2, %xmm2
vpextrq $1, %xmm2, %r9
nop
nop
nop
nop
inc %r9
lea addresses_UC_ht+0x7cf5, %r12
nop
nop
nop
nop
nop
sub $18359, %rbx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
and $0xffffffffffffffc0, %r12
vmovaps %ymm7, (%r12)
nop
nop
nop
cmp %rax, %rax
lea addresses_WC_ht+0xd375, %r14
cmp %rax, %rax
movups (%r14), %xmm3
vpextrq $0, %xmm3, %rdi
nop
nop
nop
nop
cmp %r14, %r14
lea addresses_WC_ht+0xdcf5, %rsi
nop
nop
nop
add $39807, %rbx
movb (%rsi), %al
nop
nop
nop
nop
nop
sub $53814, %rcx
lea addresses_WC_ht+0x1320d, %rsi
lea addresses_D_ht+0x188f5, %rdi
nop
nop
nop
nop
nop
cmp %rbx, %rbx
mov $59, %rcx
rep movsb
dec %rax
lea addresses_A_ht+0x3255, %rax
dec %r8
movups (%rax), %xmm3
vpextrq $1, %xmm3, %r12
nop
nop
nop
nop
sub %rax, %rax
lea addresses_UC_ht+0x80f5, %r14
nop
nop
dec %rbx
movb (%r14), %al
nop
nop
sub %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rax
pop %r9
pop %r8
pop %r14
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdx
push %rsi
// Store
lea addresses_RW+0x108f5, %rdx
dec %rsi
movl $0x51525354, (%rdx)
nop
nop
nop
nop
nop
dec %rdx
// Store
lea addresses_A+0xb2f5, %rbp
nop
add $12498, %r9
mov $0x5152535455565758, %rsi
movq %rsi, %xmm2
movups %xmm2, (%rbp)
inc %rsi
// Store
lea addresses_PSE+0x1b975, %rsi
nop
dec %rcx
mov $0x5152535455565758, %rax
movq %rax, %xmm1
movups %xmm1, (%rsi)
nop
sub $50845, %rbp
// Faulty Load
lea addresses_A+0x80f5, %rax
nop
xor %rbp, %rbp
movups (%rax), %xmm3
vpextrq $0, %xmm3, %rcx
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rsi
pop %rdx
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': True, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 9, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_PSE', 'AVXalign': False, 'size': 16}}
[Faulty Load]
{'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32}}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32}}
{'src': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_normal_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_D_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 8, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 32}}
{'src': {'NT': False, 'same': False, 'congruent': 7, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 1}, 'OP': 'LOAD'}
{'src': {'same': False, 'congruent': 3, 'type': 'addresses_WC_ht'}, 'OP': 'REPM', 'dst': {'same': True, 'congruent': 11, 'type': 'addresses_D_ht'}}
{'src': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_A_ht', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'}
{'src': {'NT': False, 'same': False, 'congruent': 10, 'type': 'addresses_UC_ht', 'AVXalign': True, 'size': 1}, 'OP': 'LOAD'}
{'7f': 21828, '00': 1}
00 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f 7f
*/
|
utils/disk-tools/hdd_ports/hdd.asm | vbmacher/qsOS | 1 | 100537 | .model small
.stack 100h
.data
readmsg db 'The buffers match. Hard disk read using ports.$'
failmsg db 'The buffers do not match.$'
buffer db 512 dup ('V')
buffer2 db 512 dup ('L')
.code
.386
start:
mov ax, @data
mov es, ax
mov dx,1f6h ;Drive and head port
mov al,0a0h ;Drive 0, head 0
out dx,al
mov dx,1f2h ;Sector count port
mov al,1 ;Read one sector
out dx,al
mov dx,1f3h ;Sector number port
mov al,1 ;Read sector one
out dx,al
mov dx,1f4h ;Cylinder low port
mov al,0 ;Cylinder 0
out dx,al
mov dx,1f5h ;Cylinder high port
mov al,0 ;The rest of the cylinder 0
out dx,al
mov dx,1f7h ;Command port
mov al,20h ;Read with retry.
out dx,al
still_going:
in al,dx
test al,8 ;This means the sector buffer requires
;servicing.
jz still_going ;Don't continue until the sector buffer
;is ready.
mov cx,512/2 ;One sector /2
mov di,offset buffer
mov dx,1f0h ;Data port - data comes in and out of here.
rep insw
; ------
mov ax,201h ;Read using int13h then compare buffers.
mov dx,80h
mov cx,1
mov bx,offset buffer2
int 13h
mov cx,512
mov si,offset buffer
mov di,offset buffer2
repe cmpsb
jne failure
mov ah,9
mov dx,offset readmsg
int 21h
jmp good_exit
failure:
mov ah,9
mov dx,offset failmsg
int 21h
good_exit:
mov ax,4c00h ;Exit the program
int 21h
end |
src/serial.asm | ando23/sysa | 0 | 244259 | <reponame>ando23/sysa<gh_stars>0
; Copyright 2022 <NAME>
; Licence: MIT
COM1 equ 0x3F8
COM2 equ 0x2F8
COM3 equ 0x3E8
COM4 equ 0x2E8
PORT equ 0x3F8
init_kcom:
OUTB (PORT + 1), 0x00 ; Disable all interrupts
OUTB (PORT + 3), 0x80 ; Enable DLAB (set baud rate divisor)
OUTB (PORT + 0), 0x03 ; Set divisor to 3 (lo byte) 38400 baud
OUTB (PORT + 1), 0x00 ; (hi byte)
OUTB (PORT + 3), 0x03 ; 8 bits, no parity, one stop bit
OUTB (PORT + 2), 0xC7 ; Enable FIFO, clear them, with 14-byte threshold
OUTB (PORT + 4), 0x0B ; IRQs enabled, RTS/DSR set
OUTB (PORT + 4), 0x1E ; Set in loopback mode, test the serial chip
OUTB (PORT + 0), 0xAE ; Test serial chip (send byte 0xAE and check if serial returns same byte)
; Check if serial is faulty (i.e: not same byte as sent)
INB (PORT), al
cmp al, 0xAE
je .step2
;FIXME Log error
ret
.step2:
; If serial is not faulty set it in normal operation mode
; (not-loopback with IRQs enabled and OUT#1 and OUT#2 bits enabled)
OUTB PORT + 4, 0x0F
ret
kputc:
push eax
.is_busy:
; Prüfe ob bereit
INB PORT+5, al
and al, 0x20
jz .is_busy
pop eax
OUTB PORT, al
ret
kputs:
push edi
mov edi, eax
call color_on
.loop:
mov al, [edi]
cmp al,0
je .end
call kputc
inc edi
jmp .loop
.end:
call color_off
pop edi
ret
; Newline ausgeben
; input: none
; output: none
; clobbers: none
kputnl:
push eax
mov al, 10
call kputc
pop eax
ret
color_on:
push edx
push eax
OUTB PORT, 0x1b
OUTB PORT, '['
OUTB PORT, '3'
OUTB PORT, '6'
OUTB PORT, 'm'
pop eax
pop edx
ret
color_off:
push edx
push eax
OUTB PORT, 0x1b
OUTB PORT, '['
OUTB PORT, '0'
OUTB PORT, 'm'
pop eax
pop edx
ret
; input al
; clobbers al
kputhexc:
cmp al,10
jl .p
sub al, 10
add al, 'A'
call kputc
ret
.p:
add al, '0'
call kputc
ret
; Hexdump of memory
; input: edi Adresse
; input: ecx Anzahl
; output: none
; clobbers: none
kputhd:
push eax
push ecx
push edi
.loop:
mov bl, [edi]
mov al, bl
and al, 0xf
call kputhexc
rol bl,4
mov al, bl
and al, 0xf
call kputhexc
mov al, 32
call kputc
inc edi
dec ecx
jnz .loop
pop edi
pop ecx
pop eax
ret
; Wert als Hex ausgeben
; input: eax 32-Bit-Wert
; output: none
; clobbers: none
kputl:
push eax
push ebx
push eax
mov al, '0'
call kputc
mov al, 'x'
call kputc
pop ebx
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
rol ebx,4
mov al, bl
and al, 0xf
call kputhexc
pop ebx
pop eax
ret
|
Numeral/Natural/Oper/Comparisons/Proofs.agda | Lolirofle/stuff-in-agda | 6 | 16009 | <filename>Numeral/Natural/Oper/Comparisons/Proofs.agda
module Numeral.Natural.Oper.Comparisons.Proofs where
open import Data.Boolean.Stmt
open import Data.Boolean
open import Logic.Propositional
open import Numeral.Natural
open import Numeral.Natural.Oper.Comparisons
open import Numeral.Natural.Oper.Proofs
open import Relator.Equals
[≤?]-𝟎 : ∀{n} → IsTrue(𝟎 ≤? n)
[≤?]-𝟎 = [⊤]-intro
[≤?]-𝐒 : ∀{n} → IsTrue(n ≤? 𝐒(n))
[≤?]-𝐒 {𝟎} = [⊤]-intro
[≤?]-𝐒 {𝐒 n} = [≤?]-𝐒 {n}
[<?]-𝟎 : ∀{n} → IsTrue(𝟎 <? 𝐒(n))
[<?]-𝟎 {𝟎} = [⊤]-intro
[<?]-𝟎 {𝐒 n} = [<?]-𝟎 {n}
[<?]-𝐒 : ∀{n} → IsTrue(n <? 𝐒(n))
[<?]-𝐒 {𝟎} = [⊤]-intro
[<?]-𝐒 {𝐒 n} = [<?]-𝐒 {n}
[≤?]-reflexivity : ∀{n} → IsTrue(n ≤? n)
[≤?]-reflexivity {𝟎} = [⊤]-intro
[≤?]-reflexivity {𝐒(n)} = [≤?]-reflexivity {n}
[<?]-positive : ∀{n} → (𝟎 <? n) ≡ positive?(n)
[<?]-positive {𝟎} = [≡]-intro
[<?]-positive {𝐒(_)} = [≡]-intro
{-# REWRITE [<?]-positive #-}
[<?]-positive-any : ∀{m n} → ⦃ _ : IsTrue(m <? n) ⦄ → IsTrue(positive?(n))
[<?]-positive-any {𝟎} {n} ⦃ p ⦄ = p
[<?]-positive-any {𝐒 m} {𝐒 n} ⦃ p ⦄ = [⊤]-intro
[≤?]-positive : ∀{n} → (𝐒(𝟎) ≤? n) ≡ positive?(n)
[≤?]-positive {𝟎} = [≡]-intro
[≤?]-positive {𝐒(_)} = [≡]-intro
[≢?]-positive : ∀{n} → (n ≢? 𝟎) ≡ positive?(n)
[≢?]-positive {𝟎} = [≡]-intro
[≢?]-positive {𝐒(_)} = [≡]-intro
[<?]-to-[≤?] : ∀{a b} → ((a <? b) ≡ (𝐒(a) ≤? b))
[<?]-to-[≤?] {𝟎} {𝟎} = [≡]-intro
[<?]-to-[≤?] {𝟎} {𝐒(_)} = [≡]-intro
[<?]-to-[≤?] {𝐒(_)}{𝟎} = [≡]-intro
[<?]-to-[≤?] {𝐒(a)}{𝐒(b)} = [<?]-to-[≤?] {a}{b}
[≡?]-zero : ∀{n} → (n ≡? 𝟎) ≡ zero?(n)
[≡?]-zero {𝟎} = [≡]-intro
[≡?]-zero {𝐒(_)} = [≡]-intro
|
apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_OF_LFXT1_nmi.asm | tp-freeforall/breakfast | 1 | 247470 | <filename>apps/breakfast/pde_fw/toast/examples/Assembly (CCE)/msp430x24x_OF_LFXT1_nmi.asm
;******************************************************************************
; MSP430x24x Demo - LFXT1 Oscillator Fault Detection
;
; Description: System runs normally in LPM3 with Timer A clocked by
; 32kHz ACLK with a 1 second interrupt. P1.0 is normally toggled every
; 1 second inside timer interrupt. If an LFXT1 oscllator fault occurs,
; NMI is requested forcing exit from LPM3. P1.0 is toggled rapidly by software
; as long as LFXT1 osciallator fault is present. Assumed only LFXT1 as NMI
; source - code does not check for other NMI sources.
; ACLK = LFXT1 = 32768Hz, MCLK = SMCLK = default DCO = 32 x ACLK = 1048576Hz
; //* An external watch crystal between XIN & XOUT is required for ACLK *//
;
; MSP430x249
; -----------------
; /|\| XIN|-
; | | | 32kHz
; --|RST XOUT|-
; | |
; | P1.0|-->LED
;
; <NAME>
; Texas Instruments Inc.
; May 2008
; Built Code Composer Essentials: v3 FET
;*******************************************************************************
.cdecls C,LIST, "msp430x24x.h"
;-------------------------------------------------------------------------------
.text ;Program Start
;-------------------------------------------------------------------------------
RESET mov.w #0500h,SP ; Initialize stackpointer
StopWDT mov.w #WDTPW+WDTHOLD,&WDTCTL ; Stop WDT
SetupP1 bis.b #001h,&P1DIR ; P1.0 = output direction
SetupTA mov.w #CCIE,&TACCTL0 ; TACCR0 interrupt enabled
mov.w #32767,&TACCR0
mov.w #TASSEL_1+MC_1,&TACTL
; An immedate Osc Fault will occur next
bis.b #OFIE,&IE1 ; Enable osc fault interrupt
;
Mainloop bis.w #LPM3+GIE,SR ; Enter LPM3, enable interrupts
xor.b #001h,&P1OUT ; Toggle P1.0
jmp Mainloop ;
;
;------------------------------------------------------------------------------
NMI_ISR; Only osc fault enabled, R15 used temporarily and not saved
; Assumed LFXT1 is only source for NMI interrupt
;------------------------------------------------------------------------------
CheckOsc bic.b #OFIFG,&IFG1 ; Clear OSC fault flag
xor.b #001h,&P1OUT ; Toggle P1.0
mov.w #03FFFh,R15 ; R15 = Delay
CheckOsc1 dec.w R15 ; Time for flag to set
jnz CheckOsc1 ;
bit.b #OFIFG,&IFG1 ; OSC fault flag set?
jnz CheckOsc ; OSC Fault, clear flag again
bis.b #OFIE,&IE1 ; re-enable osc fault interrupt
reti ; return from interrupt
;
;------------------------------------------------------------------------------
TA_ISR;
;------------------------------------------------------------------------------
xor.b #001h,&P1OUT ; Toggle P1.0
reti ;
;
;-----------------------------------------------------------------------------
; Interrupt Vectors
;-------------------------------------------------------------------------------
.sect ".reset" ; POR, ext. Reset
.short RESET ;
.sect ".int25" ; Basic Timer Vector
.short TA_ISR ;
.sect ".int30" ; NMI vector
.short NMI_ISR ;
.end |
programs/oeis/096/A096886.asm | jmorken/loda | 1 | 99336 | <reponame>jmorken/loda<gh_stars>1-10
; A096886: Expansion of (1+3*x)/(1-8*x^2).
; 1,3,8,24,64,192,512,1536,4096,12288,32768,98304,262144,786432,2097152,6291456,16777216,50331648,134217728,402653184,1073741824,3221225472,8589934592,25769803776,68719476736,206158430208,549755813888
mov $1,1
mov $2,$0
mul $0,2
lpb $0
trn $1,$2
add $3,$2
add $1,$3
mov $3,$1
add $1,1
trn $3,$0
sub $0,1
lpe
|
ExportAllFiles/ExportAllFiles.applescript | charlax/OmnigraffleScripts | 10 | 2916 | -- export all files opened in Omnigraffle to PDF
-- Copyright (c) 2011, <NAME>
-- Settings
property exportFileExtension : "pdf"
-- End of Settings
tell application "OmniGraffle Professional 5"
set export_folder to (choose folder with prompt "Pick the destination folder") as string
set area type of current export settings to entire document
set draws background of current export settings to false
repeat with theWindow in windows
set theDocument to document of theWindow
log "In window " & name of theWindow
-- check if this a true document
set hasDocument to true
try
set theFilename to name of theDocument
on error
set hasDocument to false
end try
if hasDocument then
set exportFilename to export_folder & theFilename & "." & exportFileExtension
log "Exporting " & theFilename
save theDocument in exportFilename
end if
end repeat
end tell |
Task/Van-der-Corput-sequence/Ada/van-der-corput-sequence.ada | LaudateCorpus1/RosettaCodeData | 1 | 4339 | with Ada.Text_IO;
procedure Main is
package Float_IO is new Ada.Text_IO.Float_IO (Float);
function Van_Der_Corput (N : Natural; Base : Positive := 2) return Float is
Value : Natural := N;
Result : Float := 0.0;
Exponent : Positive := 1;
begin
while Value > 0 loop
Result := Result +
Float (Value mod Base) / Float (Base ** Exponent);
Value := Value / Base;
Exponent := Exponent + 1;
end loop;
return Result;
end Van_Der_Corput;
begin
for Base in 2 .. 5 loop
Ada.Text_IO.Put ("Base" & Integer'Image (Base) & ":");
for N in 1 .. 10 loop
Ada.Text_IO.Put (' ');
Float_IO.Put (Item => Van_Der_Corput (N, Base), Exp => 0);
end loop;
Ada.Text_IO.New_Line;
end loop;
end Main;
|
grammar/DM.g4 | Wanket/DM | 0 | 7826 | grammar DM;
set : set_name '=' (elements | set_expr) ';' ;
set_expr : set_name BYNARY_OPERATOR set_name | UNARY_OPERATOR set_name | ABS_OPERATOR set_name ABS_OPERATOR;
BYNARY_OPERATOR : [^v\\x-];
UNARY_OPERATOR : [!];
ABS_OPERATOR : [|];
set_name : UPPER_STRING;
elements : '{' ((value | elements) (',' (value | elements))*)? '}';
value : FULL_STRING | UPPER_STRING;
UPPER_STRING : [A-Z_]+;
FULL_STRING : [A-Za-z0-9_А-Яа-я]+;
WS : [ \t\r\n]+ -> skip;
|
programs/oeis/272/A272144.asm | jmorken/loda | 1 | 176134 | ; A272144: Convolution of A000217 and A001045.
; 0,0,1,4,12,30,69,150,316,652,1329,2688,5412,10866,21781,43618,87300,174672,349425,698940,1397980,2796070,5592261,11184654,22369452,44739060,89478289,178956760,357913716,715827642,1431655509,2863311258,5726622772,11453245816,22906491921,45812984148,91625968620,183251937582,366503875525,733007751430,1466015503260,2932031006940,5864062014321,11728124029104,23456248058692,46912496117890,93824992236309,187649984473170,375299968946916,750599937894432,1501199875789489,3002399751579628,6004799503159932
mov $14,$0
mov $16,$0
lpb $16
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
lpb $13
mov $0,$11
sub $13,1
sub $0,$13
mov $1,2
pow $1,$0
div $1,3
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
Cubical/HITs/SetCoequalizer.agda | thomas-lamiaux/cubical | 0 | 16208 | <reponame>thomas-lamiaux/cubical<gh_stars>0
{-# OPTIONS --safe #-}
module Cubical.HITs.SetCoequalizer where
open import Cubical.HITs.SetCoequalizer.Base public
open import Cubical.HITs.SetCoequalizer.Properties public
|
programs/oeis/310/A310529.asm | neoneye/loda | 22 | 6507 | <filename>programs/oeis/310/A310529.asm
; A310529: Coordination sequence Gal.4.75.1 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,4,10,16,22,28,34,38,42,48,54,60,66,72,76,80,86,92,98,104,110,114,118,124,130,136,142,148,152,156,162,168,174,180,186,190,194,200,206,212,218,224,228,232,238,244,250,256,262,266
mov $3,$0
add $3,1
mov $7,$0
lpb $3
mov $0,$7
sub $3,1
sub $0,$3
mov $2,2
mov $4,2
mov $5,0
mov $6,2
lpb $0
mov $5,$2
mov $2,$0
mov $0,$6
add $0,$5
add $5,4
add $0,$5
div $0,10
mod $2,7
mov $4,3
sub $4,$0
mov $5,3
lpe
mul $4,$0
add $5,$4
add $5,1
add $1,$5
lpe
mov $0,$1
|
src/submarinesubsystem.ads | T-Bone-Willson/SubmarinesFormalApproaches | 0 | 3285 | package SubmarineSubSystem with SPARK_Mode is
type Operational is (On, Off); -- Can Submarine Operate?
type DoSomething is (Fire, CantFire); -- Test for actions can only be done once,
-- Nuclear Submarine is operational.
--Door Duntionality types
type AirDoorOne is (Closed, Open); -- Airlock door One closed or open
type AirDoorTwo is (Closed, Open); -- Airlock door Two Closed or open
type DoorOneLock is (Locked, Unlocked); -- Airlock door One Locked or Unlocked
type DoorTwoLock is (Locked, Unlocked); -- Airlock door Two Locked or Unlocked
-- Depth Sensor types
type DepthDive is (Dive, Surface);
type DepthStage is (Nominal, Warning, Danger);
type DepthLevel is new Integer range 0..10;
-- Oxyegen System types
type OxygenState is (High, Low);
type OxygenWarning is (Oxygen_Fine, Oxygen_Warning);
type OxygenTank is new Integer range 0..100;
-- Reactor System types
type ReactorTemp is (Fine, Overheating);
-- Submarine variables
type Submarine is record
GoodToGo : Operational;
OpTest : DoSomething;
ClosingOne : AirDoorOne;
ClosingTwo : AirDoorTwo;
LockingOne : DoorOneLock;
LockingTwo : DoorTwoLock;
DDive : DepthDive;
DStage : DepthStage;
DLevel : DepthLevel;
OState : OxygenState;
OWarning : OxygenWarning;
OTank : OxygenTank;
RTemp : ReactorTemp;
end record;
-- Record of NuclearSubmarine
NuclearSubmarine : Submarine := (GoodToGo => Off, ClosingOne => Open,
ClosingTwo => Closed, LockingOne => Unlocked,
LockingTwo => Unlocked, OpTest => CantFire,
DDive => Surface, DStage => Nominal, DLevel => 0,
OState => High, OWarning => Oxygen_Fine, OTank => 100,
RTemp => Fine);
-- Try to Start Submarine
procedure StartSubmarine with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = Off and then
NuclearSubmarine.ClosingOne = Closed
and then NuclearSubmarine.LockingOne = Locked and then
NuclearSubmarine.ClosingTwo = Closed
and then NuclearSubmarine.LockingTwo = Locked,
Post => NuclearSubmarine.GoodToGo = On;
-- Can only do if Submarine is operational, TEST!
procedure SubmarineAction with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.ClosingOne = Closed
and then NuclearSubmarine.LockingOne = Locked and then
NuclearSubmarine.ClosingTwo = Closed
and then NuclearSubmarine.LockingTwo = Locked,
Post => NuclearSubmarine.OpTest = Fire;
-----------------------------------------------------------------------------------------------
-----------------------------------DOOR FUNCTIONALITY------------------------------------------
-----------------------------------------------------------------------------------------------
-- Airlock Door One can only open if Airlock Door Two is Closed. And Vide Versa
-- These Checks are made in procedures: D1Close, D2Close, D1Open and D2 Open
-- Airlock Door One Close
procedure D1Close with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingOne = Open and then
NuclearSubmarine.ClosingTwo = Closed,
Post => NuclearSubmarine.ClosingOne = Closed;
-- Airlock Door Two Close
procedure D2Close with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingTwo = Open and then
NuclearSubmarine.ClosingOne = Closed,
Post => NuclearSubmarine.ClosingTwo = Closed;
--Airlock Door One Lock
procedure D1Lock with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingOne = Closed and then
NuclearSubmarine.LockingOne = Unlocked,
Post => NuclearSubmarine.LockingOne = Locked;
-- Airlock Door Two Lock
procedure D2Lock with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingTwo = Closed and then
NuclearSubmarine.LockingTwo = Unlocked,
Post => NuclearSubmarine.LockingTwo = Locked;
--Airlock Door One Open
procedure D1Open with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.LockingOne = Unlocked and then
NuclearSubmarine.ClosingOne = Closed and then
NuclearSubmarine.ClosingTwo = Closed,
Post => NuclearSubmarine.ClosingOne = Open;
-- Airlock Door Two Open
procedure D2Open with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.LockingTwo = Unlocked and then
NuclearSubmarine.ClosingTwo = Closed and then
NuclearSubmarine.ClosingOne = Closed,
Post => NuclearSubmarine.ClosingTwo = Open;
--Airlock Door One Unlock
procedure D1Unlock with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingOne = Closed and then
NuclearSubmarine.LockingOne = Locked,
Post => NuclearSubmarine.ClosingOne = Closed and then
NuclearSubmarine.LockingOne = Unlocked;
-- Airlock Door Two Unlock
procedure D2Unlock with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.ClosingTwo = Closed and then
NuclearSubmarine.LockingTwo = Locked,
Post => NuclearSubmarine.ClosingTwo = Closed and then
NuclearSubmarine.LockingTwo = Unlocked;
-----------------------------------------------------------------------------------------------
-----------------------------------END OF DOOR FUNCTIONALITY-----------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------DEPTH SENSOR FUNCTIONALITY----------------------------------
-----------------------------------------------------------------------------------------------
-- Gauges Depth Meter to see if Submarine is Nominal, Warning or Danger stage
procedure DepthMeterCheck with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire,
Post => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire;
-- Changes the depth of the Submarine. Cannnot go above 9.
procedure ChangeDepth with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Dive and then
NuclearSubmarine.DLevel < 8,
Post => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Dive and then
NuclearSubmarine.DLevel /= 0;
-- Checks if Submarine can Dive
procedure DiveOrNot with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Surface and then
NuclearSubmarine.RTemp = Fine,
Post => NuclearSubmarine.DDive = Dive;
-- Allows submarine to resurface
procedure Resurface with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Dive,
Post=> NuclearSubmarine.DDive = Surface and then
NuclearSubmarine.OTank = 100;
-----------------------------------------------------------------------------------------------
--------------------------- END OF DEPTH SENSOR FUNCTIONALITY----------------------------------
-----------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------
----------------------------------- OXYGEN FUNCTIONALITY --------------------------------------
-----------------------------------------------------------------------------------------------
-- Checks the integer value in OTank
procedure OxygenReserveCheck with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.OTank <= 0,
Post => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.OTank <= 0;
--This procedure will consume 10 oxygen out of OTank
procedure ConsumeOxygen with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Dive and then
NuclearSubmarine.OTank >= 10,
Post => NuclearSubmarine.GoodToGo = On and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Dive and then
NuclearSubmarine.OTank >= 0;
-----------------------------------------------------------------------------------------------
------------------------------- END OF OXYGEN FUNCTIONALITY ---------------------------------
-----------------------------------------------------------------------------------------------
-- Post condition MIGHT fail here. Look at Comments from in submarinesubsystem.adb
-- Code line 242 to 247 for clarification.
-- This procedure will still pass "Bronze" level of Proofing
procedure ReactorOverheatRoutine with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = on and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.RTemp = Fine and then
NuclearSubmarine.DDive = Dive,
Post => NuclearSubmarine.GoodToGo = on and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.RTemp = Fine and then
NuclearSubmarine.RTemp = Overheating;
procedure CoolReactor with
Global => (In_Out => NuclearSubmarine),
Pre => NuclearSubmarine.GoodToGo = on and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Surface and then
NuclearSubmarine.RTemp = Overheating,
Post => NuclearSubmarine.GoodToGo = on and then
NuclearSubmarine.OpTest = Fire and then
NuclearSubmarine.DDive = Surface and then
NuclearSubmarine.RTemp = Fine;
-----------------------------------------------------------------------------------------------
------------------------------- END OF REACTOR FUNCTIONALITY ---------------------------------
-----------------------------------------------------------------------------------------------
end SubmarineSubSystem;
|
Duploid.agda | elpinal/duploids | 5 | 12949 | module Duploid where
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; sym; cong)
open Eq.≡-Reasoning
open import Level
open import Preduploid
private
variable p q r s : Polarity
record Duploid o ℓ : Set (suc (o ⊔ ℓ)) where
field
𝒟 : Preduploid o ℓ
open Preduploid.Preduploid 𝒟 public
field
⇓ : Ob ⊝ -> Ob +
⇑ : Ob + -> Ob ⊝
delay : forall {P : Ob +} -> P ⇒ ⇑ P
force : forall {P : Ob +} -> ⇑ P ⇒ P
wrap : forall {N : Ob ⊝} -> N ⇒ ⇓ N
unwrap : forall {N : Ob ⊝} -> ⇓ N ⇒ N
force∘delay∙ : forall {A : Ob p} {P : Ob +} {f : A ⇒ P} -> force ∘ (delay ∙ f) ≡ f
∘unwrap∙wrap : forall {N : Ob ⊝} {A : Ob p} {f : N ⇒ A} -> (f ∘ unwrap) ∙ wrap ≡ f
delay∙force : forall {P : Ob +} -> delay ∙ force ≡ id {A = ⇑ P}
wrap∘unwrap : forall {N : Ob ⊝} -> wrap ∘ unwrap ≡ id {A = ⇓ N}
∙force∘delay : forall {P : Ob +} {A : Ob p} {g : P ⇒ A} -> (g ∙ force) ∘ delay ≡ g
∙force∘delay {g = g} =
begin
(g ∙ force) ∘ delay
≡⟨ assoc∙∘ ⟩
g ∙ (force ∘ delay)
≡˘⟨ cong (g ∙_) (cong (force ∘_) identity∙ʳ) ⟩
g ∙ (force ∘ (delay ∙ id))
≡⟨ cong (g ∙_) force∘delay∙ ⟩
g ∙ id
≡⟨ identity∙ʳ ⟩
g
∎
unwrap∙wrap∘ : forall {A : Ob p} {N : Ob ⊝} {g : A ⇒ N} -> unwrap ∙ (wrap ∘ g) ≡ g
unwrap∙wrap∘ {g = g} =
begin
unwrap ∙ (wrap ∘ g)
≡˘⟨ assoc∙∘ ⟩
(unwrap ∙ wrap) ∘ g
≡˘⟨ cong (_∘ g) (cong (_∙ wrap) identity∘ˡ) ⟩
((id ∘ unwrap) ∙ wrap) ∘ g
≡⟨ cong (_∘ g) ∘unwrap∙wrap ⟩
id ∘ g
≡⟨ identity∘ˡ ⟩
g
∎
wrap-Thunkable : forall {N : Ob ⊝} -> Thunkable (wrap {N = N})
wrap-Thunkable {r = +} = sym assoc∙∙
wrap-Thunkable {r = ⊝} {g = g} {h = h} =
begin
h ∘ (g ∙ wrap)
≡˘⟨ ∘unwrap∙wrap ⟩
((h ∘ (g ∙ wrap)) ∘ unwrap) ∙ wrap
≡⟨ cong (_∙ wrap) assoc∘∘ ⟩
(h ∘ ((g ∙ wrap) ∘ unwrap)) ∙ wrap
≡⟨ cong (_∙ wrap) (cong (h ∘_) assoc∙∘) ⟩
(h ∘ (g ∙ (wrap ∘ unwrap))) ∙ wrap
≡⟨ cong (_∙ wrap) (cong (h ∘_) (cong (g ∙_) wrap∘unwrap)) ⟩
(h ∘ (g ∙ id)) ∙ wrap
≡⟨ cong (_∙ wrap) (cong (h ∘_) identity∙ʳ) ⟩
(h ∘ g) ∙ wrap
∎
force-Linear : forall {P : Ob +} -> Linear (force {P = P})
force-Linear {q = +} {g = g} {h = h} = sym (
begin
(force ∘ g) ∙ h
≡˘⟨ force∘delay∙ ⟩
force ∘ (delay ∙ ((force ∘ g) ∙ h))
≡˘⟨ cong (force ∘_) assoc∙∙ ⟩
force ∘ ((delay ∙ (force ∘ g)) ∙ h)
≡˘⟨ cong (force ∘_) (cong (_∙ h) assoc∙∘) ⟩
force ∘ (((delay ∙ force) ∘ g) ∙ h)
≡⟨ cong (force ∘_) (cong (_∙ h) (cong (_∘ g) delay∙force)) ⟩
force ∘ ((id ∘ g) ∙ h)
≡⟨ cong (force ∘_) (cong (_∙ h) identity∘ˡ) ⟩
force ∘ (g ∙ h)
∎)
force-Linear {q = ⊝} = sym assoc∘∘
helper1 : forall {A : Ob p} {P : Ob +} {f : A ⇒ P}
-> (wrap ∘ delay) ∙ f ≡ wrap ∘ (delay ∙ f)
-> forall {B : Ob q} {h : ⇑ P ⇒ B} -> (h ∘ delay) ∙ f ≡ h ∘ (delay ∙ f)
helper1 {f = f} e {h = h} =
begin
(h ∘ delay) ∙ f
≡˘⟨ cong (_∙ f) (cong (_∘ delay) ∘unwrap∙wrap) ⟩
(((h ∘ unwrap) ∙ wrap) ∘ delay) ∙ f
≡⟨ cong (_∙ f) assoc∙∘ ⟩
((h ∘ unwrap) ∙ (wrap ∘ delay)) ∙ f
≡⟨ assoc∙∙ ⟩
(h ∘ unwrap) ∙ ((wrap ∘ delay) ∙ f)
≡⟨ cong ((h ∘ unwrap) ∙_) e ⟩
(h ∘ unwrap) ∙ (wrap ∘ (delay ∙ f))
≡˘⟨ assoc∙∘ ⟩
((h ∘ unwrap) ∙ wrap) ∘ (delay ∙ f)
≡⟨ cong (_∘ _) ∘unwrap∙wrap ⟩
h ∘ (delay ∙ f)
∎
assoc-wrap∘delay∙→Thunkable : forall {A : Ob p} {P : Ob +} {f : A ⇒ P}
-> (wrap ∘ delay) ∙ f ≡ wrap ∘ (delay ∙ f)
-> Thunkable f
assoc-wrap∘delay∙→Thunkable e {r = +} = sym assoc∙∙
assoc-wrap∘delay∙→Thunkable {f = f} e {r = ⊝} {g = g} {h = h} =
begin
h ∘ (g ∙ f)
≡˘⟨ cong (h ∘_) (cong (_∙ f) ∙force∘delay) ⟩
h ∘ (((g ∙ force) ∘ delay) ∙ f)
≡⟨ cong (h ∘_) (helper1 e) ⟩
h ∘ ((g ∙ force) ∘ (delay ∙ f))
≡˘⟨ assoc∘∘ ⟩
(h ∘ (g ∙ force)) ∘ (delay ∙ f)
≡˘⟨ helper1 e ⟩
((h ∘ (g ∙ force)) ∘ delay) ∙ f
≡⟨ cong (_∙ f) assoc∘∘ ⟩
(h ∘ ((g ∙ force) ∘ delay)) ∙ f
≡⟨ cong (_∙ f) (cong (h ∘_) ∙force∘delay) ⟩
(h ∘ g) ∙ f
∎
helper2 : forall {N : Ob ⊝} {A : Ob p} {f : N ⇒ A}
-> f ∘ (unwrap ∙ force) ≡ (f ∘ unwrap) ∙ force
-> forall {B : Ob q} {h : B ⇒ ⇓ N} -> f ∘ (unwrap ∙ h) ≡ (f ∘ unwrap) ∙ h
helper2 {f = f} e {h = h} =
begin
f ∘ (unwrap ∙ h)
≡˘⟨ cong (f ∘_) (cong (unwrap ∙_) force∘delay∙) ⟩
f ∘ (unwrap ∙ (force ∘ (delay ∙ h)))
≡˘⟨ cong (f ∘_) assoc∙∘ ⟩
f ∘ ((unwrap ∙ force) ∘ (delay ∙ h))
≡˘⟨ assoc∘∘ ⟩
(f ∘ (unwrap ∙ force)) ∘ (delay ∙ h)
≡⟨ cong (_∘ (delay ∙ h)) e ⟩
((f ∘ unwrap) ∙ force) ∘ (delay ∙ h)
≡⟨ assoc∙∘ ⟩
(f ∘ unwrap) ∙ (force ∘ (delay ∙ h))
≡⟨ cong ((f ∘ unwrap) ∙_) force∘delay∙ ⟩
(f ∘ unwrap) ∙ h
∎
assoc-∘unwrap∙force→Linear : forall {N : Ob ⊝} {A : Ob p} {f : N ⇒ A}
-> f ∘ (unwrap ∙ force) ≡ (f ∘ unwrap) ∙ force
-> Linear f
assoc-∘unwrap∙force→Linear {f = f} e {q = +} {g = g} {h = h} =
begin
f ∘ (g ∙ h)
≡˘⟨ cong (f ∘_) (cong (_∙ h) unwrap∙wrap∘) ⟩
f ∘ ((unwrap ∙ (wrap ∘ g)) ∙ h)
≡⟨ cong (f ∘_) assoc∙∙ ⟩
f ∘ (unwrap ∙ ((wrap ∘ g) ∙ h))
≡⟨ helper2 e ⟩
(f ∘ unwrap) ∙ ((wrap ∘ g) ∙ h)
≡˘⟨ assoc∙∙ ⟩
((f ∘ unwrap) ∙ (wrap ∘ g)) ∙ h
≡˘⟨ cong (_∙ h) assoc∙∘ ⟩
(((f ∘ unwrap) ∙ wrap) ∘ g) ∙ h
≡⟨ cong (_∙ h) (cong (_∘ g) ∘unwrap∙wrap) ⟩
(f ∘ g) ∙ h
∎
assoc-∘unwrap∙force→Linear e {q = ⊝} = sym assoc∘∘
|
tests/nonsmoke/functional/CompileTests/experimental_ada_tests/tests/delay_until.adb | ouankou/rose | 488 | 22930 | with Ada.Real_Time;
procedure Delay_Until is
use Ada.Real_Time;
Start_Time : Time := Clock;
Period : constant Time_Span := Milliseconds(5000);
Poll_Time : Time;
begin
Poll_Time := Start_Time;
delay until Poll_Time;
end Delay_Until;
|
virtdata-lang/src/main/java/io/nosqlbench/virtdata/lang/oldgrammars/Config.g4 | msmygit/nosqlbench | 115 | 7448 | <reponame>msmygit/nosqlbench<filename>virtdata-lang/src/main/java/io/nosqlbench/virtdata/lang/oldgrammars/Config.g4<gh_stars>100-1000
grammar Config;
// https://www.youtube.com/watch?v=eW4WFgRtFeY
config : OPEN_BRACE? assignments CLOSE_BRACE?;
scope : OPEN_BRACE assignments CLOSE_BRACE;
assignments : assignment? ( COMMA assignment )* ;
assignment :
(ID OPEN_BRACE cval CLOSE_BRACE)
| (ID ASSIGN cval)
| ( ID ASSIGN? scope );
ASSIGN : '=' | ':' ;
OPEN_BRACE : '{';
CLOSE_BRACE : '}';
COMMA : ',';
ID: IDPART ('.' IDPART)* ;
IDPART: ( ( [a-zA-Z] [0-9a-zA-Z_]* )
| ( [a-zA-Z] [0-9a-zA-Z_]* '-' [0-9a-zA-Z_]) )
;
NEWLINE : '\r' '\n' | '\n' | '\r';
cval : ( realNumber | wholeNumber | booleanValue | stringValue | hexValue);
realNumber: FLOAT;
wholeNumber: INTEGER;
booleanValue: BOOLEAN;
stringValue : SSTRING_LITERAL | DSTRING_LITERAL | RAW_SCOPE_LITERAL;
hexValue : HEX_LITERAL;
LONG : '-'? INT ('l'|'L') ;
DOUBLE : ('-'? INT '.' '0'* INT EXP? | '-'? INT EXP | '-'? INT ) ('d'|'D') ;
INTEGER : '-'? INT ;
FLOAT
: '-'? INT '.' INT EXP? // 1.35, 1.35E-9, 0.3, -4.5
| '-'? INT EXP // 1e10 -3e4
| '-'? INT // -3, 45
;
BOOLEAN : 'true' | 'false';
HEX_LITERAL: '0' ('x'|'X') HEX_CHAR+ ;
fragment HEX_CHAR: [0123456789ABCDEFabcdef_];
fragment INT : '0' | [1-9] [0-9]* ; // no leading zeros
fragment ZINT : [0-9]* ; // leading zeroes
fragment EXP : [Ee] [+\-]? INT ;
SSTRING_LITERAL : '\'' (~('\'' | '\\' | '\r' | '\n') | '\\' ('\'' | '\\' | . ))* '\'';
DSTRING_LITERAL :
'"'
(
~('"' | '\\' | '\r' | '\n')
| '\\' ('"' | '\\' | .)
)*
'"';
fragment RAW_SCOPE_LITERAL: ~('}' | '\r' | '\n')+;
fragment RAW_BASIC_LITERAL : ~('"' | '\\' | '\r' | '\n')+;
WS : [\u000C \t\n]+ -> channel(HIDDEN);
|
gramatica/src/main/antlr4/com/github/kyrosdata/parser/Expressao.g4 | kirebr/parser | 2 | 1090 | // Gramática para expressões matemáticas
grammar Expressao;
// Sentença válida é uma equação (comparação) ou simples expressão
sentenca : ( equacao | expr );
equacao
: expr comparacao expr
;
expr
: expr POTENCIA expr
| expr (MULTIPLICACAO | DIVISAO) expr
| expr (ADICAO | SUBTRACAO) expr
| ABRE expr FECHA
| (SUBTRACAO)? operando
;
operando
: constante
| variavel
;
constante
: NUMERO
;
variavel
: VARIAVEL
;
comparacao
: EQ
| NE
| GT
| GE
| LT
| LE
;
VARIAVEL
: PRIMEIRO_CARACTERE OUTRO_CARACTERE*
;
fragment PRIMEIRO_CARACTERE
: ('a' .. 'z') | ('A' .. 'Z')
;
fragment OUTRO_CARACTERE
: PRIMEIRO_CARACTERE | DIGITO
;
NUMERO
: IRRACIONAL (E SINAL? INTEIRO_SEM_SINAL)?
;
fragment IRRACIONAL
: DIGITO + ('.' DIGITO +)?
;
fragment INTEIRO_SEM_SINAL
: DIGITO+
;
fragment E
: 'E' | 'e'
;
fragment DIGITO
: ('0' .. '9')
;
fragment SINAL
: ('+' | '-')
;
ABRE
: '('
;
FECHA
: ')'
;
ADICAO
: '+'
;
SUBTRACAO
: '-'
;
MULTIPLICACAO
: '*'
;
DIVISAO
: '/'
;
GT
: '>'
;
GE
: '>='
;
LT
: '<'
;
LE
: '<='
;
EQ
: '='
;
NE
: '!='
;
POINT
: '.'
;
POTENCIA
: '^'
;
WS
: [ \r\n\t] + -> skip
;
|
oeis/077/A077611.asm | neoneye/loda-programs | 11 | 86854 | ; A077611: Number of adjacent pairs of form (odd,odd) among all permutations of {1,2,...,n}.
; Submitted by <NAME>(s2)
; 0,0,4,12,144,720,8640,60480,806400,7257600,108864000,1197504000,20118067200,261534873600,4881984307200,73229764608000,1506440871936000,25609494822912000,576213633515520000,10948059036794880000,267619220899430400000,5620003638888038400000,148368096066644213760000,3412466209532816916480000,96789950670385352540160000,2419748766759633813504000000,73399045925042225676288000000,1981774239976140093259776000000,64026552368459910705315840000000,1856770018685337410454159360000000
mov $1,$0
add $0,2
div $0,2
bin $0,2
lpb $1
mul $0,$1
sub $1,1
lpe
mul $0,2
|
Transynther/x86/_processed/AVXALIGN/_ht_/i7-7700_9_0x48_notsx.log_12_1320.asm | ljhsiun2/medusa | 9 | 166156 | <reponame>ljhsiun2/medusa<filename>Transynther/x86/_processed/AVXALIGN/_ht_/i7-7700_9_0x48_notsx.log_12_1320.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r14
push %r15
push %r9
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x62dc, %rsi
nop
sub $13006, %r9
mov $0x6162636465666768, %rbx
movq %rbx, %xmm5
and $0xffffffffffffffc0, %rsi
movaps %xmm5, (%rsi)
nop
nop
nop
add $25988, %r10
lea addresses_WT_ht+0x3f48, %r14
nop
nop
sub $41337, %rdx
mov $0x6162636465666768, %r15
movq %r15, (%r14)
and %rsi, %rsi
lea addresses_A_ht+0x6c0c, %r10
xor $28205, %rsi
mov (%r10), %r14
nop
nop
nop
nop
add $34648, %r15
lea addresses_UC_ht+0x5d14, %rbx
inc %r14
movb $0x61, (%rbx)
nop
and $29846, %rsi
lea addresses_normal_ht+0x11ddc, %r14
nop
cmp %r15, %r15
movb $0x61, (%r14)
nop
nop
nop
nop
nop
and $44825, %rsi
lea addresses_D_ht+0x23c5, %rsi
nop
nop
cmp %r14, %r14
movb (%rsi), %dl
nop
cmp $15418, %r10
lea addresses_D_ht+0x1643e, %rsi
lea addresses_UC_ht+0x34dc, %rdi
nop
nop
nop
nop
add $33056, %r15
mov $72, %rcx
rep movsl
nop
nop
sub %r10, %r10
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r15
pop %r14
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r13
push %r9
push %rax
push %rbp
push %rcx
push %rdi
// Store
lea addresses_D+0x1a8dc, %rax
nop
nop
nop
nop
add $3752, %rdi
movl $0x51525354, (%rax)
nop
cmp $60409, %rcx
// Store
lea addresses_D+0x1459c, %r13
nop
nop
nop
nop
cmp %r9, %r9
movb $0x51, (%r13)
nop
and $19730, %rax
// Store
lea addresses_A+0x776c, %rbp
nop
nop
nop
xor %rdi, %rdi
movw $0x5152, (%rbp)
nop
nop
nop
inc %rbp
// Load
mov $0x6706ca000000051a, %r12
cmp %rax, %rax
vmovups (%r12), %ymm2
vextracti128 $0, %ymm2, %xmm2
vpextrq $0, %xmm2, %rcx
nop
nop
nop
nop
dec %r9
// Store
lea addresses_UC+0xccdc, %r13
nop
nop
nop
nop
cmp $40648, %rax
mov $0x5152535455565758, %r9
movq %r9, %xmm0
vmovaps %ymm0, (%r13)
nop
nop
cmp $46558, %r9
// Faulty Load
mov $0x2dc, %r13
nop
nop
xor %rbp, %rbp
movntdqa (%r13), %xmm6
vpextrq $1, %xmm6, %rax
lea oracles, %rcx
and $0xff, %rax
shlq $12, %rax
mov (%rcx,%rax,1), %rax
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r13
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_P', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D', 'congruent': 8}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_D', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_A', 'congruent': 4}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_NC', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_UC', 'congruent': 9}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': True, 'AVXalign': False, 'size': 16, 'type': 'addresses_P', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 10}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_WT_ht', 'congruent': 2}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A_ht', 'congruent': 2}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 3}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_normal_ht', 'congruent': 8}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 1, 'type': 'addresses_D_ht', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 7, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}}
{'46': 12}
46 46 46 46 46 46 46 46 46 46 46 46
*/
|
Cubical/Relation/Binary/Structures.agda | bijan2005/univalent-foundations | 0 | 338 | {-# OPTIONS --cubical --no-import-sorts --safe #-}
open import Cubical.Relation.Binary.Base
open import Cubical.Core.Everything
module Cubical.Relation.Binary.Structures
{a ℓ} {A : Type a} -- The underlying type
(_<>_ : Rel A ℓ) -- The relation
where
open import Cubical.Foundations.Prelude using (refl; sym; isSet)
open import Cubical.Foundations.Function using (_∘_; id)
open import Cubical.Foundations.Logic hiding (¬_)
open import Cubical.Relation.Nullary.Decidable
open import Cubical.Relation.Binary.Definitions
open import Cubical.Relation.Binary.Properties
open import Cubical.HITs.PropositionalTruncation
import Cubical.Relation.Binary.Raw.Structures [ _<>_ ] as Raw
private
variable
ℓ₂ : Level
------------------------------------------------------------------------
-- Preorders
------------------------------------------------------------------------
record IsPreorder : Type (ℓ-max a ℓ) where
constructor ispreorder
field
reflexive : Reflexive _<>_
transitive : Transitive _<>_
fromEq : FromEq _<>_
fromEq = reflx→fromeq _<>_ reflexive
raw : Raw.IsPreorder
raw = record
{ reflexive = reflexive
; transitive = transitive
}
------------------------------------------------------------------------
-- Equivalences
------------------------------------------------------------------------
record IsPartialEquivalence : Type (ℓ-max a ℓ) where
constructor ispartialeq
field
symmetric : Symmetric _<>_
transitive : Transitive _<>_
raw : Raw.IsPartialEquivalence
raw = record
{ symmetric = symmetric
; transitive = transitive
}
record IsEquivalence : Type (ℓ-max a ℓ) where
constructor isequivalence
field
reflexive : Reflexive _<>_
isPartialEquivalence : IsPartialEquivalence
open IsPartialEquivalence isPartialEquivalence public hiding (raw)
from-≡ : FromEq _<>_
from-≡ = reflx→fromeq _<>_ reflexive
isPreorder : IsPreorder
isPreorder = record
{ reflexive = reflexive
; transitive = transitive
}
raw : Raw.IsEquivalence
raw = record
{ reflexive = reflexive
; isPartialEquivalence = IsPartialEquivalence.raw isPartialEquivalence
}
record IsDecEquivalence : Type (ℓ-max a ℓ) where
constructor isdeceq
infix 4 _≟_
field
isEquivalence : IsEquivalence
_≟_ : Decidable _<>_
open IsEquivalence isEquivalence public hiding (raw)
raw : Raw.IsDecEquivalence
raw = record
{ isEquivalence = IsEquivalence.raw isEquivalence
; _≟_ = _≟_
}
------------------------------------------------------------------------
-- Partial orders
------------------------------------------------------------------------
record IsPartialOrder : Type (ℓ-max a ℓ) where
constructor ispartialorder
field
isPreorder : IsPreorder
antisym : Antisymmetric _<>_
open IsPreorder isPreorder public hiding (raw)
raw : isSet A → Raw.IsPartialOrder
raw isSetA = record
{ isPreorder = IsPreorder.raw isPreorder
; antisym = λ x y → rec (isSetA _ _) id (antisym x y)
}
record IsDecPartialOrder : Type (ℓ-max a ℓ) where
constructor isdecpartialorder
infix 4 _≤?_
field
isPartialOrder : IsPartialOrder
_≤?_ : Decidable _<>_
open IsPartialOrder isPartialOrder public hiding (raw)
private
lemma : ∀ {x y} → ¬ ⟨ x <> y ⟩ → ¬ x ≡ y
lemma x≰y x≡y = x≰y (fromEq ∣ x≡y ∣)
raw : isSet A → Raw.IsDecPartialOrder
raw isSetA = record
{ isPartialOrder = IsPartialOrder.raw isPartialOrder isSetA
; _≤?_ = _≤?_
}
record IsStrictPartialOrder : Type (ℓ-max a ℓ) where
constructor isstrictpartialorder
field
irrefl : Irreflexive _<>_
transitive : Transitive _<>_
asym : Asymmetric _<>_
asym {x} {y} = trans∧irr→asym _<>_ transitive irrefl
raw : Raw.IsStrictPartialOrder
raw = record
{ irrefl = irrefl
; transitive = transitive
}
record IsDecStrictPartialOrder : Type (ℓ-max a ℓ) where
constructor isdecstrictpartialorder
infix 4 _<?_
field
isStrictPartialOrder : IsStrictPartialOrder
_<?_ : Decidable _<>_
open IsStrictPartialOrder isStrictPartialOrder public hiding (raw)
raw : isSet A → Raw.IsDecStrictPartialOrder
raw isSetA = record
{ isStrictPartialOrder = IsStrictPartialOrder.raw isStrictPartialOrder
; _<?_ = _<?_
}
------------------------------------------------------------------------
-- Total orders
------------------------------------------------------------------------
record IsTotalOrder : Type (ℓ-max a ℓ) where
constructor istotalorder
field
isPartialOrder : IsPartialOrder
total : Total _<>_
open IsPartialOrder isPartialOrder public hiding (raw)
raw : isSet A → Raw.IsTotalOrder
raw isSetA = record
{ isPartialOrder = IsPartialOrder.raw isPartialOrder isSetA
; total = total
}
record IsDecTotalOrder : Type (ℓ-max a ℓ) where
constructor isdectotalorder
infix 4 _≤?_
field
isTotalOrder : IsTotalOrder
_≤?_ : Decidable _<>_
open IsTotalOrder isTotalOrder public hiding (raw)
isDecPartialOrder : IsDecPartialOrder
isDecPartialOrder = record
{ isPartialOrder = isPartialOrder
; _≤?_ = _≤?_
}
raw : isSet A → Raw.IsDecTotalOrder
raw isSetA = record
{ isTotalOrder = IsTotalOrder.raw isTotalOrder isSetA
; _≤?_ = _≤?_
}
-- Note that these orders are decidable. The current implementation
-- of `Trichotomous` subsumes irreflexivity and asymmetry. Any reasonable
-- definition capturing these three properties implies decidability
-- as `Trichotomous` necessarily separates out the equality case.
record IsStrictTotalOrder : Type (ℓ-max a ℓ) where
constructor isstricttotalorder
field
transitive : Transitive _<>_
compare : Trichotomous _<>_
infix 4 _<?_
_<?_ : Decidable _<>_
_<?_ = tri→dec< _<>_ compare
_≟_ : Discrete A
_≟_ = tri→dec≡ _<>_ compare
isStrictPartialOrder : IsStrictPartialOrder
isStrictPartialOrder = record
{ irrefl = tri→irr _<>_ compare
; transitive = transitive
}
isDecStrictPartialOrder : IsDecStrictPartialOrder
isDecStrictPartialOrder = record
{ isStrictPartialOrder = isStrictPartialOrder
; _<?_ = _<?_
}
open IsStrictPartialOrder isStrictPartialOrder public hiding (transitive; raw)
raw : isSet A → Raw.IsStrictTotalOrder
raw isSetA = record
{ transitive = transitive
; compare = triRaw compare
}
where
import Cubical.Relation.Binary.Raw.Definitions as RawDefinitions
triRaw : Trichotomous _<>_ → RawDefinitions.Trichotomous [ _<>_ ]
triRaw tri x y with tri x y
... | tri< a b c = RawDefinitions.tri< a b c
... | tri≡ a b c = RawDefinitions.tri≡ a b c
... | tri> a b c = RawDefinitions.tri> a b c
|
alloy4fun_models/trashltl/models/4/Dc5dhHHhwvTrs7EBe.als | Kaixi26/org.alloytools.alloy | 0 | 3408 | open main
pred idDc5dhHHhwvTrs7EBe_prop5 {
some f : File | eventually after f not in File
}
pred __repair { idDc5dhHHhwvTrs7EBe_prop5 }
check __repair { idDc5dhHHhwvTrs7EBe_prop5 <=> prop5o } |
oeis/065/A065889.asm | neoneye/loda-programs | 11 | 96246 | ; A065889: a(n) = number of unicyclic connected simple graphs whose cycle has length 4.
; Submitted by <NAME>(s3.)
; 3,60,1080,20580,430080,9920232,252000000,7015381560,212840939520,6998969586180,248180493969408,9445533398437500,384213343210045440,16639691095281974160,764619269867445288960,37163398969133506235952,1905131520000000000000000,102743443333179386280014220,5815420867270149042127503360,344723475685469082796017209940,21358200057887127318425593970688,1380612957291305065155029296875000,92952857706814768050175616640614400,6508204312982428163420487163823207400,473194706175158730117457066104088166400
mov $1,-4
sub $1,$0
pow $1,$0
mov $2,-4
bin $2,$0
mul $1,$2
mov $0,$1
mul $0,3
|
Silicon/BroxtonSoC/BroxtonSiPkg/Cpu/Library/Private/PeiCpuS3Lib/Ia32/MpFuncs.asm | bcran/edk2-platforms | 0 | 90468 | ;; @file
; This is the assembly code for MP support.
;
; Copyright (c) 2005 - 2016, Intel Corporation. All rights reserved.<BR>
;
; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License
; which accompanies this distribution. The full text of the license may be found at
; http://opensource.org/licenses/bsd-license.php.
;
; THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
; WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED
;
;;
include MpEqu.inc
;-------------------------------------------------------------------------------------
;S3RendezvousFunnelProc procedure follows. All APs execute their procedure. This
;procedure serializes all the AP processors through an Init sequence. It must be
;noted that APs arrive here very raw...ie: real mode, no stack.
;ALSO THIS PROCEDURE IS EXECUTED BY APs ONLY ON 16 BIT MODE. HENCE THIS PROC
;IS IN MACHINE CODE.
;-------------------------------------------------------------------------------------
;S3RendezvousFunnelProc (&WakeUpBuffer,MemAddress);
.686p
.model flat
.code
PAUSE32 MACRO
DB 0F3h
DB 090h
ENDM
S3RendezvousFunnelProc PROC PUBLIC
S3RendezvousFunnelProcStart::
;Step-1: Grab a lock. At this point CS = 0x(vv00) and ip= 0x0.
db 8ch,0c8h ; mov ax,cs
db 8eh,0d8h ; mov ds,ax
db 8eh,0c0h ; mov es,ax
db 8eh,0d0h ; mov ss,ax
db 33h,0c0h ; xor ax,ax
db 8eh,0e0h ; mov fs,ax
db 8eh,0e8h ; mov gs,ax
db 0BEh ; opcode of mov si, mem16
dw BufferStartLocation ; mov si, BufferStartLocation
db 66h, 8Bh, 1Ch ; mov ebx,dword ptr [si]
db 0BFh ; opcode of mov di, mem16
dw PmodeOffsetLocation ; mov di, PmodeOffsetLocation
db 66h, 8Bh, 05h ; mov eax,dword ptr [di]
db 8Bh, 0F8h ; mov di, ax
db 83h, 0EFh,06h ; sub di, 06h
db 66h, 03h, 0C3h ; add eax, ebx
db 66h, 89h, 05h ; mov dword ptr [di],eax
db 0BEh ; opcode of mov si, mem16
dw GdtrLocation ; mov si, GdtrLocation
db 66h ; db 66h
db 2Eh, 0Fh, 01h, 14h ; lgdt fword ptr cs:[si]
db 0BEh ; opcode of mov si, mem16
dw IdtrLocation ; mov si, IdtrProfile
db 66h ; db 66h
db 2Eh, 0Fh, 01h, 1Ch ; lidt fword ptr cs:[si]
db 33h, 0C0h ; xor ax, ax
db 8Eh, 0D8h ; mov ds, ax
db 0Fh, 20h, 0C0h ; mov eax, cr0 ;Get control register 0
db 66h, 83h, 0C8h, 03h ; or eax, 000000003h ;Set PE bit (bit #0) & MP
db 0Fh, 22h, 0C0h ; mov cr0, eax
db 66h, 67h, 0EAh ; far jump
dd 0h ; 32-bit offset
dw 20h ; 16-bit selector
NemInit:: ; protected mode entry point
db 66h, 0B8h, 18h, 00h ; mov ax, 18h
db 66h, 8Eh, 0D8h ; mov ds, ax
db 66h, 8Eh, 0C0h ; mov es, ax
db 66h, 8Eh, 0E0h ; mov fs, ax
db 66h, 8Eh, 0E8h ; mov gs, ax
db 66h, 8Eh, 0D0h ; mov ss, ax ; Flat mode setup.
mov esi, ebx
mov edi, esi
add edi, StartStateLocation
mov eax, 1
mov dword ptr [edi], eax
mov edi, esi
add edi, LockLocation
mov eax, NotVacantFlag
TestLock::
xchg dword ptr [edi], eax
cmp eax, NotVacantFlag
jz TestLock
ProgramStack::
mov edi, esi
add edi, StackSizeLocation
mov eax, dword ptr [edi]
mov edi, esi
add edi, StackStartAddressLocation
add eax, dword ptr [edi]
mov esp, eax
mov dword ptr [edi], eax
Releaselock::
mov eax, VacantFlag
mov edi, esi
add edi, LockLocation
xchg dword ptr [edi], eax
CProcedureInvoke::
mov edi, esi
add edi, MtrrValuesAddressLocation
mov eax, dword ptr [edi]
push eax
mov eax, esi
add eax, LockLocation
push eax
mov edi, esi
add edi, CProcedureLocation
mov eax, dword ptr [edi]
;
; itp.threads[n].msr(0x121, 0x2FBA2E2500010408)
; WA for ACPI PM1 timer BXT 0 and 1
;
push ecx
push eax
push edx
mov ecx, 0121h
rdmsr
test eax, eax
jnz SkipAcpiTimerWA
mov eax, 00010408h ; Bit 16 is enable and 15:0 address
mov edx, 2FBA2E25h
wrmsr
SkipAcpiTimerWA:
pop edx
pop eax
pop ecx
call eax
add esp, 8
cli
hlt
jmp $-2
S3RendezvousFunnelProc ENDP
S3SemaphoreStartAddress PROC C, SemaphoreAddress:PTR DWORD
mov eax, SemaphoreAddress
@@:
cmp dword ptr [eax], 0
jz @F
PAUSE32
jmp @B
@@:
ret
S3SemaphoreStartAddress ENDP
S3RendezvousFunnelProcEnd::
;-------------------------------------------------------------------------------------
; S3AsmGetAddressMap (&AddressMap);
;-------------------------------------------------------------------------------------
S3AsmGetAddressMap PROC near C PUBLIC
mov eax, S3RendezvousFunnelProcStart
ret
S3AsmGetAddressMap ENDP
S3AsmGetPmodeOffset PROC near C PUBLIC
mov eax, NemInit - S3RendezvousFunnelProcStart
ret
S3AsmGetPmodeOffset ENDP
S3AsmGetSemaphoreCheckOffset PROC near C PUBLIC
mov eax, S3SemaphoreStartAddress - S3RendezvousFunnelProcStart
ret
S3AsmGetSemaphoreCheckOffset ENDP
END
|
vendor/stdlib/src/Size.agda | isabella232/Lemmachine | 56 | 15913 | <reponame>isabella232/Lemmachine
------------------------------------------------------------------------
-- Sizes for Agda's sized types
------------------------------------------------------------------------
module Size where
postulate
Size : Set
↑_ : Size → Size
∞ : Size
{-# BUILTIN SIZE Size #-}
{-# BUILTIN SIZESUC ↑_ #-}
{-# BUILTIN SIZEINF ∞ #-}
|
orka/src/gl/interface/gl.ads | onox/orka | 52 | 30828 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2012 <NAME> <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
with Interfaces.C;
with Orka;
package GL is
pragma Pure;
package C renames Interfaces.C;
-- Index types for vectors and matrices
subtype Index_Homogeneous is Orka.Index_Homogeneous;
subtype Index_2D is Orka.Index_2D;
subtype Index_3D is Orka.Index_3D;
use all type Orka.Integer_32;
use all type Orka.Integer_64;
use all type Orka.Float_32;
use all type Orka.Float_64;
use all type Index_Homogeneous;
Feature_Not_Supported_Exception : exception;
-- Raised when a function that is not available for the current
-- context is called
end GL;
|
examples/terminate.asm | Zottel/opencl_scad_experiment | 0 | 178025 | $1 -> pc
|
src/drivers/dmac_u2503/sam-dmac-sources.ads | Fabien-Chouteau/samd51-hal | 1 | 23028 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2019, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
package SAM.DMAC.Sources is
DISABLE : constant Trigger_Source := 16#00#;
RTC_TIMESTAMP : constant Trigger_Source := 16#01#;
DSU_DCC0 : constant Trigger_Source := 16#02#;
DSU_DCC1 : constant Trigger_Source := 16#03#;
SERCOM0_RX : constant Trigger_Source := 16#04#;
SERCOM0_TX : constant Trigger_Source := 16#05#;
SERCOM1_RX : constant Trigger_Source := 16#06#;
SERCOM1_TX : constant Trigger_Source := 16#07#;
SERCOM2_RX : constant Trigger_Source := 16#08#;
SERCOM2_TX : constant Trigger_Source := 16#09#;
SERCOM3_RX : constant Trigger_Source := 16#0A#;
SERCOM3_TX : constant Trigger_Source := 16#0B#;
SERCOM4_RX : constant Trigger_Source := 16#0C#;
SERCOM4_TX : constant Trigger_Source := 16#0D#;
SERCOM5_RX : constant Trigger_Source := 16#0E#;
SERCOM5_TX : constant Trigger_Source := 16#0F#;
SERCOM6_RX : constant Trigger_Source := 16#10#;
SERCOM6_TX : constant Trigger_Source := 16#11#;
SERCOM7_RX : constant Trigger_Source := 16#12#;
SERCOM7_TX : constant Trigger_Source := 16#13#;
CAN0_DEBUG : constant Trigger_Source := 16#14#;
CAN1_DEBUG : constant Trigger_Source := 16#15#;
TCC0_OVF : constant Trigger_Source := 16#16#;
TCC0_MC0 : constant Trigger_Source := 16#17#;
TCC0_MC1 : constant Trigger_Source := 16#18#;
TCC0_MC2 : constant Trigger_Source := 16#19#;
TCC0_MC3 : constant Trigger_Source := 16#1A#;
TCC0_MC4 : constant Trigger_Source := 16#1B#;
TCC0_MC5 : constant Trigger_Source := 16#1C#;
TCC1_OVF : constant Trigger_Source := 16#1D#;
TCC1_MC0 : constant Trigger_Source := 16#1E#;
TCC1_MC1 : constant Trigger_Source := 16#1F#;
TCC1_MC2 : constant Trigger_Source := 16#20#;
TCC1_MC3 : constant Trigger_Source := 16#21#;
TCC2_OVF : constant Trigger_Source := 16#22#;
TCC2_MC0 : constant Trigger_Source := 16#23#;
TCC2_MC1 : constant Trigger_Source := 16#24#;
TCC2_MC2 : constant Trigger_Source := 16#25#;
TCC3_OVF : constant Trigger_Source := 16#26#;
TCC3_MC0 : constant Trigger_Source := 16#27#;
TCC3_MC1 : constant Trigger_Source := 16#28#;
TCC4_OVF : constant Trigger_Source := 16#29#;
TCC4_MC0 : constant Trigger_Source := 16#2A#;
TCC4_MC1 : constant Trigger_Source := 16#2B#;
TC0_OVF : constant Trigger_Source := 16#2C#;
TC0_MC0 : constant Trigger_Source := 16#2D#;
TC0_MC1 : constant Trigger_Source := 16#2E#;
TC1_OVF : constant Trigger_Source := 16#2F#;
TC1_MC0 : constant Trigger_Source := 16#30#;
TC1_MC1 : constant Trigger_Source := 16#31#;
TC2_OVF : constant Trigger_Source := 16#32#;
TC2_MC0 : constant Trigger_Source := 16#33#;
TC2_MC1 : constant Trigger_Source := 16#34#;
TC3_OVF : constant Trigger_Source := 16#35#;
TC3_MC0 : constant Trigger_Source := 16#36#;
TC3_MC1 : constant Trigger_Source := 16#37#;
TC4_OVF : constant Trigger_Source := 16#38#;
TC4_MC0 : constant Trigger_Source := 16#39#;
TC4_MC1 : constant Trigger_Source := 16#3A#;
TC5_OVF : constant Trigger_Source := 16#3B#;
TC5_MC0 : constant Trigger_Source := 16#3C#;
TC5_MC1 : constant Trigger_Source := 16#3D#;
TC6_OVF : constant Trigger_Source := 16#3E#;
TC6_MC0 : constant Trigger_Source := 16#3F#;
TC6_MC1 : constant Trigger_Source := 16#40#;
TC7_OVF : constant Trigger_Source := 16#41#;
TC7_MC0 : constant Trigger_Source := 16#42#;
TC7_MC1 : constant Trigger_Source := 16#43#;
ADC0_RESRDY : constant Trigger_Source := 16#44#;
ADC0_SEQ : constant Trigger_Source := 16#45#;
ADC1_RESRDY : constant Trigger_Source := 16#46#;
ADC1_SEQ : constant Trigger_Source := 16#47#;
DAC_EMPTY_0 : constant Trigger_Source := 16#48#;
DAC_EMPTY_1 : constant Trigger_Source := 16#49#;
DAC_RESRDY_0 : constant Trigger_Source := 16#4A#;
DAC_RESRDY_1 : constant Trigger_Source := 16#4B#;
I2S_RX_Ready_0 : constant Trigger_Source := 16#4C#;
I2S_RX_Ready_1 : constant Trigger_Source := 16#4D#;
I2S_TX_Ready_0 : constant Trigger_Source := 16#4E#;
I2S_TX_Ready_1 : constant Trigger_Source := 16#4F#;
PCC_RX : constant Trigger_Source := 16#50#;
AES_WR : constant Trigger_Source := 16#51#;
AES_RD : constant Trigger_Source := 16#52#;
QSPI_RX : constant Trigger_Source := 16#53#;
QSPI_TX : constant Trigger_Source := 16#54#;
end SAM.DMAC.Sources;
|
crt0.asm | aviallon/kalculator | 0 | 98075 | #include <kernel.inc>
.db "KEXC"
.db KEXC_ENTRY_POINT
.dw __start
.db KEXC_STACK_SIZE
.dw 20
.db KEXC_NAME
.dw __name
.db KEXC_HEADER_END
__name:
.db "hello_world", 0
__start:
call __relocate_data
call __initialize_globals
jp _main
_exit:
; Note: status code is discarded
pcall(exitThread)
__exit_end:
.function _exit, _exit, _exit_end
__relocate_data:
; + 4 because the KEXC header has two static pointers
; TODO: There's probably a better way of doing that
ld hl, __scas_relocatable_data + 4
.loop:
ld e, (hl) \ inc hl
ld d, (hl) \ inc hl
ld bc, 0
pcall(cpBCDE)
ret z
ex de, hl
kld(bc, 0)
add hl, bc
push de
ld e, (hl) \ inc hl
ld d, (hl)
ex de, hl \ add hl, bc \ ex de, hl
ld (hl), d \ dec hl
ld (hl), e
pop de
ex de, hl
jr .loop
__initialize_globals:
; Note: this could be more optimized if we could toggle auto-relocation in code
ld hl, __s_initialized_end
ld bc, __s_initialized
scf \ ccf
sbc hl, bc
ld b, h \ ld c, l
ld a, b
or c
ret z
ld hl, __s_initializer
ld de, __s_initialized
ldir
ret
; Assign some labels to the start of some sections
.area _INITIALIZER
__s_initializer:
.area _INITIALIZED
__s_initialized:
.area _INITIALIZED_END
__s_initialized_end:
|
OldBasicILP/Syntax/ClosedHilbert.agda | mietek/hilbert-gentzen | 29 | 4604 | <gh_stars>10-100
-- Hilbert-style formalisation of closed syntax.
-- Nested terms.
module OldBasicILP.Syntax.ClosedHilbert where
open import OldBasicILP.Syntax.Common public
-- Types parametrised by closed derivations.
mutual
infixr 10 _⦂_
infixl 9 _∧_
infixr 7 _▻_
data Ty : Set where
α_ : Atom → Ty
_▻_ : Ty → Ty → Ty
_⦂_ : ∀ {A} → Proof A → Ty → Ty
_∧_ : Ty → Ty → Ty
⊤ : Ty
-- Anti-bug wrappers.
record Proof (A : Ty) : Set where
inductive
constructor [_]
field
der : ⊢ A
-- Derivations.
infix 3 ⊢_
data ⊢_ : Ty → Set where
app : ∀ {A B} → ⊢ A ▻ B → ⊢ A → ⊢ B
ci : ∀ {A} → ⊢ A ▻ A
ck : ∀ {A B} → ⊢ A ▻ B ▻ A
cs : ∀ {A B C} → ⊢ (A ▻ B ▻ C) ▻ (A ▻ B) ▻ A ▻ C
box : ∀ {A} → (d : ⊢ A)
→ ⊢ [ d ] ⦂ A
cdist : ∀ {A B} → {d₁ : ⊢ A ▻ B} {d₂ : ⊢ A}
→ ⊢ [ d₁ ] ⦂ (A ▻ B) ▻ [ d₂ ] ⦂ A ▻ [ app d₁ d₂ ] ⦂ B
cup : ∀ {A} → {d : ⊢ A}
→ ⊢ [ d ] ⦂ A ▻ [ box d ] ⦂ [ d ] ⦂ A
cdown : ∀ {A} → {d : ⊢ A}
→ ⊢ [ d ] ⦂ A ▻ A
cpair : ∀ {A B} → ⊢ A ▻ B ▻ A ∧ B
cfst : ∀ {A B} → ⊢ A ∧ B ▻ A
csnd : ∀ {A B} → ⊢ A ∧ B ▻ B
unit : ⊢ ⊤
infix 3 ⊢⋆_
⊢⋆_ : Cx Ty → Set
⊢⋆ ∅ = 𝟙
⊢⋆ Ξ , A = ⊢⋆ Ξ × ⊢ A
-- Additional useful types.
infixr 7 _▻⋯▻_
_▻⋯▻_ : Cx Ty → Ty → Ty
∅ ▻⋯▻ B = B
(Ξ , A) ▻⋯▻ B = Ξ ▻⋯▻ (A ▻ B)
-- Cut and multicut.
cut : ∀ {A B} → ⊢ A → ⊢ A ▻ B → ⊢ B
cut d₁ d₂ = app d₂ d₁
multicut : ∀ {Ξ A} → ⊢⋆ Ξ → ⊢ Ξ ▻⋯▻ A → ⊢ A
multicut {∅} ∙ d₂ = d₂
multicut {Ξ , B} (ds , d₁) d₂ = app (multicut ds d₂) d₁
-- Contraction.
ccont : ∀ {A B} → ⊢ (A ▻ A ▻ B) ▻ A ▻ B
ccont = app (app cs cs) (app ck ci)
cont : ∀ {A B} → ⊢ A ▻ A ▻ B → ⊢ A ▻ B
cont d = app ccont d
-- Exchange, or Schönfinkel’s C combinator.
cexch : ∀ {A B C} → ⊢ (A ▻ B ▻ C) ▻ B ▻ A ▻ C
cexch = app (app cs (app (app cs (app ck cs))
(app (app cs (app ck ck)) cs)))
(app ck ck)
exch : ∀ {A B C} → ⊢ A ▻ B ▻ C → ⊢ B ▻ A ▻ C
exch d = app cexch d
-- Composition, or Schönfinkel’s B combinator.
ccomp : ∀ {A B C} → ⊢ (B ▻ C) ▻ (A ▻ B) ▻ A ▻ C
ccomp = app (app cs (app ck cs)) ck
comp : ∀ {A B C} → ⊢ B ▻ C → ⊢ A ▻ B → ⊢ A ▻ C
comp d₁ d₂ = app (app ccomp d₁) d₂
-- Useful theorems in functional form.
dist : ∀ {A B r₁ r₂} → ⊢ [ r₁ ] ⦂ (A ▻ B) → ⊢ [ r₂ ] ⦂ A → ⊢ [ app r₁ r₂ ] ⦂ B
dist d₁ d₂ = app (app cdist d₁) d₂
up : ∀ {A r} → ⊢ [ r ] ⦂ A → ⊢ [ box r ] ⦂ [ r ] ⦂ A
up d = app cup d
down : ∀ {A r} → ⊢ [ r ] ⦂ A → ⊢ A
down d = app cdown d
distup : ∀ {A B} → {r₀ : ⊢ A} {r₁ : ⊢ [ r₀ ] ⦂ A ▻ B}
→ ⊢ [ r₁ ] ⦂ ([ r₀ ] ⦂ A ▻ B) → ⊢ [ r₀ ] ⦂ A → ⊢ [ app r₁ (box r₀) ] ⦂ B
distup d₁ d₂ = dist d₁ (up d₂)
pair : ∀ {A B} → ⊢ A → ⊢ B → ⊢ A ∧ B
pair d₁ d₂ = app (app cpair d₁) d₂
fst : ∀ {A B} → ⊢ A ∧ B → ⊢ A
fst d = app cfst d
snd : ∀ {A B} → ⊢ A ∧ B → ⊢ B
snd d = app csnd d
|
prc4.asm | lestersantos/Assembly2019 | 0 | 20057 | ;UNIVERSIDAD DE <NAME>
;FACULTAD DE INGENIERIA
;ARQUITECTURA DE COMPUTADORAS Y ENSAMBLADORES 1
;PRACTICA 4
;<NAME>
;201504510
;My first program in assembly!!!
;====================================== MY MACROS =================================
%macro print 1 ;this macro will print to screen
mov dx, %1 ;refers to the first parameter to the macro call
mov ah, 09h ;09h function write string
int 21h ;call the interruption
%endmacro
%macro printChar 1 ;this macro will print to screen
mov dl, %1 ;refers to the first parameter to the macro call
mov ah, 06h ;09h function write string
int 21h ;call the interruption
%endmacro
%macro readInputChar 0
mov ah, 01h ;Return AL with the ASCII of the read char
int 21h ;call the interruption
%endmacro
%macro readString 0
mov si, 0 ;initialize counter in 0
%%while:
mov ah, 01h
int 21h
cmp al, 0dh ; al = CR(carriage return)
je %%skip
cmp al, 45h ; al = letter E
je %%letterE
cmp al, 53h ; al = letter S
je %%letterS ;jump to state S either for SAVE or SHOW
jmp %%endReading ;end macro readString
%%letterE:
mov [option + si],al ;save letter E in option[0]
inc si ;increase counter to 1
mov ah, 01h
int 21h
cmp al, 58H ;al = letter X
je %%letterX
jmp %%endReading
%%letterX:
mov [option + si],al ;save letter X in option[1]
inc si ;increase counter to 2
mov ah, 01h
int 21h
cmp al, 49h ;al = letter I
je %%letterI
jmp %%endReading
%%letterI:
mov [option + si],al ;save letter I in option[2]
inc si ;increase counter to 3
mov ah, 01h
int 21h
cmp al, 54h ;al = letter T
je %%letterT
jmp %%endReading
%%letterT: ;last state for option EXIT
mov [option + si],al ;save letter T in option[3]
print newline
print optionMsg
print option
mov ah,'0' ;the option to run is optionRun = (EXIT,0)
mov [optionRun],ah
jmp %%endReading ;end macro readingString
%%letterS:
mov [option + si],al ;save letter S in option[0]
inc si ;increase counter to 1
mov ah, 01h ;request reading character
int 21h ;call interruption
cmp al, 41H ;if al = letter A
je %%letterA ;jump to state letter A
cmp al, 48h ;if al = letter H
je %%letterH ;then jump to state H for SHOW
jmp %%endReading ;Error no input match end macro
%%letterA:
mov [option + si],al ;save letter A in option[1]
inc si ;increase counter to 2
mov ah, 01h
int 21h
cmp al, 56h ;if al = letter V
je %%letterV
jmp %%endReading
%%letterV:
mov [option + si],al ;save letter V in option[2]
inc si ;increase counter to 3
mov ah, 01h
int 21h
cmp al, 45h ;if al = letter E
je %%letterE2
jmp %%endReading
%%letterE2: ;las state for option SAVE
mov [option + si],al ;save letter E in option[3]
print newline
print optionMsg
print option
mov ah , '1' ;the option to run is optionRun = (SAVE,1)
mov [optionRun],ah
jmp %%endReading ;end macro readingString
%%letterH:
mov [option + si],al ;save letter H in option[1]
inc si ;increase counter to 2
mov ah, 01h
int 21h
cmp al, 4fh ;if al = letter O
je %%letterO
jmp %%endReading
%%letterO:
mov [option + si],al ;save letter O in option[2]
inc si ;increase counter to 3
mov ah, 01h
int 21h
cmp al, 57h ;if al = letter W
je %%letterW
jmp %%endReading
%%letterW: ;last state for option SHOW
mov [option + si],al ;save letter W in option[3]
print newline
print optionMsg
print option
mov ah,'2' ;the option to run is optionRun = (SHOW,2)
mov [optionRun],ah
jmp %%endReading ;end macro readingString
%%skip:
cmp si,3
jne %%while
%%endReading:
%endmacro;----------END MACRO READING STRING
%macro PrintBoard 0
mov si,0
mov di,0
xor cl,cl
xor ch,ch
;SCROLL SCREEN UP
mov ah, 06h ;request scroll up
mov al, 00h ;number of lines to scroll up
mov bh, 07h ;black background
mov cx,0000h ;starting row:column
mov dx, 194Fh;ending row:column
int 10h
;SET CURSOR POSITION
mov ah,02h ;request set cursor position
mov bh,00h ;number of page
mov dh,02h ;row/y = 0
mov dl,0h ;column/x = 0
int 10h ;call interruption
print boardUpperLine
mov al,[columnLabel] ;copy the data from columnLabel to AL register
mov al,'8' ;decrease in 1 the column labels-> columnLabel = columnLabel - 1
mov [columnLabel],al ;copy the data from AL register to columnLabel
%%for1:
printChar [columnLabel] ;print the rows labels columnLabel = 8
;print newline ;print a new line for each row label
mov al,[columnLabel] ;copy the data from columnLabel to AL register
dec al ;decrease in 1 the column labels-> columnLabel = columnLabel - 1
mov [columnLabel],al ;copy the data from AL register to columnLabel
mov ax, si
mov bl, 2
div bl
;add ax,'0'
;add ah,'0'
mov [remainder],ah
mov [quotient],al
inc si
;inc cl
push ax
print remainder
pop ax
mov cl,0
test ah, 1h
je %%forEven
mov ch,0
jmp %%forOdd
;test ah,1h
;je %%forOdd
;print quotient
;print evenSplitLine
%%escape:
cmp si,8
jne %%for1
jmp %%end
%%forEven:
print emptyBox
print boxSpliteLine
print whitePawn ;this way of paint is just for demostration
inc cl ;here we need to do an if statement for check
cmp cl,4 ;which pawn or queen is in the current box then paint it
jne %%forEven
print boxSpliteLine
print newline
print evenSplitLine
jmp %%escape
%%forOdd:
print oddSplitLine
jmp %%escape
%%end:
print newline
print boardUpperLine
%endmacro
%macro GameStart 0
;call clean
;SCROLL SCREEN UP
mov ah, 06h
mov al, 01h
mov bh, 07h
mov cx,0000h
mov dx, 194Fh
int 10h
;SCROLL SCREEN DOWN
;mov ah,07h
;mov al,08h
;mov bh, 07h
;mov cx,0000h
;mov dx,194fh
;int 10h
;SET CURSOR POSITION
;mov ah,02h
;mov bh,00h
;mov dh,00h
;mov dl,0h
;int 10h
print gameStart
xor cl,cl
mov cl,0h
print blankSpace
print blankSpace
print boardUpperLine
print newline
print boardImage
print blankSpace
print blankSpace
xor cl,cl
mov cl,0h
print boardUpperLine
print newline
%endmacro
; ·························
;8 | |FB| |FB| |FB| |FB|
; -- == -- ━━ -- ━━ -- ━━
;7 |FB| |FB| |FB| |FB| |
; ━━ -- ━━ -- ━━ -- ━━ --
;6 | |FB| |FB| |FB| |FB|
; -- ━━ -- ━━ -- ━━ -- ━━
;5 | | | | | | | | |
; ━━ -- ━━ -- ━━ -- ━━ --
;4 | | | | | | | | |
; -- ━━ -- ━━ -- ━━ -- ━━
;3 |FN| |FN| |FN| |FN| |
; ━━ -- ━━ -- ━━ -- ━━ --
;2 | |FN| |FN| |FN| |FN|
; -- ━━ -- ━━ -- ━━ -- ━━
;1 |FN| |FN| |FN| |FN| |
; ━━ -- ━━ -- ━━ -- ━━ --
; A B C D E F G H
; ·························
;************************************** END MY MACROS *****************************
global Main
;========================== SECTION .DATA ====================
segment .data
opcion db 10,0ah,0dh,'$'
helloWorld db 0ah,0dh,'Hola mundo','$'
esUno db 0ah,0dh,'es uno',10,'$'
esDos db 0ah,0dh,'es dos',10,'$'
esTres db 0ah,0dh,'es tres',10,'$'
gameStart db 10,13,'Juego Iniciado',10,13,'$'
quotient db '0','$'
option db 'endd','$' ;an array to save the string SHOW,SAVE,SHOW
optionRun db '0','$' ;option to run SHOW,0. SAVE,1. SHOW,2
remainder db '0','$'
headerString db 13,13,10
db 'UNIVERSIDAD DE SAN CARLOS DE GUATEMALA',13,10
db 'FACULTAD DE INGENIERIA ',13,10
db 'CIENCIAS Y SISTEMAS',13,10
db 'ARQUITECTURA DE COMPUTADORAS Y ENSAMBLADORES 1',13,10
db 'NOMBRE: LESTER EFRAIN AJUCUM SANTOS',13,10
db 'CARNET: 201504510',13,10
db 'SECCION: A',13,10,'$'
mainMenu db '', 13, 10
db ' _________________________', 13, 10
db '|_________ MENU __________|', 13, 10
db '| 1. Iniciar Juego |', 13, 10
db '| 2. Cargar Juego |', 13, 10
db '| 3. Salir. |', 13, 10
db '|_________________________|',13,10,'$' ;Menu para interactuar con el programa
boardUpperLine db 32,32,250,250,250,250,250,250,250,250,250,250,250,250,250,250,250,
db 250,250,250,250,250,250,250,250,250,250,13,10,'$' ;symbol interpunct or space dot
boardImage db '8 | |FB| |FB| |FB| |FB| ',10
db ' -- == -- == -- == -- == ',10
db '7 |FB| |FB| |FB| |FB| | ',10
db ' == -- == -- == -- == -- ',10
db '6 | |FB| |FB| |FB| |FB| ',10
db ' -- == -- == -- == -- == ',10
db '5 | | | | | | | | | ',10
db ' == -- == -- == -- == -- ',10
db '4 | | | | | | | | | ',10
db ' -- == -- == -- == -- == ',10
db '3 |FN| |FN| |FN| |FN| | ',10
db ' == -- == -- == -- == -- ',10
db '2 | |FN| |FN| |FN| |FN| ',10
db ' -- == -- == -- == -- == ',10
db '1 |FN| |FN| |FN| |FN| | ',10
db ' == -- == -- == -- == -- ',10
db ' A B C D E F G H ',10,'$'
optionMsg db 'The Option Is: ','$'
<<<<<<< HEAD
columnLabel db '8','$'
emptyBox db '| ','$'
whitePawn db 'FB','$'
blackPawn db 'FN','$'
boxSpliteLine db '|','$'
evenSplitLine db ' -- == -- == -- == -- == ',10,'$'
oddSplitLine db ' == -- == -- == -- == -- ',10,'$'
boardBtLabel db ' A B C D E F G H ',10,'$'
=======
>>>>>>> 9fbe3e3f9bb71f90efab2e3caf96bbcc297f8384
newline db 13,10,'$'
blankSpace db 20h,'$'
var db 3,'$'
tVar db 'var: ','$'
var2 db 4,'$'
tVar2 db 'var2: ','$'
var3 db 0,'$'
tVar3 db 'var3: ','$'
justvar db 13,10,'A SYMBOL: ',0,1,2,3,4,5,6,7,8,9,11,12,14,15,16,13,10,'$'
;empty space 0
;white pawn 1
;black pawn 2
;white queen 3
;black queen 4
;0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
board db 1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,2,2,2,2,2,2,2,2,2,2,2,2 ;an array of 32 positions
;************************** END SECTION DATA***********************************
;========================== SECTION .BSS =================================================|
;uninitialized-data sections |
segment .bss
;************************** END SECTION BSS **********************************************
;========================== SECTION .TEXT ======================================================|
;MY CODE GOES HERE. If I left a blank line
;between this line and "segment .text" gives error |
segment .text
ORG 100h
Main: ;non local label
;call clean
print headerString
print mainMenu
Menu:
readInputChar
cmp al, 49
je Opcion1
cmp al, 50
je Opcion2
cmp al, 51
je Opcion3
Opcion1:
print esUno
;print gameStart
;GameStart
print newline
;readString
;print newline
;print option
;print blankSpace
;print optionRun
PrintBoard
readInputChar
Opcion2:
print esDos
jmp Main
Opcion3:
print esTres
jmp exit
prueba:
print boardImage
jmp Main
Reset:
mov ah, 02h ;Colocar el cursor (02h salida de caracter)
mov dx, 0000h ;Colocar en dx las coordenadas
int 10h ;interrupcion 10h
mov ax, 0600h ;limpiar pantalla ;ah 06(es un recorrido), al 00(pantalla completa)
mov bh, 07h ;atributos fondo negro y fuente blanco
mov cx, 0000h ;movemos a cx las nuevas coordenadas columna 0 y fila 0 ;es la esquina superior izquierda reglon: columna
mov dx, 194fh ;movemos a dx las coordenadas finales fila 24 y columna 79
int 10h ;interrupcion 10h
jmp Main ;Volvemos a iniciar el programa
clean:
mov ax,0600h
mov bh, 07h
mov cx,0000h
mov dx,194Fh
int 10h
mov ah,02h
mov bh,00h
mov dx,00h
int 10h
ret
exit:
mov ah, 4ch
int 21h
;************************* END SECTION TEXT ******************************************************** |
programs/oeis/176/A176625.asm | neoneye/loda | 22 | 7315 | ; A176625: T(n,k) = 1 + 3*k*(k - n), triangle read by rows (n >= 0, 0 <= k <= n).
; 1,1,1,1,-2,1,1,-5,-5,1,1,-8,-11,-8,1,1,-11,-17,-17,-11,1,1,-14,-23,-26,-23,-14,1,1,-17,-29,-35,-35,-29,-17,1,1,-20,-35,-44,-47,-44,-35,-20,1,1,-23,-41,-53,-59,-59,-53,-41,-23,1,1,-26,-47,-62,-71,-74,-71,-62,-47
seq $0,176270 ; Triangle T(n,m) = 1 + m*(m-n) read by rows, 0 <= m <= n.
mul $0,3
sub $0,2
|
src/gl/implementation/gl-load_function_pointers.ads | Roldak/OpenGLAda | 79 | 25085 | -- part of OpenGLAda, (c) 2017 <NAME>
-- released under the terms of the MIT license, see the file "COPYING"
procedure GL.Load_Function_Pointers;
pragma Preelaborate (GL.Load_Function_Pointers);
|
programs/oeis/133/A133477.asm | neoneye/loda | 22 | 18153 | ; A133477: Sum of cubefree divisors of n excluding 1.
; 0,2,3,6,5,11,7,6,12,17,11,27,13,23,23,6,17,38,19,41,31,35,23,27,30,41,12,55,29,71,31,6,47,53,47,90,37,59,55,41,41,95,43,83,77,71,47,27,56,92,71,97,53,38,71,55,79,89,59,167,61,95,103,6,83,143,67,125,95,143,71,90,73,113,123,139,95,167,79,41,12,125,83,223,107,131,119,83,89,233,111,167,127,143,119,27,97,170,155,216
lpb $0
mov $2,$0
seq $2,62378 ; n divided by largest cubefree factor of n.
div $0,$2
lpe
seq $0,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n).
sub $0,1
|
vmTranslator/src/main/resources/BasicTest.asm | maxdemaio/hack-computer | 3 | 85662 | // push constant 10
@10
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop local 0
@LCL
D=M
@0
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push constant 21
@21
D=A
@SP
A=M
M=D
@SP
M=M+1
// push constant 22
@22
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop argument 2
@ARG
D=M
@2
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// pop argument 1
@ARG
D=M
@1
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push constant 36
@36
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop this 6
@THIS
D=M
@6
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push constant 42
@42
D=A
@SP
A=M
M=D
@SP
M=M+1
// push constant 45
@45
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop that 5
@THAT
D=M
@5
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// pop that 2
@THAT
D=M
@2
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push constant 510
@510
D=A
@SP
A=M
M=D
@SP
M=M+1
// pop temp 6
@R5
D=M
@11
D=D+A
@R13
M=D
@SP
AM=M-1
D=M
@R13
A=M
M=D
// push local 0
@LCL
D=M
@0
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// push that 5
@THAT
D=M
@5
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// add
@SP
AM=M-1
D=M
A=A-1
M=M+D
// push argument 1
@ARG
D=M
@1
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// sub
@SP
AM=M-1
D=M
A=A-1
M=M-D
// push this 6
@THIS
D=M
@6
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// push this 6
@THIS
D=M
@6
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// add
@SP
AM=M-1
D=M
A=A-1
M=M+D
// sub
@SP
AM=M-1
D=M
A=A-1
M=M-D
// push temp 6
@R5
D=M
@11
A=D+A
D=M
@SP
A=M
M=D
@SP
M=M+1
// add
@SP
AM=M-1
D=M
A=A-1
M=M+D
|
Dotfiles/hammerspoon/assets/ask-before-quit.scpt | szymonkaliski/Dotfiles | 62 | 2187 | <reponame>szymonkaliski/Dotfiles
#!/usr/bin/env osascript
on run argv
set appName to item 1 of argv
tell application appName
activate
display dialog "There are multiple windows opened.\nAre you sure you want to quit?" with icon 1 buttons {"Cancel", "Quit"} default button "Quit"
set answer to button returned of result
if result = "quit" then
quit
else
activate
end if
end tell
end run
|
exit32.asm | scottmalkie/programming_from_the_ground_up | 0 | 18495 | section .data
section .text
global _start
_start:
mov eax, 0x1
mov ebx, 0x3c
int 0x80
|
programs/oeis/055/A055671.asm | karttu/loda | 1 | 243065 | <filename>programs/oeis/055/A055671.asm
; A055671: Number of prime Hurwitz quaternions of norm n.
; 0,0,24,96,0,144,0,192,0,0,0,288,0,336,0,0,0,432,0,480,0,0,0,576,0,0,0,0,0,720,0,768,0,0,0,0,0,912,0,0,0,1008,0,1056,0,0,0,1152,0,0,0,0,0,1296,0,0,0,0,0,1440,0,1488,0,0,0,0,0,1632,0,0,0,1728,0,1776,0,0,0,0,0,1920,0,0,0,2016,0,0,0,0,0,2160,0,0,0,0,0,0,0,2352,0,0,0,2448,0,2496,0,0,0,2592,0,2640,0,0,0,2736,0,0,0,0,0,0,0,0,0,0,0,0,0,3072,0,0,0,3168,0,0,0,0,0,3312,0,3360,0,0,0,0,0,0,0,0,0,3600,0,3648,0,0,0,0,0,3792,0,0,0,0,0,3936,0,0,0,4032,0,0,0,0,0,4176,0,0,0,0,0,4320,0,4368,0,0,0,0,0,0,0,0,0,4608,0,4656,0,0,0,4752,0,4800,0,0,0,0,0,0,0,0,0,0,0,5088,0,0,0,0,0,0,0,0,0,0,0,5376,0,0,0,5472,0,5520,0,0,0,5616,0,0,0,0,0,5760,0,5808,0,0,0,0,0,0,0,0
add $0,1
mov $3,4
bin $3,$0
sub $0,1
mov $1,$0
trn $0,1
mov $2,$3
cmp $2,0
add $3,$2
div $1,$3
add $1,1
cal $0,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
mul $1,$0
mul $1,24
|
Lab2/lab23Short.asm | siwasilp/Micro | 0 | 9500 | ;==== LAB23.ASM ====
ORG 8000H
C7SEG EQU 0E060H
START: MOV R0,#0
MAIN: MOV A,R0
INC R0
ACALL TAB01
MOV DPTR,#C7SEG
MOVX @DPTR,A
ACALL DELAY
CJNE R0,#10H,MAIN
SJMP START
TAB01: MOV DPTR,#DATA
MOVC A,@A+DPTR
RET
DELAY: MOV R5,#04
DELAY1: MOV R6,#200
DELAY2: MOV R7,#200
DELAY3: DJNZ R7,DELAY3
DJNZ R6,DELAY2
DJNZ R5,DELAY1
RET
DATA: DB 3FH,06H,5BH,4FH
DB 66H,06DH,7DH,07H
DB 7FH,6FH,77H,7CH
DB 39H,5EH,79H,71H
END |
SNesoid/sneslib_comp/i386/fxemu2b.asm | Pretz/SNesoid | 17 | 10419 | <filename>SNesoid/sneslib_comp/i386/fxemu2b.asm
;Copyright (C) 1997-2001 ZSNES Team ( <EMAIL> / _<EMAIL> )
;
;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 2 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, write to the Free Software
;Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%include "i386/macros.mac"
EXTSYM FxTable,FxTableb,FxTablec,SfxB,SfxCPB,SfxCROM,SfxCarry,SfxOverflow
EXTSYM SfxR0,SfxR14,SfxR15,SfxRomBuffer,SfxSignZero,withr15sk
NEWSYM FxEmu2BAsmStart
%include "i386/fxemu2.mac"
%include "i386/fxemu2b.mac"
NEWSYM FxOpb05 ; BRA branch always ; Verified.
movsx eax,byte[ebp]
mov cl,[ebp+1]
inc ebp
add ebp,eax
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb06 ; BGE branch on greater or equals ; Verified.
movsx eax,byte[ebp]
mov ebx,[SfxSignZero]
shr ebx,15
inc ebp
xor bl,[SfxOverflow]
mov cl,[ebp]
test bl,01h
jnz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb07 ; BLT branch on lesss than ; Verified.
movsx eax,byte[ebp]
mov ebx,[SfxSignZero]
shr ebx,15
inc ebp
xor bl,[SfxOverflow]
mov cl,[ebp]
test bl,01h
jz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb08 ; BNE branch on not equal ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],0FFFFh
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb09 ; BEQ branch on equal (z=1) ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],0FFFFh
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0A ; BPL branch on plus ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],088000h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0B ; BMI branch on minus ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],088000h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0C ; BCC branch on carry clear ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxCarry],01h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0D ; BCS branch on carry set ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxCarry],01h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0E ; BVC branch on overflow clear ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxOverflow],01h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb0F ; BVS branch on overflow set ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxOverflow],01h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTableb+ecx*4]
ret
.nojump
inc ebp
call [FxTableb+ecx*4]
ret
NEWSYM FxOpb10 ; TO RN set register n as destination register
TORNb 0
NEWSYM FxOpb11 ; TO RN set register n as destination register
TORNb 1
NEWSYM FxOpb12 ; TO RN set register n as destination register
TORNb 2
NEWSYM FxOpb13 ; TO RN set register n as destination register
TORNb 3
NEWSYM FxOpb14 ; TO RN set register n as destination register
TORNb 4
NEWSYM FxOpb15 ; TO RN set register n as destination register
TORNb 5
NEWSYM FxOpb16 ; TO RN set register n as destination register
TORNb 6
NEWSYM FxOpb17 ; TO RN set register n as destination register
TORNb 7
NEWSYM FxOpb18 ; TO RN set register n as destination register
TORNb 8
NEWSYM FxOpb19 ; TO RN set register n as destination register
TORNb 9
NEWSYM FxOpb1A ; TO RN set register n as destination register
TORNb 10
NEWSYM FxOpb1B ; TO RN set register n as destination register
TORNb 11
NEWSYM FxOpb1C ; TO RN set register n as destination register
TORNb 12
NEWSYM FxOpb1D ; TO RN set register n as destination register
TORNb 13
NEWSYM FxOpb1E ; TO RN set register n as destination register
FETCHPIPE
test dword [SfxB],1
jnz .VersionB
mov edi,SfxR0+14*4
inc ebp
mov eax,ebp
sub eax,[SfxCPB]
mov dword[withr15sk],1
mov [SfxR15],eax
call [FxTableb+ecx*4]
mov edi,SfxR0
UpdateR14
ret
.VersionB
mov eax,[esi] ; Read Source
mov dword[withr15sk],1
mov [SfxR0+14*4],eax ; Write
CLRFLAGS
UpdateR14
inc ebp ; Increase program counter
ret
NEWSYM FxOpb1F ; TO RN set register n as destination register
FETCHPIPE
test dword [SfxB],1
jnz .VersionB
mov edi,SfxR0+15*4
inc ebp
mov eax,ebp
sub eax,[SfxCPB]
mov [SfxR15],eax
call [FxTableb+ecx*4]
mov ebp,[SfxCPB]
mov dword[withr15sk],1
add ebp,[SfxR15]
mov edi,SfxR0
ret
.VersionB
mov eax,[esi] ; Read Source
mov ebp,[SfxCPB]
mov dword[withr15sk],1
add ebp,eax
CLRFLAGS
ret
NEWSYM FxOpb3D ; ALT1 set alt1 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,01h
inc ebp
mov eax,ebp
sub eax,[SfxCPB]
mov [SfxR15],eax
call [FxTableb+ecx*4]
xor ch,ch
ret
NEWSYM FxOpb3E ; ALT2 set alt1 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,02h
inc ebp
mov eax,ebp
sub eax,[SfxCPB]
mov [SfxR15],eax
call [FxTable+ecx*4]
xor ch,ch
ret
NEWSYM FxOpb3F ; ALT3 set alt3 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,03h
inc ebp
mov eax,ebp
sub eax,[SfxCPB]
mov [SfxR15],eax
call [FxTable+ecx*4]
xor ch,ch
ret
NEWSYM FxOpbB0 ; FROM rn set source register
FROMRNb 0
NEWSYM FxOpbB1 ; FROM rn set source register
FROMRNb 1
NEWSYM FxOpbB2 ; FROM rn set source register
FROMRNb 2
NEWSYM FxOpbB3 ; FROM rn set source register
FROMRNb 3
NEWSYM FxOpbB4 ; FROM rn set source register
FROMRNb 4
NEWSYM FxOpbB5 ; FROM rn set source register
FROMRNb 5
NEWSYM FxOpbB6 ; FROM rn set source register
FROMRNb 6
NEWSYM FxOpbB7 ; FROM rn set source register
FROMRNb 7
NEWSYM FxOpbB8 ; FROM rn set source register
FROMRNb 8
NEWSYM FxOpbB9 ; FROM rn set source register
FROMRNb 9
NEWSYM FxOpbBA ; FROM rn set source register
FROMRNb 10
NEWSYM FxOpbBB ; FROM rn set source register
FROMRNb 11
NEWSYM FxOpbBC ; FROM rn set source register
FROMRNb 12
NEWSYM FxOpbBD ; FROM rn set source register
FROMRNb 13
NEWSYM FxOpbBE ; FROM rn set source register
FROMRNb 14
NEWSYM FxOpbBF ; FROM rn set source register
test dword [SfxB],1
jnz .VersionB
mov esi,SfxR0+15*4
inc ebp ; Increase program counter
mov eax,ebp
sub eax,[SfxCPB]
mov [SfxR15],eax
call [FxTableb+ecx*4]
mov esi,SfxR0
ret
.VersionB
FETCHPIPE
mov eax,ebp
sub eax,[SfxCPB]
inc ebp
mov [edi],eax ; Write Destination
mov [SfxSignZero],eax
shr al,7
mov byte[SfxOverflow],al
CLRFLAGS
ret
NEWSYM FxOpc05 ; BRA branch always ; Verified.
movsx eax,byte[ebp]
mov cl,[ebp+1]
inc ebp
add ebp,eax
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc06 ; BGE branch on greater or equals ; Verified.
movsx eax,byte[ebp]
mov ebx,[SfxSignZero]
shr ebx,15
inc ebp
xor bl,[SfxOverflow]
mov cl,[ebp]
test bl,01h
jnz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc07 ; BLT branch on lesss than ; Verified.
movsx eax,byte[ebp]
mov ebx,[SfxSignZero]
shr ebx,15
inc ebp
xor bl,[SfxOverflow]
mov cl,[ebp]
test bl,01h
jz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc08 ; BNE branch on not equal ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],0FFFFh
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc09 ; BEQ branch on equal (z=1) ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],0FFFFh
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0A ; BPL branch on plus ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],088000h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0B ; BMI branch on minus ; Verified.
movsx eax,byte[ebp]
inc ebp
test dword[SfxSignZero],088000h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0C ; BCC branch on carry clear ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxCarry],01h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0D ; BCS branch on carry set ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxCarry],01h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0E ; BVC branch on overflow clear ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxOverflow],01h
mov cl,[ebp]
jnz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc0F ; BVS branch on overflow set ; Verified.
movsx eax,byte[ebp]
inc ebp
test byte[SfxOverflow],01h
mov cl,[ebp]
jz .nojump
add ebp,eax
call [FxTablec+ecx*4]
ret
.nojump
inc ebp
call [FxTablec+ecx*4]
ret
NEWSYM FxOpc10 ; TO RN set register n as destination register
TORNc 0
NEWSYM FxOpc11 ; TO RN set register n as destination register
TORNc 1
NEWSYM FxOpc12 ; TO RN set register n as destination register
TORNc 2
NEWSYM FxOpc13 ; TO RN set register n as destination register
TORNc 3
NEWSYM FxOpc14 ; TO RN set register n as destination register
TORNc 4
NEWSYM FxOpc15 ; TO RN set register n as destination register
TORNc 5
NEWSYM FxOpc16 ; TO RN set register n as destination register
TORNc 6
NEWSYM FxOpc17 ; TO RN set register n as destination register
TORNc 7
NEWSYM FxOpc18 ; TO RN set register n as destination register
TORNc 8
NEWSYM FxOpc19 ; TO RN set register n as destination register
TORNc 9
NEWSYM FxOpc1A ; TO RN set register n as destination register
TORNc 10
NEWSYM FxOpc1B ; TO RN set register n as destination register
TORNc 11
NEWSYM FxOpc1C ; TO RN set register n as destination register
TORNc 12
NEWSYM FxOpc1D ; TO RN set register n as destination register
TORNc 13
NEWSYM FxOpc1E ; TO RN set register n as destination register
FETCHPIPE
mov eax,[esi] ; Read Source
mov [SfxR0+14*4],eax ; Write
CLRFLAGS
UpdateR14
inc ebp ; Increase program counter
ret
NEWSYM FxOpc1F ; TO RN set register n as destination register
FETCHPIPE
mov eax,[esi] ; Read Source
mov ebp,[SfxCPB]
mov [SfxR15],eax
add ebp,eax
CLRFLAGS
ret
NEWSYM FxOpc3D ; ALT1 set alt1 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,01h
inc ebp
call [FxTablec+ecx*4]
xor ch,ch
ret
NEWSYM FxOpc3E ; ALT2 set alt1 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,02h
inc ebp
call [FxTablec+ecx*4]
xor ch,ch
ret
NEWSYM FxOpc3F ; ALT3 set alt3 mode ; Verified.
FETCHPIPE
mov dword [SfxB],0
or ch,03h
inc ebp
call [FxTablec+ecx*4]
xor ch,ch
ret
NEWSYM FxOpcB0 ; FROM rn set source register
FROMRNc 0
NEWSYM FxOpcB1 ; FROM rn set source register
FROMRNc 1
NEWSYM FxOpcB2 ; FROM rn set source register
FROMRNc 2
NEWSYM FxOpcB3 ; FROM rn set source register
FROMRNc 3
NEWSYM FxOpcB4 ; FROM rn set source register
FROMRNc 4
NEWSYM FxOpcB5 ; FROM rn set source register
FROMRNc 5
NEWSYM FxOpcB6 ; FROM rn set source register
FROMRNc 6
NEWSYM FxOpcB7 ; FROM rn set source register
FROMRNc 7
NEWSYM FxOpcB8 ; FROM rn set source register
FROMRNc 8
NEWSYM FxOpcB9 ; FROM rn set source register
FROMRNc 9
NEWSYM FxOpcBA ; FROM rn set source register
FROMRNc 10
NEWSYM FxOpcBB ; FROM rn set source register
FROMRNc 11
NEWSYM FxOpcBC ; FROM rn set source register
FROMRNc 12
NEWSYM FxOpcBD ; FROM rn set source register
FROMRNc 13
NEWSYM FxOpcBE ; FROM rn set source register
FROMRNc 14
NEWSYM FxOpcBF ; FROM rn set source register
FETCHPIPE
mov eax,ebp
sub eax,[SfxCPB]
inc ebp
mov [edi],eax ; Write Destination
mov [SfxSignZero],eax
shr al,7
mov byte[SfxOverflow],al
CLRFLAGS
ret
NEWSYM FxEmu2BAsmEnd
|
middleware/src/filesystem/partitions.ads | rocher/Ada_Drivers_Library | 192 | 28579 | ------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015-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 the copyright holder nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
with HAL; use HAL;
with HAL.Block_Drivers; use HAL.Block_Drivers;
package Partitions is
type Partition_Kind is new UInt8;
Empty_Partition : constant Partition_Kind := 16#00#;
Fat12_Parition : constant Partition_Kind := 16#01#;
Fat16_Parition : constant Partition_Kind := 16#04#;
Extended_Parition : constant Partition_Kind := 16#05#;
Fat16B_Parition : constant Partition_Kind := 16#06#;
NTFS_Partition : constant Partition_Kind := 16#07#;
Fat32_CHS_Parition : constant Partition_Kind := 16#0B#;
Fat32_LBA_Parition : constant Partition_Kind := 16#0C#;
Fat16B_LBA_Parition : constant Partition_Kind := 16#0E#;
Extended_LBA_Parition : constant Partition_Kind := 16#0F#;
Linux_Swap_Partition : constant Partition_Kind := 16#82#;
Linux_Partition : constant Partition_Kind := 16#83#;
subtype Logical_Block_Address is UInt32;
type CHS_Address is record
C : UInt10;
H : UInt8;
S : UInt6;
end record with Pack, Size => 24;
type Partition_Entry is record
Status : UInt8;
First_Sector_CHS : CHS_Address;
Kind : Partition_Kind;
Last_Sector_CHS : CHS_Address;
First_Sector_LBA : Logical_Block_Address;
Number_Of_Sectors : UInt32;
end record with Pack, Size => 16 * 8;
type Status_Code is (Status_Ok, Disk_Error, Invalid_Parition);
function Get_Partition_Entry (Disk : not null Any_Block_Driver;
Entry_Number : Positive;
P_Entry : out Partition_Entry)
return Status_Code;
function Number_Of_Partitions (Disk : Any_Block_Driver) return Natural;
function Is_Valid (P_Entry : Partition_Entry) return Boolean is
(P_Entry.Status = 16#00# or else P_Entry.Status = 16#80#);
end Partitions;
|
oeis/014/A014905.asm | neoneye/loda-programs | 11 | 13877 | ; A014905: a(1)=1, a(n) = 21*a(n-1) + n.
; 1,23,486,10210,214415,4502721,94557148,1985700116,41699702445,875693751355,18389568778466,386180944347798,8109799831303771,170305796457379205,3576421725604963320,75104856237704229736,1577201980991788824473,33121241600827565313951,695546073617378871592990,14606467545964956303452810,306735818465264082372509031,6441452187770545729822689673,135270495943181460326276483156,2840680414806810666851806146300,59654288710943024003887929072325,1252740062929803504081646510518851
add $0,1
lpb $0
sub $0,1
add $2,1
mul $2,21
add $1,$2
lpe
div $1,21
mov $0,$1
|
test_data/ligador_carregador/teste_A.asm | Perruci/sb20172 | 0 | 179906 | <reponame>Perruci/sb20172
mod_a: begin
section text
y: extern
mod_b: extern
public mod_a
public x
input x
input y
jmp mod_b
section data
x: space
end
|
data/pokemon/base_stats/vileplume.asm | opiter09/ASM-Machina | 1 | 19024 | db DEX_VILEPLUME ; pokedex id
db 75, 80, 85, 50, 100
; hp atk def spd spc
db GRASS, POISON ; type
db 45 ; catch rate
db 184 ; base exp
INCBIN "gfx/pokemon/front/vileplume.pic", 0, 1 ; sprite dimensions
dw VileplumePicFront, VileplumePicBack
db LEECH_SEED, TOXIC, SLEEP_POWDER, PETAL_DANCE ; level 1 learnset
db GROWTH_MEDIUM_SLOW ; growth rate
; tm/hm learnset
tmhm SWORDS_DANCE, TOXIC, BODY_SLAM, TAKE_DOWN, DOUBLE_EDGE, \
HYPER_BEAM, RAGE, MEGA_DRAIN, SOLARBEAM, MIMIC, \
DOUBLE_TEAM, REFLECT, BIDE, REST, SUBSTITUTE, \
CUT, NIGHT_SHADE
; end
db 0 ; padding
|
oeis/144/A144656.asm | neoneye/loda-programs | 11 | 29284 | ; A144656: a(n) = (n mod 2) if n <= 3, otherwise a(n) = (n^2-5n+7)*(n-2)*a(n-1)/(n-3) + (n^2-5n+7)*a(n-2) - (n-2)*a(n-3)/(n-3).
; Submitted by <NAME>(s1)
; 0,1,0,1,4,49,900,24649,944784,48455521,3210355600,267186643801,27307626948900,3363915436531441,491705171699154084,84158959760104032049,16675767262618669710400,3787671541267275818341249,977702867682508392324162624,284628954669920840314598014801
mov $2,1
lpb $0
sub $0,1
mov $3,$2
mov $2,$1
mul $1,$0
add $1,$3
lpe
mul $1,$3
mov $0,$1
|
test/Succeed/optionsPragma.agda | shlevy/agda | 1,989 | 9074 | <filename>test/Succeed/optionsPragma.agda
{-# OPTIONS --no-termination-check #-}
module optionsPragma where
-- Only goes through with the termination checker turned off.
Foo : Set
Foo = Foo
|
boot/pm/print.asm | vincent-uden/Potatis-MOS | 3 | 166190 | <reponame>vincent-uden/Potatis-MOS
[bits 32]
; Constant meomry addresses
VIDEO_MEMORY equ 0xb8000
WHITE_ON_BLACK equ 0x0f
print_string_pm: ; print_string_pms wathever the bx register points to
pusha
mov edx, VIDEO_MEMORY ; Set EDX to start of video memory
print_string_pm_loop:
mov al, [ebx]
mov ah, WHITE_ON_BLACK
cmp al, 0x00
je print_string_pm_end
mov [edx], ax
add ebx, 1
add edx, 2
jmp print_string_pm_loop
print_string_pm_end:
popa
ret
|
programs/oeis/158/A158668.asm | neoneye/loda | 22 | 10020 | ; A158668: a(n) = 58*n^2 - 1.
; 57,231,521,927,1449,2087,2841,3711,4697,5799,7017,8351,9801,11367,13049,14847,16761,18791,20937,23199,25577,28071,30681,33407,36249,39207,42281,45471,48777,52199,55737,59391,63161,67047,71049,75167,79401,83751,88217,92799,97497,102311,107241,112287,117449,122727,128121,133631,139257,144999,150857,156831,162921,169127,175449,181887,188441,195111,201897,208799,215817,222951,230201,237567,245049,252647,260361,268191,276137,284199,292377,300671,309081,317607,326249,335007,343881,352871,361977,371199,380537,389991,399561,409247,419049,428967,439001,449151,459417,469799,480297,490911,501641,512487,523449,534527,545721,557031,568457,579999
mov $1,2
add $1,$0
mul $1,$0
mul $1,58
add $1,57
mov $0,$1
|
src/registre.ads | GauBen/Arbre-Genealogique | 1 | 30269 | generic
Modulo : Integer;
type T_Element is private;
-- Un registre est une table de hachage.
package Registre is
type T_Registre is limited private;
Cle_Absente_Exception : exception;
-- Renvoie vrai si le registre est entièrement vide.
function Est_Vide (Registre : T_Registre) return Boolean;
-- Initialiser un registre vide.
procedure Initialiser (Registre : out T_Registre) with
Post => Est_Vide (Registre);
-- Renvoie vrai si la clé est presente dans le registre.
function Existe (Registre : T_Registre; Cle : Integer) return Boolean;
-- Insère ou modifie un élément dans le registre.
procedure Attribuer
(Registre : in out T_Registre; Cle : in Integer; Element : in T_Element);
-- Renvoie un élément du registre.
-- Lance Cle_Absente_Exception si la clé n'est pas trouvee.
function Acceder (Registre : T_Registre; Cle : Integer) return T_Element;
-- Applique une procédure P sur tous les éléments du registre.
generic
with procedure P (Cle : in Integer; Element : in T_Element);
procedure Appliquer_Sur_Tous (Registre : in T_Registre);
-- Supprime un élément du registre.
procedure Supprimer (Registre : in out T_Registre; Cle : in Integer);
-- Supprime tous les éléments du registre.
procedure Detruire (Registre : in out T_Registre) with
Post => Est_Vide (Registre);
private
-- On choisit de representer un registre par un tableau de pointeurs.
-- Une case de ce tableau contient une chaîne de tous les elements dont
-- la valeur de la clé par la fonction de hachage est la même.
type T_Maillon;
type T_Pointeur_Sur_Maillon is access T_Maillon;
type T_Maillon is record
Cle : Integer;
Element : T_Element;
Suivant : T_Pointeur_Sur_Maillon;
end record;
type T_Registre is array (1 .. Modulo) of T_Pointeur_Sur_Maillon;
end Registre;
|
Definition/Conversion/Reduction.agda | Vtec234/logrel-mltt | 0 | 11763 | {-# OPTIONS --without-K --safe #-}
module Definition.Conversion.Reduction where
open import Definition.Untyped
open import Definition.Typed
open import Definition.Typed.Properties
open import Definition.Typed.RedSteps
open import Definition.Conversion
-- Weak head expansion of algorithmic equality of types.
reductionConv↑ : ∀ {A A′ B B′ Γ}
→ Γ ⊢ A ⇒* A′
→ Γ ⊢ B ⇒* B′
→ Γ ⊢ A′ [conv↑] B′
→ Γ ⊢ A [conv↑] B
reductionConv↑ A⇒* B⇒* ([↑] A″ B″ D D′ whnfA″ whnfB″ A″<>B″) =
[↑] A″ B″ (A⇒* ⇨* D) (B⇒* ⇨* D′) whnfA″ whnfB″ A″<>B″
-- Weak head expansion of algorithmic equality of terms.
reductionConv↑Term : ∀ {t t′ u u′ A B Γ}
→ Γ ⊢ A ⇒* B
→ Γ ⊢ t ⇒* t′ ∷ B
→ Γ ⊢ u ⇒* u′ ∷ B
→ Γ ⊢ t′ [conv↑] u′ ∷ B
→ Γ ⊢ t [conv↑] u ∷ A
reductionConv↑Term A⇒* t⇒* u⇒* ([↑]ₜ B′ t″ u″ D d d′ whnfB′ whnft″ whnfu″ t″<>u″) =
[↑]ₜ B′ t″ u″
(A⇒* ⇨* D)
((conv* t⇒* (subset* D)) ⇨∷* d)
((conv* u⇒* (subset* D)) ⇨∷* d′)
whnfB′ whnft″ whnfu″ t″<>u″
|
ls.asm | dnaef/cs153 | 0 | 96201 | <filename>ls.asm
_ls: file format elf32-i386
Disassembly of section .text:
00000000 <fmtname>:
#include "user.h"
#include "fs.h"
char*
fmtname(char *path)
{
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 56 push %esi
4: 53 push %ebx
5: 83 ec 10 sub $0x10,%esp
8: 8b 5d 08 mov 0x8(%ebp),%ebx
static char buf[DIRSIZ+1];
char *p;
// Find first character after last slash.
for(p=path+strlen(path); p >= path && *p != '/'; p--)
b: 89 1c 24 mov %ebx,(%esp)
e: e8 dd 03 00 00 call 3f0 <strlen>
13: 01 d8 add %ebx,%eax
15: 73 10 jae 27 <fmtname+0x27>
17: eb 13 jmp 2c <fmtname+0x2c>
19: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
20: 83 e8 01 sub $0x1,%eax
23: 39 c3 cmp %eax,%ebx
25: 77 05 ja 2c <fmtname+0x2c>
27: 80 38 2f cmpb $0x2f,(%eax)
2a: 75 f4 jne 20 <fmtname+0x20>
;
p++;
2c: 8d 58 01 lea 0x1(%eax),%ebx
// Return blank-padded name.
if(strlen(p) >= DIRSIZ)
2f: 89 1c 24 mov %ebx,(%esp)
32: e8 b9 03 00 00 call 3f0 <strlen>
37: 83 f8 0d cmp $0xd,%eax
3a: 77 53 ja 8f <fmtname+0x8f>
return p;
memmove(buf, p, strlen(p));
3c: 89 1c 24 mov %ebx,(%esp)
3f: e8 ac 03 00 00 call 3f0 <strlen>
44: 89 5c 24 04 mov %ebx,0x4(%esp)
48: c7 04 24 98 0a 00 00 movl $0xa98,(%esp)
4f: 89 44 24 08 mov %eax,0x8(%esp)
53: e8 58 04 00 00 call 4b0 <memmove>
memset(buf+strlen(p), ' ', DIRSIZ-strlen(p));
58: 89 1c 24 mov %ebx,(%esp)
5b: e8 90 03 00 00 call 3f0 <strlen>
60: 89 1c 24 mov %ebx,(%esp)
63: bb 98 0a 00 00 mov $0xa98,%ebx
68: 89 c6 mov %eax,%esi
6a: e8 81 03 00 00 call 3f0 <strlen>
6f: ba 0e 00 00 00 mov $0xe,%edx
74: 29 f2 sub %esi,%edx
76: 89 54 24 08 mov %edx,0x8(%esp)
7a: c7 44 24 04 20 00 00 movl $0x20,0x4(%esp)
81: 00
82: 05 98 0a 00 00 add $0xa98,%eax
87: 89 04 24 mov %eax,(%esp)
8a: e8 81 03 00 00 call 410 <memset>
return buf;
}
8f: 83 c4 10 add $0x10,%esp
92: 89 d8 mov %ebx,%eax
94: 5b pop %ebx
95: 5e pop %esi
96: 5d pop %ebp
97: c3 ret
98: 90 nop
99: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
000000a0 <ls>:
void
ls(char *path)
{
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 57 push %edi
a4: 56 push %esi
a5: 53 push %ebx
a6: 81 ec 6c 02 00 00 sub $0x26c,%esp
ac: 8b 7d 08 mov 0x8(%ebp),%edi
char buf[512], *p;
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
af: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
b6: 00
b7: 89 3c 24 mov %edi,(%esp)
ba: e8 19 05 00 00 call 5d8 <open>
bf: 85 c0 test %eax,%eax
c1: 89 c3 mov %eax,%ebx
c3: 0f 88 c7 01 00 00 js 290 <ls+0x1f0>
printf(2, "ls: cannot open %s\n", path);
return;
}
if(fstat(fd, &st) < 0){
c9: 8d 75 c4 lea -0x3c(%ebp),%esi
cc: 89 74 24 04 mov %esi,0x4(%esp)
d0: 89 04 24 mov %eax,(%esp)
d3: e8 18 05 00 00 call 5f0 <fstat>
d8: 85 c0 test %eax,%eax
da: 0f 88 00 02 00 00 js 2e0 <ls+0x240>
printf(2, "ls: cannot stat %s\n", path);
close(fd);
return;
}
switch(st.type){
e0: 0f b7 45 c4 movzwl -0x3c(%ebp),%eax
e4: 66 83 f8 01 cmp $0x1,%ax
e8: 74 66 je 150 <ls+0xb0>
ea: 66 83 f8 02 cmp $0x2,%ax
ee: 74 18 je 108 <ls+0x68>
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
}
break;
}
close(fd);
f0: 89 1c 24 mov %ebx,(%esp)
f3: e8 c8 04 00 00 call 5c0 <close>
}
f8: 81 c4 6c 02 00 00 add $0x26c,%esp
fe: 5b pop %ebx
ff: 5e pop %esi
100: 5f pop %edi
101: 5d pop %ebp
102: c3 ret
103: 90 nop
104: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
return;
}
switch(st.type){
case T_FILE:
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
108: 8b 55 d4 mov -0x2c(%ebp),%edx
10b: 8b 75 cc mov -0x34(%ebp),%esi
10e: 89 3c 24 mov %edi,(%esp)
111: 89 95 ac fd ff ff mov %edx,-0x254(%ebp)
117: e8 e4 fe ff ff call 0 <fmtname>
11c: 8b 95 ac fd ff ff mov -0x254(%ebp),%edx
122: 89 74 24 10 mov %esi,0x10(%esp)
126: c7 44 24 0c 02 00 00 movl $0x2,0xc(%esp)
12d: 00
12e: c7 44 24 04 5e 0a 00 movl $0xa5e,0x4(%esp)
135: 00
136: 89 54 24 14 mov %edx,0x14(%esp)
13a: c7 04 24 01 00 00 00 movl $0x1,(%esp)
141: 89 44 24 08 mov %eax,0x8(%esp)
145: e8 86 05 00 00 call 6d0 <printf>
break;
14a: eb a4 jmp f0 <ls+0x50>
14c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
case T_DIR:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
150: 89 3c 24 mov %edi,(%esp)
153: e8 98 02 00 00 call 3f0 <strlen>
158: 83 c0 10 add $0x10,%eax
15b: 3d 00 02 00 00 cmp $0x200,%eax
160: 0f 87 0a 01 00 00 ja 270 <ls+0x1d0>
printf(1, "ls: path too long\n");
break;
}
strcpy(buf, path);
166: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
16c: 89 7c 24 04 mov %edi,0x4(%esp)
170: 8d 7d d8 lea -0x28(%ebp),%edi
173: 89 04 24 mov %eax,(%esp)
176: e8 f5 01 00 00 call 370 <strcpy>
p = buf+strlen(buf);
17b: 8d 95 c4 fd ff ff lea -0x23c(%ebp),%edx
181: 89 14 24 mov %edx,(%esp)
184: e8 67 02 00 00 call 3f0 <strlen>
189: 8d 95 c4 fd ff ff lea -0x23c(%ebp),%edx
18f: 8d 04 02 lea (%edx,%eax,1),%eax
*p++ = '/';
192: c6 00 2f movb $0x2f,(%eax)
195: 83 c0 01 add $0x1,%eax
198: 89 85 b4 fd ff ff mov %eax,-0x24c(%ebp)
19e: 66 90 xchg %ax,%ax
while(read(fd, &de, sizeof(de)) == sizeof(de)){
1a0: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
1a7: 00
1a8: 89 7c 24 04 mov %edi,0x4(%esp)
1ac: 89 1c 24 mov %ebx,(%esp)
1af: e8 fc 03 00 00 call 5b0 <read>
1b4: 83 f8 10 cmp $0x10,%eax
1b7: 0f 85 33 ff ff ff jne f0 <ls+0x50>
if(de.inum == 0)
1bd: 66 83 7d d8 00 cmpw $0x0,-0x28(%ebp)
1c2: 74 dc je 1a0 <ls+0x100>
continue;
memmove(p, de.name, DIRSIZ);
1c4: 8b 95 b4 fd ff ff mov -0x24c(%ebp),%edx
1ca: 8d 45 da lea -0x26(%ebp),%eax
1cd: c7 44 24 08 0e 00 00 movl $0xe,0x8(%esp)
1d4: 00
1d5: 89 44 24 04 mov %eax,0x4(%esp)
1d9: 89 14 24 mov %edx,(%esp)
1dc: e8 cf 02 00 00 call 4b0 <memmove>
p[DIRSIZ] = 0;
1e1: 8b 85 b4 fd ff ff mov -0x24c(%ebp),%eax
if(stat(buf, &st) < 0){
1e7: 8d 95 c4 fd ff ff lea -0x23c(%ebp),%edx
*p++ = '/';
while(read(fd, &de, sizeof(de)) == sizeof(de)){
if(de.inum == 0)
continue;
memmove(p, de.name, DIRSIZ);
p[DIRSIZ] = 0;
1ed: c6 40 0e 00 movb $0x0,0xe(%eax)
if(stat(buf, &st) < 0){
1f1: 89 74 24 04 mov %esi,0x4(%esp)
1f5: 89 14 24 mov %edx,(%esp)
1f8: e8 e3 02 00 00 call 4e0 <stat>
1fd: 85 c0 test %eax,%eax
1ff: 0f 88 b3 00 00 00 js 2b8 <ls+0x218>
printf(1, "ls: cannot stat %s\n", buf);
continue;
}
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
205: 0f bf 45 c4 movswl -0x3c(%ebp),%eax
209: 8b 55 d4 mov -0x2c(%ebp),%edx
20c: 8b 4d cc mov -0x34(%ebp),%ecx
20f: 89 85 b0 fd ff ff mov %eax,-0x250(%ebp)
215: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
21b: 89 95 ac fd ff ff mov %edx,-0x254(%ebp)
221: 89 8d a8 fd ff ff mov %ecx,-0x258(%ebp)
227: 89 04 24 mov %eax,(%esp)
22a: e8 d1 fd ff ff call 0 <fmtname>
22f: 8b 95 ac fd ff ff mov -0x254(%ebp),%edx
235: 8b 8d a8 fd ff ff mov -0x258(%ebp),%ecx
23b: c7 44 24 04 5e 0a 00 movl $0xa5e,0x4(%esp)
242: 00
243: c7 04 24 01 00 00 00 movl $0x1,(%esp)
24a: 89 54 24 14 mov %edx,0x14(%esp)
24e: 8b 95 b0 fd ff ff mov -0x250(%ebp),%edx
254: 89 4c 24 10 mov %ecx,0x10(%esp)
258: 89 44 24 08 mov %eax,0x8(%esp)
25c: 89 54 24 0c mov %edx,0xc(%esp)
260: e8 6b 04 00 00 call 6d0 <printf>
265: e9 36 ff ff ff jmp 1a0 <ls+0x100>
26a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
printf(1, "%s %d %d %d\n", fmtname(path), st.type, st.ino, st.size);
break;
case T_DIR:
if(strlen(path) + 1 + DIRSIZ + 1 > sizeof buf){
printf(1, "ls: path too long\n");
270: c7 44 24 04 6b 0a 00 movl $0xa6b,0x4(%esp)
277: 00
278: c7 04 24 01 00 00 00 movl $0x1,(%esp)
27f: e8 4c 04 00 00 call 6d0 <printf>
break;
284: e9 67 fe ff ff jmp f0 <ls+0x50>
289: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
int fd;
struct dirent de;
struct stat st;
if((fd = open(path, 0)) < 0){
printf(2, "ls: cannot open %s\n", path);
290: 89 7c 24 08 mov %edi,0x8(%esp)
294: c7 44 24 04 36 0a 00 movl $0xa36,0x4(%esp)
29b: 00
29c: c7 04 24 02 00 00 00 movl $0x2,(%esp)
2a3: e8 28 04 00 00 call 6d0 <printf>
printf(1, "%s %d %d %d\n", fmtname(buf), st.type, st.ino, st.size);
}
break;
}
close(fd);
}
2a8: 81 c4 6c 02 00 00 add $0x26c,%esp
2ae: 5b pop %ebx
2af: 5e pop %esi
2b0: 5f pop %edi
2b1: 5d pop %ebp
2b2: c3 ret
2b3: 90 nop
2b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
if(de.inum == 0)
continue;
memmove(p, de.name, DIRSIZ);
p[DIRSIZ] = 0;
if(stat(buf, &st) < 0){
printf(1, "ls: cannot stat %s\n", buf);
2b8: 8d 85 c4 fd ff ff lea -0x23c(%ebp),%eax
2be: 89 44 24 08 mov %eax,0x8(%esp)
2c2: c7 44 24 04 4a 0a 00 movl $0xa4a,0x4(%esp)
2c9: 00
2ca: c7 04 24 01 00 00 00 movl $0x1,(%esp)
2d1: e8 fa 03 00 00 call 6d0 <printf>
continue;
2d6: e9 c5 fe ff ff jmp 1a0 <ls+0x100>
2db: 90 nop
2dc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
printf(2, "ls: cannot open %s\n", path);
return;
}
if(fstat(fd, &st) < 0){
printf(2, "ls: cannot stat %s\n", path);
2e0: 89 7c 24 08 mov %edi,0x8(%esp)
2e4: c7 44 24 04 4a 0a 00 movl $0xa4a,0x4(%esp)
2eb: 00
2ec: c7 04 24 02 00 00 00 movl $0x2,(%esp)
2f3: e8 d8 03 00 00 call 6d0 <printf>
close(fd);
2f8: 89 1c 24 mov %ebx,(%esp)
2fb: e8 c0 02 00 00 call 5c0 <close>
return;
300: e9 f3 fd ff ff jmp f8 <ls+0x58>
305: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
309: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000310 <main>:
close(fd);
}
int
main(int argc, char *argv[])
{
310: 55 push %ebp
311: 89 e5 mov %esp,%ebp
313: 83 e4 f0 and $0xfffffff0,%esp
316: 57 push %edi
317: 56 push %esi
318: 53 push %ebx
int i;
if(argc < 2){
ls(".");
exit(0);
319: bb 01 00 00 00 mov $0x1,%ebx
close(fd);
}
int
main(int argc, char *argv[])
{
31e: 83 ec 14 sub $0x14,%esp
321: 8b 75 08 mov 0x8(%ebp),%esi
324: 8b 7d 0c mov 0xc(%ebp),%edi
int i;
if(argc < 2){
327: 83 fe 01 cmp $0x1,%esi
32a: 7e 24 jle 350 <main+0x40>
32c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
ls(".");
exit(0);
}
for(i=1; i<argc; i++)
ls(argv[i]);
330: 8b 04 9f mov (%edi,%ebx,4),%eax
if(argc < 2){
ls(".");
exit(0);
}
for(i=1; i<argc; i++)
333: 83 c3 01 add $0x1,%ebx
ls(argv[i]);
336: 89 04 24 mov %eax,(%esp)
339: e8 62 fd ff ff call a0 <ls>
if(argc < 2){
ls(".");
exit(0);
}
for(i=1; i<argc; i++)
33e: 39 de cmp %ebx,%esi
340: 7f ee jg 330 <main+0x20>
ls(argv[i]);
exit(0);
342: c7 04 24 00 00 00 00 movl $0x0,(%esp)
349: e8 4a 02 00 00 call 598 <exit>
34e: 66 90 xchg %ax,%ax
main(int argc, char *argv[])
{
int i;
if(argc < 2){
ls(".");
350: c7 04 24 7e 0a 00 00 movl $0xa7e,(%esp)
357: e8 44 fd ff ff call a0 <ls>
exit(0);
35c: c7 04 24 00 00 00 00 movl $0x0,(%esp)
363: e8 30 02 00 00 call 598 <exit>
368: 90 nop
369: 90 nop
36a: 90 nop
36b: 90 nop
36c: 90 nop
36d: 90 nop
36e: 90 nop
36f: 90 nop
00000370 <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
370: 55 push %ebp
371: 31 d2 xor %edx,%edx
373: 89 e5 mov %esp,%ebp
375: 8b 45 08 mov 0x8(%ebp),%eax
378: 53 push %ebx
379: 8b 5d 0c mov 0xc(%ebp),%ebx
37c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *os;
os = s;
while((*s++ = *t++) != 0)
380: 0f b6 0c 13 movzbl (%ebx,%edx,1),%ecx
384: 88 0c 10 mov %cl,(%eax,%edx,1)
387: 83 c2 01 add $0x1,%edx
38a: 84 c9 test %cl,%cl
38c: 75 f2 jne 380 <strcpy+0x10>
;
return os;
}
38e: 5b pop %ebx
38f: 5d pop %ebp
390: c3 ret
391: eb 0d jmp 3a0 <strcmp>
393: 90 nop
394: 90 nop
395: 90 nop
396: 90 nop
397: 90 nop
398: 90 nop
399: 90 nop
39a: 90 nop
39b: 90 nop
39c: 90 nop
39d: 90 nop
39e: 90 nop
39f: 90 nop
000003a0 <strcmp>:
int
strcmp(const char *p, const char *q)
{
3a0: 55 push %ebp
3a1: 89 e5 mov %esp,%ebp
3a3: 8b 4d 08 mov 0x8(%ebp),%ecx
3a6: 53 push %ebx
3a7: 8b 55 0c mov 0xc(%ebp),%edx
while(*p && *p == *q)
3aa: 0f b6 01 movzbl (%ecx),%eax
3ad: 84 c0 test %al,%al
3af: 75 14 jne 3c5 <strcmp+0x25>
3b1: eb 25 jmp 3d8 <strcmp+0x38>
3b3: 90 nop
3b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p++, q++;
3b8: 83 c1 01 add $0x1,%ecx
3bb: 83 c2 01 add $0x1,%edx
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3be: 0f b6 01 movzbl (%ecx),%eax
3c1: 84 c0 test %al,%al
3c3: 74 13 je 3d8 <strcmp+0x38>
3c5: 0f b6 1a movzbl (%edx),%ebx
3c8: 38 d8 cmp %bl,%al
3ca: 74 ec je 3b8 <strcmp+0x18>
3cc: 0f b6 db movzbl %bl,%ebx
3cf: 0f b6 c0 movzbl %al,%eax
3d2: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3d4: 5b pop %ebx
3d5: 5d pop %ebp
3d6: c3 ret
3d7: 90 nop
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
3d8: 0f b6 1a movzbl (%edx),%ebx
3db: 31 c0 xor %eax,%eax
3dd: 0f b6 db movzbl %bl,%ebx
3e0: 29 d8 sub %ebx,%eax
p++, q++;
return (uchar)*p - (uchar)*q;
}
3e2: 5b pop %ebx
3e3: 5d pop %ebp
3e4: c3 ret
3e5: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3e9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000003f0 <strlen>:
uint
strlen(char *s)
{
3f0: 55 push %ebp
int n;
for(n = 0; s[n]; n++)
3f1: 31 d2 xor %edx,%edx
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3f3: 89 e5 mov %esp,%ebp
int n;
for(n = 0; s[n]; n++)
3f5: 31 c0 xor %eax,%eax
return (uchar)*p - (uchar)*q;
}
uint
strlen(char *s)
{
3f7: 8b 4d 08 mov 0x8(%ebp),%ecx
int n;
for(n = 0; s[n]; n++)
3fa: 80 39 00 cmpb $0x0,(%ecx)
3fd: 74 0c je 40b <strlen+0x1b>
3ff: 90 nop
400: 83 c2 01 add $0x1,%edx
403: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
407: 89 d0 mov %edx,%eax
409: 75 f5 jne 400 <strlen+0x10>
;
return n;
}
40b: 5d pop %ebp
40c: c3 ret
40d: 8d 76 00 lea 0x0(%esi),%esi
00000410 <memset>:
void*
memset(void *dst, int c, uint n)
{
410: 55 push %ebp
411: 89 e5 mov %esp,%ebp
413: 8b 55 08 mov 0x8(%ebp),%edx
416: 57 push %edi
}
static inline void
stosb(void *addr, int data, int cnt)
{
asm volatile("cld; rep stosb" :
417: 8b 4d 10 mov 0x10(%ebp),%ecx
41a: 8b 45 0c mov 0xc(%ebp),%eax
41d: 89 d7 mov %edx,%edi
41f: fc cld
420: f3 aa rep stos %al,%es:(%edi)
stosb(dst, c, n);
return dst;
}
422: 89 d0 mov %edx,%eax
424: 5f pop %edi
425: 5d pop %ebp
426: c3 ret
427: 89 f6 mov %esi,%esi
429: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000430 <strchr>:
char*
strchr(const char *s, char c)
{
430: 55 push %ebp
431: 89 e5 mov %esp,%ebp
433: 8b 45 08 mov 0x8(%ebp),%eax
436: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx
for(; *s; s++)
43a: 0f b6 10 movzbl (%eax),%edx
43d: 84 d2 test %dl,%dl
43f: 75 11 jne 452 <strchr+0x22>
441: eb 15 jmp 458 <strchr+0x28>
443: 90 nop
444: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
448: 83 c0 01 add $0x1,%eax
44b: 0f b6 10 movzbl (%eax),%edx
44e: 84 d2 test %dl,%dl
450: 74 06 je 458 <strchr+0x28>
if(*s == c)
452: 38 ca cmp %cl,%dl
454: 75 f2 jne 448 <strchr+0x18>
return (char*)s;
return 0;
}
456: 5d pop %ebp
457: c3 ret
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
458: 31 c0 xor %eax,%eax
if(*s == c)
return (char*)s;
return 0;
}
45a: 5d pop %ebp
45b: 90 nop
45c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
460: c3 ret
461: eb 0d jmp 470 <atoi>
463: 90 nop
464: 90 nop
465: 90 nop
466: 90 nop
467: 90 nop
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 <atoi>:
return r;
}
int
atoi(const char *s)
{
470: 55 push %ebp
int n;
n = 0;
while('0' <= *s && *s <= '9')
471: 31 c0 xor %eax,%eax
return r;
}
int
atoi(const char *s)
{
473: 89 e5 mov %esp,%ebp
475: 8b 4d 08 mov 0x8(%ebp),%ecx
478: 53 push %ebx
int n;
n = 0;
while('0' <= *s && *s <= '9')
479: 0f b6 11 movzbl (%ecx),%edx
47c: 8d 5a d0 lea -0x30(%edx),%ebx
47f: 80 fb 09 cmp $0x9,%bl
482: 77 1c ja 4a0 <atoi+0x30>
484: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
n = n*10 + *s++ - '0';
488: 0f be d2 movsbl %dl,%edx
48b: 83 c1 01 add $0x1,%ecx
48e: 8d 04 80 lea (%eax,%eax,4),%eax
491: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
495: 0f b6 11 movzbl (%ecx),%edx
498: 8d 5a d0 lea -0x30(%edx),%ebx
49b: 80 fb 09 cmp $0x9,%bl
49e: 76 e8 jbe 488 <atoi+0x18>
n = n*10 + *s++ - '0';
return n;
}
4a0: 5b pop %ebx
4a1: 5d pop %ebp
4a2: c3 ret
4a3: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
4a9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
000004b0 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
4b0: 55 push %ebp
4b1: 89 e5 mov %esp,%ebp
4b3: 56 push %esi
4b4: 8b 45 08 mov 0x8(%ebp),%eax
4b7: 53 push %ebx
4b8: 8b 5d 10 mov 0x10(%ebp),%ebx
4bb: 8b 75 0c mov 0xc(%ebp),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4be: 85 db test %ebx,%ebx
4c0: 7e 14 jle 4d6 <memmove+0x26>
n = n*10 + *s++ - '0';
return n;
}
void*
memmove(void *vdst, void *vsrc, int n)
4c2: 31 d2 xor %edx,%edx
4c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
*dst++ = *src++;
4c8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
4cc: 88 0c 10 mov %cl,(%eax,%edx,1)
4cf: 83 c2 01 add $0x1,%edx
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
4d2: 39 da cmp %ebx,%edx
4d4: 75 f2 jne 4c8 <memmove+0x18>
*dst++ = *src++;
return vdst;
}
4d6: 5b pop %ebx
4d7: 5e pop %esi
4d8: 5d pop %ebp
4d9: c3 ret
4da: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
000004e0 <stat>:
return buf;
}
int
stat(char *n, struct stat *st)
{
4e0: 55 push %ebp
4e1: 89 e5 mov %esp,%ebp
4e3: 83 ec 18 sub $0x18,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
4e6: 8b 45 08 mov 0x8(%ebp),%eax
return buf;
}
int
stat(char *n, struct stat *st)
{
4e9: 89 5d f8 mov %ebx,-0x8(%ebp)
4ec: 89 75 fc mov %esi,-0x4(%ebp)
int fd;
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
4ef: be ff ff ff ff mov $0xffffffff,%esi
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
4f4: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
4fb: 00
4fc: 89 04 24 mov %eax,(%esp)
4ff: e8 d4 00 00 00 call 5d8 <open>
if(fd < 0)
504: 85 c0 test %eax,%eax
stat(char *n, struct stat *st)
{
int fd;
int r;
fd = open(n, O_RDONLY);
506: 89 c3 mov %eax,%ebx
if(fd < 0)
508: 78 19 js 523 <stat+0x43>
return -1;
r = fstat(fd, st);
50a: 8b 45 0c mov 0xc(%ebp),%eax
50d: 89 1c 24 mov %ebx,(%esp)
510: 89 44 24 04 mov %eax,0x4(%esp)
514: e8 d7 00 00 00 call 5f0 <fstat>
close(fd);
519: 89 1c 24 mov %ebx,(%esp)
int r;
fd = open(n, O_RDONLY);
if(fd < 0)
return -1;
r = fstat(fd, st);
51c: 89 c6 mov %eax,%esi
close(fd);
51e: e8 9d 00 00 00 call 5c0 <close>
return r;
}
523: 89 f0 mov %esi,%eax
525: 8b 5d f8 mov -0x8(%ebp),%ebx
528: 8b 75 fc mov -0x4(%ebp),%esi
52b: 89 ec mov %ebp,%esp
52d: 5d pop %ebp
52e: c3 ret
52f: 90 nop
00000530 <gets>:
return 0;
}
char*
gets(char *buf, int max)
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 57 push %edi
534: 56 push %esi
535: 31 f6 xor %esi,%esi
537: 53 push %ebx
538: 83 ec 2c sub $0x2c,%esp
53b: 8b 7d 08 mov 0x8(%ebp),%edi
int i, cc;
char c;
for(i=0; i+1 < max; ){
53e: eb 06 jmp 546 <gets+0x16>
cc = read(0, &c, 1);
if(cc < 1)
break;
buf[i++] = c;
if(c == '\n' || c == '\r')
540: 3c 0a cmp $0xa,%al
542: 74 39 je 57d <gets+0x4d>
544: 89 de mov %ebx,%esi
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
546: 8d 5e 01 lea 0x1(%esi),%ebx
549: 3b 5d 0c cmp 0xc(%ebp),%ebx
54c: 7d 31 jge 57f <gets+0x4f>
cc = read(0, &c, 1);
54e: 8d 45 e7 lea -0x19(%ebp),%eax
551: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
558: 00
559: 89 44 24 04 mov %eax,0x4(%esp)
55d: c7 04 24 00 00 00 00 movl $0x0,(%esp)
564: e8 47 00 00 00 call 5b0 <read>
if(cc < 1)
569: 85 c0 test %eax,%eax
56b: 7e 12 jle 57f <gets+0x4f>
break;
buf[i++] = c;
56d: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
571: 88 44 1f ff mov %al,-0x1(%edi,%ebx,1)
if(c == '\n' || c == '\r')
575: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
579: 3c 0d cmp $0xd,%al
57b: 75 c3 jne 540 <gets+0x10>
57d: 89 de mov %ebx,%esi
break;
}
buf[i] = '\0';
57f: c6 04 37 00 movb $0x0,(%edi,%esi,1)
return buf;
}
583: 89 f8 mov %edi,%eax
585: 83 c4 2c add $0x2c,%esp
588: 5b pop %ebx
589: 5e pop %esi
58a: 5f pop %edi
58b: 5d pop %ebp
58c: c3 ret
58d: 90 nop
58e: 90 nop
58f: 90 nop
00000590 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
590: b8 01 00 00 00 mov $0x1,%eax
595: cd 40 int $0x40
597: c3 ret
00000598 <exit>:
SYSCALL(exit)
598: b8 02 00 00 00 mov $0x2,%eax
59d: cd 40 int $0x40
59f: c3 ret
000005a0 <wait>:
SYSCALL(wait)
5a0: b8 03 00 00 00 mov $0x3,%eax
5a5: cd 40 int $0x40
5a7: c3 ret
000005a8 <pipe>:
SYSCALL(pipe)
5a8: b8 04 00 00 00 mov $0x4,%eax
5ad: cd 40 int $0x40
5af: c3 ret
000005b0 <read>:
SYSCALL(read)
5b0: b8 05 00 00 00 mov $0x5,%eax
5b5: cd 40 int $0x40
5b7: c3 ret
000005b8 <write>:
SYSCALL(write)
5b8: b8 10 00 00 00 mov $0x10,%eax
5bd: cd 40 int $0x40
5bf: c3 ret
000005c0 <close>:
SYSCALL(close)
5c0: b8 15 00 00 00 mov $0x15,%eax
5c5: cd 40 int $0x40
5c7: c3 ret
000005c8 <kill>:
SYSCALL(kill)
5c8: b8 06 00 00 00 mov $0x6,%eax
5cd: cd 40 int $0x40
5cf: c3 ret
000005d0 <exec>:
SYSCALL(exec)
5d0: b8 07 00 00 00 mov $0x7,%eax
5d5: cd 40 int $0x40
5d7: c3 ret
000005d8 <open>:
SYSCALL(open)
5d8: b8 0f 00 00 00 mov $0xf,%eax
5dd: cd 40 int $0x40
5df: c3 ret
000005e0 <mknod>:
SYSCALL(mknod)
5e0: b8 11 00 00 00 mov $0x11,%eax
5e5: cd 40 int $0x40
5e7: c3 ret
000005e8 <unlink>:
SYSCALL(unlink)
5e8: b8 12 00 00 00 mov $0x12,%eax
5ed: cd 40 int $0x40
5ef: c3 ret
000005f0 <fstat>:
SYSCALL(fstat)
5f0: b8 08 00 00 00 mov $0x8,%eax
5f5: cd 40 int $0x40
5f7: c3 ret
000005f8 <link>:
SYSCALL(link)
5f8: b8 13 00 00 00 mov $0x13,%eax
5fd: cd 40 int $0x40
5ff: c3 ret
00000600 <mkdir>:
SYSCALL(mkdir)
600: b8 14 00 00 00 mov $0x14,%eax
605: cd 40 int $0x40
607: c3 ret
00000608 <chdir>:
SYSCALL(chdir)
608: b8 09 00 00 00 mov $0x9,%eax
60d: cd 40 int $0x40
60f: c3 ret
00000610 <dup>:
SYSCALL(dup)
610: b8 0a 00 00 00 mov $0xa,%eax
615: cd 40 int $0x40
617: c3 ret
00000618 <getpid>:
SYSCALL(getpid)
618: b8 0b 00 00 00 mov $0xb,%eax
61d: cd 40 int $0x40
61f: c3 ret
00000620 <sbrk>:
SYSCALL(sbrk)
620: b8 0c 00 00 00 mov $0xc,%eax
625: cd 40 int $0x40
627: c3 ret
00000628 <sleep>:
SYSCALL(sleep)
628: b8 0d 00 00 00 mov $0xd,%eax
62d: cd 40 int $0x40
62f: c3 ret
00000630 <uptime>:
SYSCALL(uptime)
630: b8 0e 00 00 00 mov $0xe,%eax
635: cd 40 int $0x40
637: c3 ret
00000638 <hello>:
SYSCALL(hello)
638: b8 16 00 00 00 mov $0x16,%eax
63d: cd 40 int $0x40
63f: c3 ret
00000640 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
640: 55 push %ebp
641: 89 e5 mov %esp,%ebp
643: 57 push %edi
644: 89 cf mov %ecx,%edi
646: 56 push %esi
647: 89 c6 mov %eax,%esi
649: 53 push %ebx
64a: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
64d: 8b 4d 08 mov 0x8(%ebp),%ecx
650: 85 c9 test %ecx,%ecx
652: 74 04 je 658 <printint+0x18>
654: 85 d2 test %edx,%edx
656: 78 68 js 6c0 <printint+0x80>
neg = 1;
x = -xx;
} else {
x = xx;
658: 89 d0 mov %edx,%eax
65a: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
661: 31 c9 xor %ecx,%ecx
663: 8d 5d d7 lea -0x29(%ebp),%ebx
666: 66 90 xchg %ax,%ax
}
i = 0;
do{
buf[i++] = digits[x % base];
668: 31 d2 xor %edx,%edx
66a: f7 f7 div %edi
66c: 0f b6 92 87 0a 00 00 movzbl 0xa87(%edx),%edx
673: 88 14 0b mov %dl,(%ebx,%ecx,1)
676: 83 c1 01 add $0x1,%ecx
}while((x /= base) != 0);
679: 85 c0 test %eax,%eax
67b: 75 eb jne 668 <printint+0x28>
if(neg)
67d: 8b 45 c4 mov -0x3c(%ebp),%eax
680: 85 c0 test %eax,%eax
682: 74 08 je 68c <printint+0x4c>
buf[i++] = '-';
684: c6 44 0d d7 2d movb $0x2d,-0x29(%ebp,%ecx,1)
689: 83 c1 01 add $0x1,%ecx
while(--i >= 0)
68c: 8d 79 ff lea -0x1(%ecx),%edi
68f: 90 nop
690: 0f b6 04 3b movzbl (%ebx,%edi,1),%eax
694: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
697: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
69e: 00
69f: 89 34 24 mov %esi,(%esp)
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6a2: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6a5: 8d 45 e7 lea -0x19(%ebp),%eax
6a8: 89 44 24 04 mov %eax,0x4(%esp)
6ac: e8 07 ff ff ff call 5b8 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
6b1: 83 ff ff cmp $0xffffffff,%edi
6b4: 75 da jne 690 <printint+0x50>
putc(fd, buf[i]);
}
6b6: 83 c4 4c add $0x4c,%esp
6b9: 5b pop %ebx
6ba: 5e pop %esi
6bb: 5f pop %edi
6bc: 5d pop %ebp
6bd: c3 ret
6be: 66 90 xchg %ax,%ax
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
6c0: 89 d0 mov %edx,%eax
6c2: f7 d8 neg %eax
6c4: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
6cb: eb 94 jmp 661 <printint+0x21>
6cd: 8d 76 00 lea 0x0(%esi),%esi
000006d0 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
6d0: 55 push %ebp
6d1: 89 e5 mov %esp,%ebp
6d3: 57 push %edi
6d4: 56 push %esi
6d5: 53 push %ebx
6d6: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
6d9: 8b 45 0c mov 0xc(%ebp),%eax
6dc: 0f b6 10 movzbl (%eax),%edx
6df: 84 d2 test %dl,%dl
6e1: 0f 84 c1 00 00 00 je 7a8 <printf+0xd8>
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
6e7: 8d 4d 10 lea 0x10(%ebp),%ecx
6ea: 31 ff xor %edi,%edi
6ec: 89 4d d4 mov %ecx,-0x2c(%ebp)
6ef: 31 db xor %ebx,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6f1: 8d 75 e7 lea -0x19(%ebp),%esi
6f4: eb 1e jmp 714 <printf+0x44>
6f6: 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 == '%'){
6f8: 83 fa 25 cmp $0x25,%edx
6fb: 0f 85 af 00 00 00 jne 7b0 <printf+0xe0>
701: 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++){
705: 83 c3 01 add $0x1,%ebx
708: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
70c: 84 d2 test %dl,%dl
70e: 0f 84 94 00 00 00 je 7a8 <printf+0xd8>
c = fmt[i] & 0xff;
if(state == 0){
714: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
716: 0f b6 d2 movzbl %dl,%edx
if(state == 0){
719: 74 dd je 6f8 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
71b: 83 ff 25 cmp $0x25,%edi
71e: 75 e5 jne 705 <printf+0x35>
if(c == 'd'){
720: 83 fa 64 cmp $0x64,%edx
723: 0f 84 3f 01 00 00 je 868 <printf+0x198>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
729: 83 fa 70 cmp $0x70,%edx
72c: 0f 84 a6 00 00 00 je 7d8 <printf+0x108>
732: 83 fa 78 cmp $0x78,%edx
735: 0f 84 9d 00 00 00 je 7d8 <printf+0x108>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
73b: 83 fa 73 cmp $0x73,%edx
73e: 66 90 xchg %ax,%ax
740: 0f 84 ba 00 00 00 je 800 <printf+0x130>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
746: 83 fa 63 cmp $0x63,%edx
749: 0f 84 41 01 00 00 je 890 <printf+0x1c0>
putc(fd, *ap);
ap++;
} else if(c == '%'){
74f: 83 fa 25 cmp $0x25,%edx
752: 0f 84 00 01 00 00 je 858 <printf+0x188>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
758: 8b 4d 08 mov 0x8(%ebp),%ecx
75b: 89 55 cc mov %edx,-0x34(%ebp)
75e: c6 45 e7 25 movb $0x25,-0x19(%ebp)
762: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
769: 00
76a: 89 74 24 04 mov %esi,0x4(%esp)
76e: 89 0c 24 mov %ecx,(%esp)
771: e8 42 fe ff ff call 5b8 <write>
776: 8b 55 cc mov -0x34(%ebp),%edx
779: 88 55 e7 mov %dl,-0x19(%ebp)
77c: 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++){
77f: 83 c3 01 add $0x1,%ebx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
782: 31 ff xor %edi,%edi
784: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
78b: 00
78c: 89 74 24 04 mov %esi,0x4(%esp)
790: 89 04 24 mov %eax,(%esp)
793: e8 20 fe ff ff call 5b8 <write>
798: 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++){
79b: 0f b6 14 18 movzbl (%eax,%ebx,1),%edx
79f: 84 d2 test %dl,%dl
7a1: 0f 85 6d ff ff ff jne 714 <printf+0x44>
7a7: 90 nop
putc(fd, c);
}
state = 0;
}
}
}
7a8: 83 c4 3c add $0x3c,%esp
7ab: 5b pop %ebx
7ac: 5e pop %esi
7ad: 5f pop %edi
7ae: 5d pop %ebp
7af: c3 ret
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7b0: 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 == '%'){
7b3: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
7b6: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
7bd: 00
7be: 89 74 24 04 mov %esi,0x4(%esp)
7c2: 89 04 24 mov %eax,(%esp)
7c5: e8 ee fd ff ff call 5b8 <write>
7ca: 8b 45 0c mov 0xc(%ebp),%eax
7cd: e9 33 ff ff ff jmp 705 <printf+0x35>
7d2: 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);
7d8: 8b 45 d4 mov -0x2c(%ebp),%eax
7db: b9 10 00 00 00 mov $0x10,%ecx
ap++;
7e0: 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);
7e2: c7 04 24 00 00 00 00 movl $0x0,(%esp)
7e9: 8b 10 mov (%eax),%edx
7eb: 8b 45 08 mov 0x8(%ebp),%eax
7ee: e8 4d fe ff ff call 640 <printint>
7f3: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
7f6: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
7fa: e9 06 ff ff ff jmp 705 <printf+0x35>
7ff: 90 nop
} else if(c == 's'){
s = (char*)*ap;
800: 8b 55 d4 mov -0x2c(%ebp),%edx
ap++;
if(s == 0)
803: b9 80 0a 00 00 mov $0xa80,%ecx
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
808: 8b 3a mov (%edx),%edi
ap++;
80a: 83 c2 04 add $0x4,%edx
80d: 89 55 d4 mov %edx,-0x2c(%ebp)
if(s == 0)
810: 85 ff test %edi,%edi
812: 0f 44 f9 cmove %ecx,%edi
s = "(null)";
while(*s != 0){
815: 0f b6 17 movzbl (%edi),%edx
818: 84 d2 test %dl,%dl
81a: 74 33 je 84f <printf+0x17f>
81c: 89 5d d0 mov %ebx,-0x30(%ebp)
81f: 8b 5d 08 mov 0x8(%ebp),%ebx
822: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
putc(fd, *s);
s++;
828: 83 c7 01 add $0x1,%edi
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
82b: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
82e: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
835: 00
836: 89 74 24 04 mov %esi,0x4(%esp)
83a: 89 1c 24 mov %ebx,(%esp)
83d: e8 76 fd ff ff call 5b8 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
842: 0f b6 17 movzbl (%edi),%edx
845: 84 d2 test %dl,%dl
847: 75 df jne 828 <printf+0x158>
849: 8b 5d d0 mov -0x30(%ebp),%ebx
84c: 8b 45 0c mov 0xc(%ebp),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
84f: 31 ff xor %edi,%edi
851: e9 af fe ff ff jmp 705 <printf+0x35>
856: 66 90 xchg %ax,%ax
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
} else if(c == '%'){
858: c6 45 e7 25 movb $0x25,-0x19(%ebp)
85c: e9 1b ff ff ff jmp 77c <printf+0xac>
861: 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);
868: 8b 45 d4 mov -0x2c(%ebp),%eax
86b: b9 0a 00 00 00 mov $0xa,%ecx
ap++;
870: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
873: c7 04 24 01 00 00 00 movl $0x1,(%esp)
87a: 8b 10 mov (%eax),%edx
87c: 8b 45 08 mov 0x8(%ebp),%eax
87f: e8 bc fd ff ff call 640 <printint>
884: 8b 45 0c mov 0xc(%ebp),%eax
ap++;
887: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
88b: e9 75 fe ff ff jmp 705 <printf+0x35>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
890: 8b 55 d4 mov -0x2c(%ebp),%edx
putc(fd, *ap);
ap++;
893: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
895: 8b 4d 08 mov 0x8(%ebp),%ecx
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
898: 8b 02 mov (%edx),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
89a: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
8a1: 00
8a2: 89 74 24 04 mov %esi,0x4(%esp)
8a6: 89 0c 24 mov %ecx,(%esp)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
8a9: 88 45 e7 mov %al,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
8ac: e8 07 fd ff ff call 5b8 <write>
8b1: 8b 45 0c mov 0xc(%ebp),%eax
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
8b4: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
8b8: e9 48 fe ff ff jmp 705 <printf+0x35>
8bd: 90 nop
8be: 90 nop
8bf: 90 nop
000008c0 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
8c0: 55 push %ebp
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8c1: a1 b0 0a 00 00 mov 0xab0,%eax
static Header base;
static Header *freep;
void
free(void *ap)
{
8c6: 89 e5 mov %esp,%ebp
8c8: 57 push %edi
8c9: 56 push %esi
8ca: 53 push %ebx
8cb: 8b 5d 08 mov 0x8(%ebp),%ebx
Header *bp, *p;
bp = (Header*)ap - 1;
8ce: 8d 4b f8 lea -0x8(%ebx),%ecx
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
8d1: 39 c8 cmp %ecx,%eax
8d3: 73 1d jae 8f2 <free+0x32>
8d5: 8d 76 00 lea 0x0(%esi),%esi
8d8: 8b 10 mov (%eax),%edx
8da: 39 d1 cmp %edx,%ecx
8dc: 72 1a jb 8f8 <free+0x38>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
8de: 39 d0 cmp %edx,%eax
8e0: 72 08 jb 8ea <free+0x2a>
8e2: 39 c8 cmp %ecx,%eax
8e4: 72 12 jb 8f8 <free+0x38>
8e6: 39 d1 cmp %edx,%ecx
8e8: 72 0e jb 8f8 <free+0x38>
8ea: 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)
8ec: 39 c8 cmp %ecx,%eax
8ee: 66 90 xchg %ax,%ax
8f0: 72 e6 jb 8d8 <free+0x18>
8f2: 8b 10 mov (%eax),%edx
8f4: eb e8 jmp 8de <free+0x1e>
8f6: 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){
8f8: 8b 71 04 mov 0x4(%ecx),%esi
8fb: 8d 3c f1 lea (%ecx,%esi,8),%edi
8fe: 39 d7 cmp %edx,%edi
900: 74 19 je 91b <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;
902: 89 53 f8 mov %edx,-0x8(%ebx)
if(p + p->s.size == bp){
905: 8b 50 04 mov 0x4(%eax),%edx
908: 8d 34 d0 lea (%eax,%edx,8),%esi
90b: 39 ce cmp %ecx,%esi
90d: 74 23 je 932 <free+0x72>
p->s.size += bp->s.size;
p->s.ptr = bp->s.ptr;
} else
p->s.ptr = bp;
90f: 89 08 mov %ecx,(%eax)
freep = p;
911: a3 b0 0a 00 00 mov %eax,0xab0
}
916: 5b pop %ebx
917: 5e pop %esi
918: 5f pop %edi
919: 5d pop %ebp
91a: 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;
91b: 03 72 04 add 0x4(%edx),%esi
91e: 89 71 04 mov %esi,0x4(%ecx)
bp->s.ptr = p->s.ptr->s.ptr;
921: 8b 10 mov (%eax),%edx
923: 8b 12 mov (%edx),%edx
925: 89 53 f8 mov %edx,-0x8(%ebx)
} else
bp->s.ptr = p->s.ptr;
if(p + p->s.size == bp){
928: 8b 50 04 mov 0x4(%eax),%edx
92b: 8d 34 d0 lea (%eax,%edx,8),%esi
92e: 39 ce cmp %ecx,%esi
930: 75 dd jne 90f <free+0x4f>
p->s.size += bp->s.size;
932: 03 51 04 add 0x4(%ecx),%edx
935: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
938: 8b 53 f8 mov -0x8(%ebx),%edx
93b: 89 10 mov %edx,(%eax)
} else
p->s.ptr = bp;
freep = p;
93d: a3 b0 0a 00 00 mov %eax,0xab0
}
942: 5b pop %ebx
943: 5e pop %esi
944: 5f pop %edi
945: 5d pop %ebp
946: c3 ret
947: 89 f6 mov %esi,%esi
949: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000950 <malloc>:
return freep;
}
void*
malloc(uint nbytes)
{
950: 55 push %ebp
951: 89 e5 mov %esp,%ebp
953: 57 push %edi
954: 56 push %esi
955: 53 push %ebx
956: 83 ec 2c sub $0x2c,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
959: 8b 5d 08 mov 0x8(%ebp),%ebx
if((prevp = freep) == 0){
95c: 8b 0d b0 0a 00 00 mov 0xab0,%ecx
malloc(uint nbytes)
{
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
962: 83 c3 07 add $0x7,%ebx
965: c1 eb 03 shr $0x3,%ebx
968: 83 c3 01 add $0x1,%ebx
if((prevp = freep) == 0){
96b: 85 c9 test %ecx,%ecx
96d: 0f 84 9b 00 00 00 je a0e <malloc+0xbe>
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
973: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
975: 8b 50 04 mov 0x4(%eax),%edx
978: 39 d3 cmp %edx,%ebx
97a: 76 27 jbe 9a3 <malloc+0x53>
p->s.size -= nunits;
p += p->s.size;
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
97c: 8d 3c dd 00 00 00 00 lea 0x0(,%ebx,8),%edi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
983: be 00 80 00 00 mov $0x8000,%esi
988: 89 7d e4 mov %edi,-0x1c(%ebp)
98b: 90 nop
98c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
p->s.size = nunits;
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
990: 3b 05 b0 0a 00 00 cmp 0xab0,%eax
996: 74 30 je 9c8 <malloc+0x78>
998: 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){
99a: 8b 01 mov (%ecx),%eax
if(p->s.size >= nunits){
99c: 8b 50 04 mov 0x4(%eax),%edx
99f: 39 d3 cmp %edx,%ebx
9a1: 77 ed ja 990 <malloc+0x40>
if(p->s.size == nunits)
9a3: 39 d3 cmp %edx,%ebx
9a5: 74 61 je a08 <malloc+0xb8>
prevp->s.ptr = p->s.ptr;
else {
p->s.size -= nunits;
9a7: 29 da sub %ebx,%edx
9a9: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
9ac: 8d 04 d0 lea (%eax,%edx,8),%eax
p->s.size = nunits;
9af: 89 58 04 mov %ebx,0x4(%eax)
}
freep = prevp;
9b2: 89 0d b0 0a 00 00 mov %ecx,0xab0
return (void*)(p + 1);
9b8: 83 c0 08 add $0x8,%eax
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
}
9bb: 83 c4 2c add $0x2c,%esp
9be: 5b pop %ebx
9bf: 5e pop %esi
9c0: 5f pop %edi
9c1: 5d pop %ebp
9c2: c3 ret
9c3: 90 nop
9c4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
morecore(uint nu)
{
char *p;
Header *hp;
if(nu < 4096)
9c8: 8b 45 e4 mov -0x1c(%ebp),%eax
9cb: 81 fb 00 10 00 00 cmp $0x1000,%ebx
9d1: bf 00 10 00 00 mov $0x1000,%edi
9d6: 0f 43 fb cmovae %ebx,%edi
9d9: 0f 42 c6 cmovb %esi,%eax
nu = 4096;
p = sbrk(nu * sizeof(Header));
9dc: 89 04 24 mov %eax,(%esp)
9df: e8 3c fc ff ff call 620 <sbrk>
if(p == (char*)-1)
9e4: 83 f8 ff cmp $0xffffffff,%eax
9e7: 74 18 je a01 <malloc+0xb1>
return 0;
hp = (Header*)p;
hp->s.size = nu;
9e9: 89 78 04 mov %edi,0x4(%eax)
free((void*)(hp + 1));
9ec: 83 c0 08 add $0x8,%eax
9ef: 89 04 24 mov %eax,(%esp)
9f2: e8 c9 fe ff ff call 8c0 <free>
return freep;
9f7: 8b 0d b0 0a 00 00 mov 0xab0,%ecx
}
freep = prevp;
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
9fd: 85 c9 test %ecx,%ecx
9ff: 75 99 jne 99a <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){
a01: 31 c0 xor %eax,%eax
a03: eb b6 jmp 9bb <malloc+0x6b>
a05: 8d 76 00 lea 0x0(%esi),%esi
if(p->s.size == nunits)
prevp->s.ptr = p->s.ptr;
a08: 8b 10 mov (%eax),%edx
a0a: 89 11 mov %edx,(%ecx)
a0c: eb a4 jmp 9b2 <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;
a0e: c7 05 b0 0a 00 00 a8 movl $0xaa8,0xab0
a15: 0a 00 00
base.s.size = 0;
a18: b9 a8 0a 00 00 mov $0xaa8,%ecx
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
a1d: c7 05 a8 0a 00 00 a8 movl $0xaa8,0xaa8
a24: 0a 00 00
base.s.size = 0;
a27: c7 05 ac 0a 00 00 00 movl $0x0,0xaac
a2e: 00 00 00
a31: e9 3d ff ff ff jmp 973 <malloc+0x23>
|
vendor/stdlib/src/Data/String.agda | isabella232/Lemmachine | 56 | 12503 | ------------------------------------------------------------------------
-- Strings
------------------------------------------------------------------------
module Data.String where
open import Data.List as List using (List)
open import Data.Vec as Vec using (Vec)
open import Data.Colist as Colist using (Colist)
open import Data.Char using (Char)
open import Data.Bool using (Bool; true; false)
open import Data.Function
open import Relation.Nullary
open import Relation.Binary
open import Relation.Binary.PropositionalEquality as PropEq using (_≡_)
------------------------------------------------------------------------
-- Types
-- Finite strings.
postulate
String : Set
{-# BUILTIN STRING String #-}
{-# COMPILED_TYPE String String #-}
-- Possibly infinite strings.
Costring : Set
Costring = Colist Char
------------------------------------------------------------------------
-- Operations
private
primitive
primStringAppend : String → String → String
primStringToList : String → List Char
primStringFromList : List Char → String
primStringEquality : String → String → Bool
infixr 5 _++_
_++_ : String → String → String
_++_ = primStringAppend
toList : String → List Char
toList = primStringToList
fromList : List Char → String
fromList = primStringFromList
toVec : (s : String) → Vec Char (List.length (toList s))
toVec s = Vec.fromList (toList s)
toCostring : String → Costring
toCostring = Colist.fromList ∘ toList
infix 4 _==_
_==_ : String → String → Bool
_==_ = primStringEquality
_≟_ : Decidable {String} _≡_
s₁ ≟ s₂ with s₁ == s₂
... | true = yes trustMe
where postulate trustMe : _
... | false = no trustMe
where postulate trustMe : _
setoid : Setoid
setoid = PropEq.setoid String
decSetoid : DecSetoid
decSetoid = PropEq.decSetoid _≟_
|
libsrc/_DEVELOPMENT/adt/w_vector/c/sdcc_iy/w_vector_capacity_fastcall.asm | meesokim/z88dk | 0 | 164326 |
; size_t w_vector_capacity_fastcall(w_vector_t *v)
SECTION code_adt_w_vector
PUBLIC _w_vector_capacity_fastcall
defc _w_vector_capacity_fastcall = asm_w_vector_capacity
INCLUDE "adt/w_vector/z80/asm_w_vector_capacity.asm"
|
libsrc/z80_crt0s/8080/sccz80/l_long_asr.asm | Frodevan/z88dk | 38 | 240227 | ;
; Z88 Small C+ Run Time Library
; Long support functions
;
SECTION code_crt0_sccz80
PUBLIC l_long_asr
PUBLIC l_long_asro
; Entry: dehl = long
; c = shift couter
.l_long_asro
ld a,c
jp entry
; Entry: l = counter
; sp + 2 = long to shift
.l_long_asr
pop bc
ld a,l ;temporary store for counter
pop hl
pop de
push bc
.entry
and 31
ret z
ld b,a
IF __CPU_GBZ80__
ld a,e ; primary = dahl
ENDIF
.loop
IF __CPU_GBZ80__
sra d
rra
rr h
rr l
ELSE
ld a,d
rla
ld a,d
rra
ld d,a
ld a,e
rra
ld e,a
ld a,h
rra
ld h,a
ld a,l
rra
ld l,a
ENDIF
dec b
jp nz,loop
IF __CPU_GBZ80__
ld e,a
ENDIF
ret
|
src/lfsr.adb | JeremyGrosser/synack_misc | 0 | 11210 | --
-- Copyright (C) 2022 <NAME> <<EMAIL>>
--
-- SPDX-License-Identifier: BSD-3-Clause
--
package body LFSR is
function Next
return Random_Type
is
N : Random_Type := State;
LSB : Random_Type;
begin
loop
LSB := N and 1;
N := N / 2;
N := N xor ((-LSB) and Taps);
exit when N /= State;
end loop;
State := N;
return N;
end Next;
function In_Range
(First, Last : Random_Type)
return Random_Type
is (First + (Next mod (Last - First + 1)));
end LFSR;
|
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_1722.asm | ljhsiun2/medusa | 9 | 11571 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r12
push %r15
push %r9
push %rbp
push %rsi
lea addresses_normal_ht+0x1e71a, %r15
nop
nop
nop
add %rbp, %rbp
movl $0x61626364, (%r15)
nop
nop
cmp %r12, %r12
lea addresses_WT_ht+0x1e312, %r9
nop
nop
nop
nop
cmp %rsi, %rsi
movb $0x61, (%r9)
nop
nop
nop
nop
nop
and %r12, %r12
pop %rsi
pop %rbp
pop %r9
pop %r15
pop %r12
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
// Faulty Load
lea addresses_PSE+0x7b2a, %rdi
nop
nop
nop
and %r14, %r14
movb (%rdi), %cl
lea oracles, %rbp
and $0xff, %rcx
shlq $12, %rcx
mov (%rbp,%rcx,1), %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 1, 'NT': True, 'type': 'addresses_PSE'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_normal_ht'}}
{'OP': 'STOR', 'dst': {'congruent': 3, 'AVXalign': False, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
third-party/gmp/gmp-src/mpn/x86_64/coreisbr/mul_1.asm | jhh67/chapel | 1,602 | 173077 | <gh_stars>1000+
dnl X86-64 mpn_mul_1 optimised for Intel Sandy Bridge.
dnl Contributed to the GNU project by <NAME>.
dnl Copyright 2003-2005, 2007, 2008, 2011-2013, 2017 Free Software Foundation,
dnl 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 AMD K8,K9
C AMD K10
C AMD bull
C AMD pile
C AMD steam
C AMD excavator
C AMD bobcat
C AMD jaguar
C Intel P4
C Intel core2
C Intel NHM
C Intel SBR 2.49
C Intel IBR 2.32
C Intel HWL 2.44
C Intel BWL 2.43
C Intel SKL 2.47
C Intel atom
C Intel SLM
C VIA nano
C The loop of this code is the result of running a code generation and
C optimisation tool suite written by <NAME> and <NAME>.
define(`rp', `%rdi') C rcx
define(`up_param',`%rsi') C rdx
define(`n_param', `%rdx') C r8
define(`v0', `%rcx') C r9
define(`cin', `%r8') C stack
define(`up', `%rsi') C same as rp_param
define(`n', `%r9')
ABI_SUPPORT(DOS64)
ABI_SUPPORT(STD64)
IFDOS(` define(`rp', `%rcx')')
IFDOS(` define(`up_param',`%rdx')')
IFDOS(` define(`n_param', `%r8')')
IFDOS(` define(`v0', `%r9')')
IFDOS(` define(`cin', `48(%rsp)')')
IFDOS(` define(`up', `%rsi')')
IFDOS(` define(`n', `%r8')')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mul_1)
IFDOS(` push %rsi ')
mov (up_param), %rax
IFSTD(` mov n_param, n ')
lea (up_param,n_param,8), up
lea -8(rp,n_param,8), rp
neg n
mul v0
test $1, R8(n)
jz L(x0)
L(x1): mov %rax, %r11
mov %rdx, %r10
test $2, R8(n)
jnz L(01)
L(11): mov 8(up,n,8), %rax
dec n
jmp L(L3)
L(01): inc n
jnz L(L1)
mov %rax, (rp)
mov %rdx, %rax
IFDOS(` pop %rsi ')
ret
L(x0): mov %rax, %r10
mov %rdx, %r11
mov 8(up,n,8), %rax
test $2, R8(n)
jz L(L0)
L(10): add $-2, n
jmp L(L2)
ALIGN(8)
L(top): mov %rdx, %r10
add %rax, %r11
L(L1): mov 0(up,n,8), %rax
adc $0, %r10
mul v0
add %rax, %r10
mov %r11, 0(rp,n,8)
mov 8(up,n,8), %rax
mov %rdx, %r11
L(L0c): adc $0, %r11
L(L0): mul v0
mov %r10, 8(rp,n,8)
add %rax, %r11
mov %rdx, %r10
L(L3c): mov 16(up,n,8), %rax
adc $0, %r10
L(L3): mul v0
mov %r11, 16(rp,n,8)
mov %rdx, %r11
add %rax, %r10
L(L2c): mov 24(up,n,8), %rax
adc $0, %r11
L(L2): mul v0
mov %r10, 24(rp,n,8)
add $4, n
jnc L(top)
L(end): add %rax, %r11
mov %rdx, %rax
adc $0, %rax
mov %r11, (rp)
IFDOS(` pop %rsi ')
ret
EPILOGUE()
ALIGN(16)
PROLOGUE(mpn_mul_1c)
IFDOS(` push %rsi ')
mov (up_param), %rax
IFSTD(` mov n_param, n ')
lea (up_param,n_param,8), up
lea -8(rp,n_param,8), rp
neg n
mul v0
test $1, R8(n)
jz L(x0c)
L(x1c): mov %rax, %r11
mov %rdx, %r10
test $2, R8(n)
jnz L(01c)
L(11c): add cin, %r11
dec n
jmp L(L3c)
L(01c): add cin, %r11
inc n
jnz L(L1)
mov %r11, (rp)
mov %rdx, %rax
adc $0, %rax
IFDOS(` pop %rsi ')
ret
L(x0c): mov %rax, %r10
mov %rdx, %r11
test $2, R8(n)
jz L(00c)
L(10c): add $-2, n
add cin, %r10
jmp L(L2c)
L(00c): add cin, %r10
mov 8(up,n,8), %rax
jmp L(L0c)
EPILOGUE()
|
source/amf/mofext/amf-transformations-cmof_to_uml_mof.adb | svn2github/matreshka | 24 | 8101 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Ada Modeling 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 Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with Ada.Wide_Wide_Text_IO;
with AMF.CMOF.Comments.Collections;
with AMF.CMOF.Constraints.Collections;
with AMF.CMOF.Elements.Collections;
with AMF.CMOF.Enumeration_Literals.Collections;
with AMF.CMOF.Named_Elements;
with AMF.CMOF.Namespaces;
with AMF.CMOF.Operations.Collections;
with AMF.CMOF.Packageable_Elements.Collections;
with AMF.CMOF.Parameters.Collections;
with AMF.CMOF.Properties.Collections;
with AMF.CMOF.Typed_Elements;
with AMF.CMOF.Types;
with AMF.CMOF.Value_Specifications;
with AMF.Elements;
with AMF.MOF.Tags;
with AMF.UML.Associations;
with AMF.UML.Classes;
with AMF.UML.Comments.Collections;
with AMF.UML.Constraints.Collections;
with AMF.UML.Elements.Collections;
with AMF.UML.Enumeration_Literals.Collections;
with AMF.UML.Enumerations;
with AMF.UML.Namespaces;
with AMF.UML.Opaque_Expressions;
with AMF.UML.Operations.Collections;
with AMF.UML.Packageable_Elements.Collections;
with AMF.UML.Packages;
with AMF.UML.Parameters.Collections;
with AMF.UML.Primitive_Types;
with AMF.UML.Properties.Collections;
with AMF.UML.Typed_Elements;
with AMF.UML.Types;
with AMF.UML.Value_Specifications;
with AMF.Visitors.CMOF_Containment;
package body AMF.Transformations.CMOF_To_UML_MOF is
procedure Output (Item : Wide_Wide_String);
MOF_URI : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("http://www.omg.org/spec/MOF/20110701");
UML_URI : constant League.Strings.Universal_String
:= League.Strings.To_Universal_String
("http://www.omg.org/spec/UML/20100901");
function To_UML_Visibility_Kind
(Element : not null access constant
AMF.CMOF.Named_Elements.CMOF_Named_Element'Class)
return AMF.UML.Optional_UML_Visibility_Kind;
function To_UML_Parameter_Direction_Kind
(Item : AMF.CMOF.CMOF_Parameter_Direction_Kind)
return AMF.UML.UML_Parameter_Direction_Kind;
procedure Link_Owned_Comment
(Self : in out Second_Pass_Visitor'Class;
Source_Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Target_Element : not null access AMF.UML.Elements.UML_Element'Class);
-- Link elements of CMOF::Element::ownedComment into
-- UML::Element::ownedComment.
procedure Link_Owned_Rule
(Self : in out Second_Pass_Visitor'Class;
Source_Element : not null access AMF.CMOF.Namespaces.CMOF_Namespace'Class;
Target_Element : not null access AMF.UML.Namespaces.UML_Namespace'Class);
-- Link elements of CMOF::Namespace::ownedRule into
-- UML::Namespace::ownedRule.
procedure Link_Type
(Self : in out Second_Pass_Visitor'Class;
Source_Element :
not null access AMF.CMOF.Typed_Elements.CMOF_Typed_Element'Class;
Target_Element :
not null access AMF.UML.Typed_Elements.UML_Typed_Element'Class);
-- Link element of CMOF::TypedElement::type into UML::TypedElement::type.
-----------------------
-- Enter_Association --
-----------------------
overriding procedure Enter_Association
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Associations.CMOF_Association_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Association : constant not null
AMF.UML.Associations.UML_Association_Access
:= Self.Transformer.UML_Factory.Create_Association;
begin
Self.Register (Element, The_UML_Association);
The_UML_Association.Set_Is_Derived (Element.Get_Is_Derived);
The_UML_Association.Set_Name (Element.Get_Name);
The_UML_Association.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Association;
-----------------------
-- Enter_Association --
-----------------------
overriding procedure Enter_Association
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Associations.CMOF_Association_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Association : constant not null
AMF.UML.Associations.UML_Association_Access
:= AMF.UML.Associations.UML_Association_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Association);
-- UML::Association::memberEnd
declare
Source : constant
AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property
:= Element.Get_Member_End;
Target : AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property
:= The_UML_Association.Get_Member_End;
begin
for J in 1 .. Source.Length loop
Target.Add
(AMF.UML.Properties.UML_Property_Access
(Self.Resolve (Source.Element (J))));
end loop;
end;
-- UML::Association::ownedEnd
declare
Source : constant
AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property
:= Element.Get_Owned_End;
Target : AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property
:= The_UML_Association.Get_Owned_End;
begin
for J in 1 .. Source.Length loop
Target.Add
(AMF.UML.Properties.UML_Property_Access
(Self.Resolve (Source.Element (J))));
end loop;
end;
end Enter_Association;
-----------------
-- Enter_Class --
-----------------
overriding procedure Enter_Class
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Classes.CMOF_Class_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Class : constant not null AMF.UML.Classes.UML_Class_Access
:= Self.Transformer.UML_Factory.Create_Class;
begin
Self.Register (Element, The_UML_Class);
The_UML_Class.Set_Is_Abstract (Element.Get_Is_Abstract);
The_UML_Class.Set_Name (Element.Get_Name);
The_UML_Class.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Class;
-----------------
-- Enter_Class --
-----------------
overriding procedure Enter_Class
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Classes.CMOF_Class_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Class : constant not null AMF.UML.Classes.UML_Class_Access
:= AMF.UML.Classes.UML_Class_Access (Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Class);
Self.Link_Owned_Rule (Element, The_UML_Class);
-- UML::Namespace::ownedAttribute
declare
Source : constant
AMF.CMOF.Properties.Collections.Ordered_Set_Of_CMOF_Property
:= Element.Get_Owned_Attribute;
Target : AMF.UML.Properties.Collections.Ordered_Set_Of_UML_Property
:= The_UML_Class.Get_Owned_Attribute;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Properties.UML_Property_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Class::ownedAttribute is not found");
end;
end loop;
end;
-- UML::Class::ownedOperation
declare
Source : constant
AMF.CMOF.Operations.Collections.Ordered_Set_Of_CMOF_Operation
:= Element.Get_Owned_Operation;
Target : AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation
:= The_UML_Class.Get_Owned_Operation;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Operations.UML_Operation_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Class::ownedOperation is not found");
end;
end loop;
end;
end Enter_Class;
-------------------
-- Enter_Comment --
-------------------
overriding procedure Enter_Comment
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Comments.CMOF_Comment_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Comment : constant not null AMF.UML.Comments.UML_Comment_Access
:= Self.Transformer.UML_Factory.Create_Comment;
begin
Self.Register (Element, The_UML_Comment);
The_UML_Comment.Set_Body (Element.Get_Body);
end Enter_Comment;
-------------------
-- Enter_Comment --
-------------------
overriding procedure Enter_Comment
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Comments.CMOF_Comment_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Comment : constant not null AMF.UML.Comments.UML_Comment_Access
:= AMF.UML.Comments.UML_Comment_Access (Self.Resolve (Element));
begin
-- UML::Comment::annotatedElement
declare
Source : constant AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element
:= Element.Get_Annotated_Element;
Target : AMF.UML.Elements.Collections.Set_Of_UML_Element
:= The_UML_Comment.Get_Annotated_Element;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Elements.UML_Element_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Comment::annotatedElement is not found");
end;
end loop;
end;
end Enter_Comment;
----------------------
-- Enter_Constraint --
----------------------
overriding procedure Enter_Constraint
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Constraints.CMOF_Constraint_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Constraint : constant not null
AMF.UML.Constraints.UML_Constraint_Access
:= Self.Transformer.UML_Factory.Create_Constraint;
begin
Self.Register (Element, The_UML_Constraint);
The_UML_Constraint.Set_Name (Element.Get_Name);
The_UML_Constraint.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Constraint;
----------------------
-- Enter_Constraint --
----------------------
overriding procedure Enter_Constraint
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Constraints.CMOF_Constraint_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Constraint : constant not null
AMF.UML.Constraints.UML_Constraint_Access
:= AMF.UML.Constraints.UML_Constraint_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Constraint);
-- UML::Constraint::constrainedElement
declare
Source : constant
AMF.CMOF.Elements.Collections.Ordered_Set_Of_CMOF_Element
:= Element.Get_Constrained_Element;
Target : AMF.UML.Elements.Collections.Ordered_Set_Of_UML_Element
:= The_UML_Constraint.Get_Constrained_Element;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Elements.UML_Element_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Constraint::constrainedElement is not found");
end;
end loop;
end;
-- UML::Constraint::specification
declare
The_Value_Specification : constant
AMF.CMOF.Value_Specifications.CMOF_Value_Specification_Access
:= Element.Get_Specification;
begin
The_UML_Constraint.Set_Specification
(AMF.UML.Value_Specifications.UML_Value_Specification_Access
(Self.Resolve (The_Value_Specification)));
end;
end Enter_Constraint;
---------------------
-- Enter_Data_Type --
---------------------
overriding procedure Enter_Data_Type
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Data_Types.CMOF_Data_Type_Access;
Control : in out AMF.Visitors.Traverse_Control) is
begin
null;
end Enter_Data_Type;
--------------------------
-- Enter_Element_Import --
--------------------------
overriding procedure Enter_Element_Import
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Element_Imports.CMOF_Element_Import_Access;
Control : in out AMF.Visitors.Traverse_Control) is
begin
null;
end Enter_Element_Import;
-----------------------
-- Enter_Enumeration --
-----------------------
overriding procedure Enter_Enumeration
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Enumerations.CMOF_Enumeration_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Enumeration : constant not null
AMF.UML.Enumerations.UML_Enumeration_Access
:= Self.Transformer.UML_Factory.Create_Enumeration;
begin
Self.Register (Element, The_UML_Enumeration);
The_UML_Enumeration.Set_Name (Element.Get_Name);
The_UML_Enumeration.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Enumeration;
-----------------------
-- Enter_Enumeration --
-----------------------
overriding procedure Enter_Enumeration
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Enumerations.CMOF_Enumeration_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Enumeration : constant not null
AMF.UML.Enumerations.UML_Enumeration_Access
:= AMF.UML.Enumerations.UML_Enumeration_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Enumeration);
Self.Link_Owned_Rule (Element, The_UML_Enumeration);
-- UML::Enumeration::ownedEnumeration_Literal
declare
Source : constant
AMF.CMOF.Enumeration_Literals.Collections.Ordered_Set_Of_CMOF_Enumeration_Literal
:= Element.Get_Owned_Literal;
Target : AMF.UML.Enumeration_Literals.Collections.Ordered_Set_Of_UML_Enumeration_Literal
:= The_UML_Enumeration.Get_Owned_Literal;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Enumeration::ownedEnumeration_Literal is not found");
end;
end loop;
end;
-- UML::Enumeration::ownedOperation
declare
Source : constant
AMF.CMOF.Operations.Collections.Ordered_Set_Of_CMOF_Operation
:= Element.Get_Owned_Operation;
Target : AMF.UML.Operations.Collections.Ordered_Set_Of_UML_Operation
:= The_UML_Enumeration.Get_Owned_Operation;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Operations.UML_Operation_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Enumeration::ownedOperation is not found");
end;
end loop;
end;
end Enter_Enumeration;
-------------------------------
-- Enter_Enumeration_Literal --
-------------------------------
overriding procedure Enter_Enumeration_Literal
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Enumeration_Literal : constant not null
AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access
:= Self.Transformer.UML_Factory.Create_Enumeration_Literal;
begin
Self.Register (Element, The_UML_Enumeration_Literal);
The_UML_Enumeration_Literal.Set_Name (Element.Get_Name);
-- The_UML_Enumeration_Literal.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Enumeration_Literal;
-------------------------------
-- Enter_Enumeration_Literal --
-------------------------------
overriding procedure Enter_Enumeration_Literal
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Enumeration_Literals.CMOF_Enumeration_Literal_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Enumeration_Literal : constant not null
AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access
:= AMF.UML.Enumeration_Literals.UML_Enumeration_Literal_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Enumeration_Literal);
end Enter_Enumeration_Literal;
----------------------
-- Enter_Expression --
----------------------
overriding procedure Enter_Expression
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Expressions.CMOF_Expression_Access;
Control : in out AMF.Visitors.Traverse_Control) is
begin
null;
end Enter_Expression;
-----------------------------
-- Enter_Opaque_Expression --
-----------------------------
overriding procedure Enter_Opaque_Expression
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Opaque_Expression : constant not null
AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access
:= Self.Transformer.UML_Factory.Create_Opaque_Expression;
begin
Self.Register (Element, The_UML_Opaque_Expression);
The_UML_Opaque_Expression.Set_Name (Element.Get_Name);
The_UML_Opaque_Expression.Set_Visibility
(To_UML_Visibility_Kind (Element));
-- XXX UML::OpaqueExpression::body
-- XXX UML::OpaqueExpression::language
end Enter_Opaque_Expression;
-----------------------------
-- Enter_Opaque_Expression --
-----------------------------
overriding procedure Enter_Opaque_Expression
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Opaque_Expressions.CMOF_Opaque_Expression_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Opaque_Expression : constant not null
AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access
:= AMF.UML.Opaque_Expressions.UML_Opaque_Expression_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Opaque_Expression);
end Enter_Opaque_Expression;
---------------------
-- Enter_Operation --
---------------------
overriding procedure Enter_Operation
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Operations.CMOF_Operation_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Operation : constant not null
AMF.UML.Operations.UML_Operation_Access
:= Self.Transformer.UML_Factory.Create_Operation;
begin
Self.Register (Element, The_UML_Operation);
The_UML_Operation.Set_Is_Query (Element.Get_Is_Query);
The_UML_Operation.Set_Name (Element.Get_Name);
The_UML_Operation.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Operation;
---------------------
-- Enter_Operation --
---------------------
overriding procedure Enter_Operation
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Operations.CMOF_Operation_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Operation : constant not null
AMF.UML.Operations.UML_Operation_Access
:= AMF.UML.Operations.UML_Operation_Access (Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Operation);
Self.Link_Owned_Rule (Element, The_UML_Operation);
-- UML::Operation::bodyCondition
declare
-- The_Constraint : constant not null
-- XXX GNAT GCC 4.7.0 crash when null exclusion is applied.
The_Constraint : constant
AMF.CMOF.Constraints.CMOF_Constraint_Access
:= Element.Get_Body_Condition;
begin
begin
The_UML_Operation.Set_Body_Condition
(AMF.UML.Constraints.UML_Constraint_Access
(Self.Resolve (The_Constraint)));
exception
when Constraint_Error =>
Output ("UML::Operation::bodyCondition is unknown");
end;
end;
-- UML::Operation::redefinedOperation
declare
Source : constant
AMF.CMOF.Operations.Collections.Set_Of_CMOF_Operation
:= Element.Get_Redefined_Operation;
Target : AMF.UML.Operations.Collections.Set_Of_UML_Operation
:= The_UML_Operation.Get_Redefined_Operation;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Operations.UML_Operation_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Operation::redefinedOperation is not found");
end;
end loop;
end;
-- UML::Operation::ownedParameter
declare
Source : constant
AMF.CMOF.Parameters.Collections.Ordered_Set_Of_CMOF_Parameter
:= Element.Get_Owned_Parameter;
Target : AMF.UML.Parameters.Collections.Ordered_Set_Of_UML_Parameter
:= The_UML_Operation.Get_Owned_Parameter;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Parameters.UML_Parameter_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Operation::ownedParameter is not found");
end;
end loop;
end;
end Enter_Operation;
-------------------
-- Enter_Package --
-------------------
overriding procedure Enter_Package
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Packages.CMOF_Package_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Package : constant not null AMF.UML.Packages.UML_Package_Access
:= Self.Transformer.UML_Factory.Create_Package;
begin
Self.Register (Element, The_UML_Package);
The_UML_Package.Set_Name (Element.Get_Name);
The_UML_Package.Set_URI (Element.Get_URI);
The_UML_Package.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Package;
-------------------
-- Enter_Package --
-------------------
overriding procedure Enter_Package
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Packages.CMOF_Package_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Package : constant not null AMF.UML.Packages.UML_Package_Access
:= AMF.UML.Packages.UML_Package_Access (Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Package);
-- UML::Package::packagedElement
declare
Source : constant
AMF.CMOF.Packageable_Elements.Collections.Set_Of_CMOF_Packageable_Element
:= Element.Get_Packaged_Element;
Target :
AMF.UML.Packageable_Elements.Collections.Set_Of_UML_Packageable_Element
:= The_UML_Package.Get_Packaged_Element;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Packageable_Elements.UML_Packageable_Element_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("Package::packagedElement is unknown");
end;
end loop;
end;
end Enter_Package;
--------------------------
-- Enter_Package_Import --
--------------------------
overriding procedure Enter_Package_Import
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Package_Imports.CMOF_Package_Import_Access;
Control : in out AMF.Visitors.Traverse_Control) is
begin
null;
end Enter_Package_Import;
-------------------------
-- Enter_Package_Merge --
-------------------------
overriding procedure Enter_Package_Merge
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Package_Merges.CMOF_Package_Merge_Access;
Control : in out AMF.Visitors.Traverse_Control) is
begin
null;
end Enter_Package_Merge;
---------------------
-- Enter_Parameter --
---------------------
overriding procedure Enter_Parameter
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Parameters.CMOF_Parameter_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Parameter : constant not null
AMF.UML.Parameters.UML_Parameter_Access
:= Self.Transformer.UML_Factory.Create_Parameter;
begin
Self.Register (Element, The_UML_Parameter);
The_UML_Parameter.Set_Direction
(To_UML_Parameter_Direction_Kind (Element.Get_Direction));
The_UML_Parameter.Set_Name (Element.Get_Name);
The_UML_Parameter.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Parameter;
---------------------
-- Enter_Parameter --
---------------------
overriding procedure Enter_Parameter
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Parameters.CMOF_Parameter_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Parameter : constant not null
AMF.UML.Parameters.UML_Parameter_Access
:= AMF.UML.Parameters.UML_Parameter_Access (Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Parameter);
Self.Link_Type (Element, The_UML_Parameter);
end Enter_Parameter;
--------------------------
-- Enter_Primitive_Type --
--------------------------
overriding procedure Enter_Primitive_Type
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Primitive_Type : constant not null
AMF.UML.Primitive_Types.UML_Primitive_Type_Access
:= Self.Transformer.UML_Factory.Create_Primitive_Type;
begin
Self.Register (Element, The_UML_Primitive_Type);
The_UML_Primitive_Type.Set_Name (Element.Get_Name);
The_UML_Primitive_Type.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Primitive_Type;
--------------------------
-- Enter_Primitive_Type --
--------------------------
overriding procedure Enter_Primitive_Type
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Primitive_Types.CMOF_Primitive_Type_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Primitive_Type : constant not null
AMF.UML.Primitive_Types.UML_Primitive_Type_Access
:= AMF.UML.Primitive_Types.UML_Primitive_Type_Access
(Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Primitive_Type);
end Enter_Primitive_Type;
--------------------
-- Enter_Property --
--------------------
overriding procedure Enter_Property
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Properties.CMOF_Property_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Property : constant not null
AMF.UML.Properties.UML_Property_Access
:= Self.Transformer.UML_Factory.Create_Property;
begin
Self.Register (Element, The_UML_Property);
The_UML_Property.Set_Is_Composite (Element.Get_Is_Composite);
-- The_UML_Property.Set_Is_ID (Element.Get_Is_ID);
The_UML_Property.Set_Is_Derived (Element.Get_Is_Derived);
The_UML_Property.Set_Is_Derived_Union (Element.Get_Is_Derived_Union);
The_UML_Property.Set_Is_Read_Only (Element.Get_Is_Read_Only);
The_UML_Property.Set_Lower (Element.Get_Lower);
The_UML_Property.Set_Name (Element.Get_Name);
The_UML_Property.Set_Upper (Element.Get_Upper);
The_UML_Property.Set_Visibility (To_UML_Visibility_Kind (Element));
end Enter_Property;
--------------------
-- Enter_Property --
--------------------
overriding procedure Enter_Property
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Properties.CMOF_Property_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_UML_Property : constant not null
AMF.UML.Properties.UML_Property_Access
:= AMF.UML.Properties.UML_Property_Access (Self.Resolve (Element));
begin
Self.Link_Owned_Comment (Element, The_UML_Property);
Self.Link_Type (Element, The_UML_Property);
-- UML::Property::association is handled at opposite end as
-- UML::Association::memberEnd.
-- UML::Property::subsettedProperty
declare
Source : constant AMF.CMOF.Properties.Collections.Set_Of_CMOF_Property
:= Element.Get_Subsetted_Property;
Target : AMF.UML.Properties.Collections.Set_Of_UML_Property
:= The_UML_Property.Get_Subsetted_Property;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Properties.UML_Property_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Property::subsettedProperty is unknown");
end;
end loop;
end;
-- UML::Property::redefinedProperty
declare
Source : constant AMF.CMOF.Properties.Collections.Set_Of_CMOF_Property
:= Element.Get_Redefined_Property;
Target : AMF.UML.Properties.Collections.Set_Of_UML_Property
:= The_UML_Property.Get_Redefined_Property;
begin
for J in 1 .. Source.Length loop
begin
Target.Add
(AMF.UML.Properties.UML_Property_Access
(Self.Resolve (Source.Element (J))));
exception
when Constraint_Error =>
Output ("UML::Property::redefinedProperty is unknown");
end;
end loop;
end;
end Enter_Property;
---------------
-- Enter_Tag --
---------------
overriding procedure Enter_Tag
(Self : in out First_Pass_Visitor;
Element : not null AMF.CMOF.Tags.CMOF_Tag_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_MOF_Tag : constant not null AMF.MOF.Tags.MOF_Tag_Access
:= Self.Transformer.MOF_Factory.Create_Tag;
begin
Self.Register (Element, The_MOF_Tag);
The_MOF_Tag.Set_Name (Element.Get_Name);
The_MOF_Tag.Set_Value (Element.Get_Value);
end Enter_Tag;
---------------
-- Enter_Tag --
---------------
overriding procedure Enter_Tag
(Self : in out Second_Pass_Visitor;
Element : not null AMF.CMOF.Tags.CMOF_Tag_Access;
Control : in out AMF.Visitors.Traverse_Control)
is
pragma Unreferenced (Control);
The_MOF_Tag : constant not null AMF.MOF.Tags.MOF_Tag_Access
:= AMF.MOF.Tags.MOF_Tag_Access (Self.Resolve (Element));
begin
-- CMOF::Tag::element
declare
Source : constant AMF.CMOF.Elements.Collections.Set_Of_CMOF_Element
:= Element.Get_Element;
Target : AMF.UML.Elements.Collections.Set_Of_UML_Element
:= The_MOF_Tag.Get_Element;
begin
for J in 1 .. Source.Length loop
Target.Add
(AMF.UML.Elements.UML_Element_Access
(Self.Resolve (Source.Element (J))));
end loop;
end;
end Enter_Tag;
----------------
-- Initialize --
----------------
procedure Initialize
(Self : not null access CMOF_To_UML_MOF_Transformer'Class;
Source : not null AMF.URI_Stores.URI_Store_Access;
Target : not null AMF.URI_Stores.URI_Store_Access) is
begin
Self.Source := Source;
Self.Target := Target;
Self.MOF_Factory :=
AMF.Factories.MOF_Factories.MOF_Factory_Access
(Self.Target.Get_Factory (MOF_URI));
Self.UML_Factory :=
AMF.Factories.UML_Factories.UML_Factory_Access
(Self.Target.Get_Factory (UML_URI));
end Initialize;
------------------------
-- Link_Owned_Comment --
------------------------
procedure Link_Owned_Comment
(Self : in out Second_Pass_Visitor'Class;
Source_Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
Target_Element : not null access AMF.UML.Elements.UML_Element'Class)
is
Source : constant AMF.CMOF.Comments.Collections.Set_Of_CMOF_Comment
:= Source_Element.Get_Owned_Comment;
Target : AMF.UML.Comments.Collections.Set_Of_UML_Comment
:= Target_Element.Get_Owned_Comment;
begin
for J in 1 .. Source.Length loop
Target.Add
(AMF.UML.Comments.UML_Comment_Access
(Self.Resolve (Source.Element (J))));
end loop;
end Link_Owned_Comment;
---------------------
-- Link_Owned_Rule --
---------------------
procedure Link_Owned_Rule
(Self : in out Second_Pass_Visitor'Class;
Source_Element : not null access AMF.CMOF.Namespaces.CMOF_Namespace'Class;
Target_Element : not null access AMF.UML.Namespaces.UML_Namespace'Class)
is
Source : constant AMF.CMOF.Constraints.Collections.Set_Of_CMOF_Constraint
:= Source_Element.Get_Owned_Rule;
Target : AMF.UML.Constraints.Collections.Set_Of_UML_Constraint
:= Target_Element.Get_Owned_Rule;
begin
for J in 1 .. Source.Length loop
Target.Add
(AMF.UML.Constraints.UML_Constraint_Access
(Self.Resolve (Source.Element (J))));
end loop;
end Link_Owned_Rule;
---------------
-- Link_Type --
---------------
procedure Link_Type
(Self : in out Second_Pass_Visitor'Class;
Source_Element : not null access AMF.CMOF.Typed_Elements.CMOF_Typed_Element'Class;
Target_Element : not null access AMF.UML.Typed_Elements.UML_Typed_Element'Class)
is
-- The_Type : constant not null AMF.CMOF.Types.CMOF_Type_Access
-- XXX GNAT GCC 4.7.0 crash when null exclusion is applied.
The_Type : constant AMF.CMOF.Types.CMOF_Type_Access
:= Source_Element.Get_Type;
begin
Target_Element.Set_Type
(AMF.UML.Types.UML_Type_Access (Self.Resolve (The_Type)));
end Link_Type;
------------
-- Output --
------------
procedure Output (Item : Wide_Wide_String) is
begin
Ada.Wide_Wide_Text_IO.Put_Line
(Ada.Wide_Wide_Text_IO.Standard_Error, Item);
end Output;
--------------
-- Register --
--------------
procedure Register
(Self : in out First_Pass_Visitor'Class;
CMOF_Element : not null access AMF.CMOF.Elements.CMOF_Element'Class;
UML_Element : not null access AMF.UML.Elements.UML_Element'Class) is
begin
Self.Transformer.To_UML_Element.Insert
(AMF.CMOF.Elements.CMOF_Element_Access (CMOF_Element),
AMF.UML.Elements.UML_Element_Access (UML_Element));
Self.Transformer.Target.Set_Id
(AMF.Elements.Element_Access (UML_Element),
Self.Transformer.Source.Get_Id
(AMF.Elements.Element_Access (CMOF_Element)));
end Register;
-------------
-- Resolve --
-------------
function Resolve
(Self : in out Second_Pass_Visitor'Class;
Element : not null access AMF.CMOF.Elements.CMOF_Element'Class)
return not null AMF.UML.Elements.UML_Element_Access is
begin
return
Self.Transformer.To_UML_Element.Element
(AMF.CMOF.Elements.CMOF_Element_Access (Element));
end Resolve;
-------------------------------------
-- To_UML_Parameter_Direction_Kind --
-------------------------------------
function To_UML_Parameter_Direction_Kind
(Item : AMF.CMOF.CMOF_Parameter_Direction_Kind)
return AMF.UML.UML_Parameter_Direction_Kind is
begin
case Item is
when AMF.CMOF.In_Parameter =>
return AMF.UML.In_Parameter;
when AMF.CMOF.Out_Parameter =>
return AMF.UML.Out_Parameter;
when AMF.CMOF.In_Out_Parameter =>
return AMF.UML.In_Out_Parameter;
when AMF.CMOF.Return_Parameter =>
return AMF.UML.Return_Parameter;
end case;
end To_UML_Parameter_Direction_Kind;
----------------------------
-- To_UML_Visibility_Kind --
----------------------------
function To_UML_Visibility_Kind
(Element : not null access constant
AMF.CMOF.Named_Elements.CMOF_Named_Element'Class)
return AMF.UML.Optional_UML_Visibility_Kind
is
Aux : constant AMF.CMOF.Optional_CMOF_Visibility_Kind
:= Element.Get_Visibility;
begin
if Aux.Is_Empty then
if Element.all
in AMF.CMOF.Packageable_Elements.CMOF_Packageable_Element'Class
then
-- UML::PackageableElement can't have undefined visibility. CMOF
-- specification constraints visibility to be 'public', so we
-- enforce this constraint here.
return (False, AMF.UML.Public_Visibility);
else
return (Is_Empty => True);
end if;
else
case Aux.Value is
when AMF.CMOF.Public_Visibility =>
return (False, AMF.UML.Public_Visibility);
when AMF.CMOF.Private_Visibility =>
return (False, AMF.UML.Private_Visibility);
when AMF.CMOF.Protected_Visibility =>
return (False, AMF.UML.Protected_Visibility);
when AMF.CMOF.Package_Visibility =>
return (False, AMF.UML.Package_Visibility);
end case;
end if;
end To_UML_Visibility_Kind;
---------------
-- Transform --
---------------
procedure Transform
(Source : not null AMF.URI_Stores.URI_Store_Access;
Target : not null AMF.URI_Stores.URI_Store_Access)
is
Transformer : aliased CMOF_To_UML_MOF_Transformer;
Iterator : AMF.Visitors.CMOF_Containment.CMOF_Containment_Iterator;
First_Pass : First_Pass_Visitor (Transformer'Access);
Second_Pass : Second_Pass_Visitor (Transformer'Access);
begin
Initialize (Transformer'Access, Source, Target);
Iterator.Visit (First_Pass, Source);
Iterator.Visit (Second_Pass, Source);
end Transform;
end AMF.Transformations.CMOF_To_UML_MOF;
|
prototyping/Luau/Type.agda | MeltzDev/luau | 0 | 10149 | <gh_stars>0
module Luau.Type where
open import FFI.Data.Maybe using (Maybe; just; nothing; just-inv)
open import Agda.Builtin.Equality using (_≡_; refl)
open import Properties.Dec using (Dec; yes; no)
open import Properties.Equality using (cong)
open import FFI.Data.Maybe using (Maybe; just; nothing)
data Type : Set where
nil : Type
_⇒_ : Type → Type → Type
never : Type
unknown : Type
boolean : Type
number : Type
string : Type
_∪_ : Type → Type → Type
_∩_ : Type → Type → Type
data Scalar : Type → Set where
number : Scalar number
boolean : Scalar boolean
string : Scalar string
nil : Scalar nil
lhs : Type → Type
lhs (T ⇒ _) = T
lhs (T ∪ _) = T
lhs (T ∩ _) = T
lhs nil = nil
lhs never = never
lhs unknown = unknown
lhs number = number
lhs boolean = boolean
lhs string = string
rhs : Type → Type
rhs (_ ⇒ T) = T
rhs (_ ∪ T) = T
rhs (_ ∩ T) = T
rhs nil = nil
rhs never = never
rhs unknown = unknown
rhs number = number
rhs boolean = boolean
rhs string = string
_≡ᵀ_ : ∀ (T U : Type) → Dec(T ≡ U)
nil ≡ᵀ nil = yes refl
nil ≡ᵀ (S ⇒ T) = no (λ ())
nil ≡ᵀ never = no (λ ())
nil ≡ᵀ unknown = no (λ ())
nil ≡ᵀ number = no (λ ())
nil ≡ᵀ boolean = no (λ ())
nil ≡ᵀ (S ∪ T) = no (λ ())
nil ≡ᵀ (S ∩ T) = no (λ ())
nil ≡ᵀ string = no (λ ())
(S ⇒ T) ≡ᵀ string = no (λ ())
never ≡ᵀ string = no (λ ())
unknown ≡ᵀ string = no (λ ())
boolean ≡ᵀ string = no (λ ())
number ≡ᵀ string = no (λ ())
(S ∪ T) ≡ᵀ string = no (λ ())
(S ∩ T) ≡ᵀ string = no (λ ())
(S ⇒ T) ≡ᵀ nil = no (λ ())
(S ⇒ T) ≡ᵀ (U ⇒ V) with (S ≡ᵀ U) | (T ≡ᵀ V)
(S ⇒ T) ≡ᵀ (S ⇒ T) | yes refl | yes refl = yes refl
(S ⇒ T) ≡ᵀ (U ⇒ V) | _ | no p = no (λ q → p (cong rhs q))
(S ⇒ T) ≡ᵀ (U ⇒ V) | no p | _ = no (λ q → p (cong lhs q))
(S ⇒ T) ≡ᵀ never = no (λ ())
(S ⇒ T) ≡ᵀ unknown = no (λ ())
(S ⇒ T) ≡ᵀ number = no (λ ())
(S ⇒ T) ≡ᵀ boolean = no (λ ())
(S ⇒ T) ≡ᵀ (U ∪ V) = no (λ ())
(S ⇒ T) ≡ᵀ (U ∩ V) = no (λ ())
never ≡ᵀ nil = no (λ ())
never ≡ᵀ (U ⇒ V) = no (λ ())
never ≡ᵀ never = yes refl
never ≡ᵀ unknown = no (λ ())
never ≡ᵀ number = no (λ ())
never ≡ᵀ boolean = no (λ ())
never ≡ᵀ (U ∪ V) = no (λ ())
never ≡ᵀ (U ∩ V) = no (λ ())
unknown ≡ᵀ nil = no (λ ())
unknown ≡ᵀ (U ⇒ V) = no (λ ())
unknown ≡ᵀ never = no (λ ())
unknown ≡ᵀ unknown = yes refl
unknown ≡ᵀ number = no (λ ())
unknown ≡ᵀ boolean = no (λ ())
unknown ≡ᵀ (U ∪ V) = no (λ ())
unknown ≡ᵀ (U ∩ V) = no (λ ())
number ≡ᵀ nil = no (λ ())
number ≡ᵀ (T ⇒ U) = no (λ ())
number ≡ᵀ never = no (λ ())
number ≡ᵀ unknown = no (λ ())
number ≡ᵀ number = yes refl
number ≡ᵀ boolean = no (λ ())
number ≡ᵀ (T ∪ U) = no (λ ())
number ≡ᵀ (T ∩ U) = no (λ ())
boolean ≡ᵀ nil = no (λ ())
boolean ≡ᵀ (T ⇒ U) = no (λ ())
boolean ≡ᵀ never = no (λ ())
boolean ≡ᵀ unknown = no (λ ())
boolean ≡ᵀ boolean = yes refl
boolean ≡ᵀ number = no (λ ())
boolean ≡ᵀ (T ∪ U) = no (λ ())
boolean ≡ᵀ (T ∩ U) = no (λ ())
string ≡ᵀ nil = no (λ ())
string ≡ᵀ (x ⇒ x₁) = no (λ ())
string ≡ᵀ never = no (λ ())
string ≡ᵀ unknown = no (λ ())
string ≡ᵀ boolean = no (λ ())
string ≡ᵀ number = no (λ ())
string ≡ᵀ string = yes refl
string ≡ᵀ (U ∪ V) = no (λ ())
string ≡ᵀ (U ∩ V) = no (λ ())
(S ∪ T) ≡ᵀ nil = no (λ ())
(S ∪ T) ≡ᵀ (U ⇒ V) = no (λ ())
(S ∪ T) ≡ᵀ never = no (λ ())
(S ∪ T) ≡ᵀ unknown = no (λ ())
(S ∪ T) ≡ᵀ number = no (λ ())
(S ∪ T) ≡ᵀ boolean = no (λ ())
(S ∪ T) ≡ᵀ (U ∪ V) with (S ≡ᵀ U) | (T ≡ᵀ V)
(S ∪ T) ≡ᵀ (S ∪ T) | yes refl | yes refl = yes refl
(S ∪ T) ≡ᵀ (U ∪ V) | _ | no p = no (λ q → p (cong rhs q))
(S ∪ T) ≡ᵀ (U ∪ V) | no p | _ = no (λ q → p (cong lhs q))
(S ∪ T) ≡ᵀ (U ∩ V) = no (λ ())
(S ∩ T) ≡ᵀ nil = no (λ ())
(S ∩ T) ≡ᵀ (U ⇒ V) = no (λ ())
(S ∩ T) ≡ᵀ never = no (λ ())
(S ∩ T) ≡ᵀ unknown = no (λ ())
(S ∩ T) ≡ᵀ number = no (λ ())
(S ∩ T) ≡ᵀ boolean = no (λ ())
(S ∩ T) ≡ᵀ (U ∪ V) = no (λ ())
(S ∩ T) ≡ᵀ (U ∩ V) with (S ≡ᵀ U) | (T ≡ᵀ V)
(S ∩ T) ≡ᵀ (U ∩ V) | yes refl | yes refl = yes refl
(S ∩ T) ≡ᵀ (U ∩ V) | _ | no p = no (λ q → p (cong rhs q))
(S ∩ T) ≡ᵀ (U ∩ V) | no p | _ = no (λ q → p (cong lhs q))
_≡ᴹᵀ_ : ∀ (T U : Maybe Type) → Dec(T ≡ U)
nothing ≡ᴹᵀ nothing = yes refl
nothing ≡ᴹᵀ just U = no (λ ())
just T ≡ᴹᵀ nothing = no (λ ())
just T ≡ᴹᵀ just U with T ≡ᵀ U
(just T ≡ᴹᵀ just T) | yes refl = yes refl
(just T ≡ᴹᵀ just U) | no p = no (λ q → p (just-inv q))
src : Type → Type
src nil = never
src number = never
src boolean = never
src string = never
src (S ⇒ T) = S
src (S ∪ T) = (src S) ∩ (src T)
src (S ∩ T) = (src S) ∪ (src T)
src never = unknown
src unknown = never
tgt : Type → Type
tgt nil = never
tgt (S ⇒ T) = T
tgt never = never
tgt unknown = unknown
tgt number = never
tgt boolean = never
tgt string = never
tgt (S ∪ T) = (tgt S) ∪ (tgt T)
tgt (S ∩ T) = (tgt S) ∩ (tgt T)
optional : Type → Type
optional nil = nil
optional (T ∪ nil) = (T ∪ nil)
optional T = (T ∪ nil)
normalizeOptional : Type → Type
normalizeOptional (S ∪ T) with normalizeOptional S | normalizeOptional T
normalizeOptional (S ∪ T) | (S′ ∪ nil) | (T′ ∪ nil) = (S′ ∪ T′) ∪ nil
normalizeOptional (S ∪ T) | S′ | (T′ ∪ nil) = (S′ ∪ T′) ∪ nil
normalizeOptional (S ∪ T) | (S′ ∪ nil) | T′ = (S′ ∪ T′) ∪ nil
normalizeOptional (S ∪ T) | S′ | nil = optional S′
normalizeOptional (S ∪ T) | nil | T′ = optional T′
normalizeOptional (S ∪ T) | S′ | T′ = S′ ∪ T′
normalizeOptional T = T
|
programs/oeis/016/A016958.asm | karttu/loda | 1 | 172470 | ; A016958: a(n) = (6n + 4)^2.
; 16,100,256,484,784,1156,1600,2116,2704,3364,4096,4900,5776,6724,7744,8836,10000,11236,12544,13924,15376,16900,18496,20164,21904,23716,25600,27556,29584,31684,33856,36100,38416,40804,43264,45796,48400,51076,53824,56644,59536,62500,65536,68644,71824,75076,78400,81796,85264,88804,92416,96100,99856,103684,107584,111556,115600,119716,123904,128164,132496,136900,141376,145924,150544,155236,160000,164836,169744,174724,179776,184900,190096,195364,200704,206116,211600,217156,222784,228484,234256,240100,246016,252004,258064,264196,270400,276676,283024,289444,295936,302500,309136,315844,322624,329476,336400,343396,350464,357604,364816,372100,379456,386884,394384,401956,409600,417316,425104,432964,440896,448900,456976,465124,473344,481636,490000,498436,506944,515524,524176,532900,541696,550564,559504,568516,577600,586756,595984,605284,614656,624100,633616,643204,652864,662596,672400,682276,692224,702244,712336,722500,732736,743044,753424,763876,774400,784996,795664,806404,817216,828100,839056,850084,861184,872356,883600,894916,906304,917764,929296,940900,952576,964324,976144,988036,1000000,1012036,1024144,1036324,1048576,1060900,1073296,1085764,1098304,1110916,1123600,1136356,1149184,1162084,1175056,1188100,1201216,1214404,1227664,1240996,1254400,1267876,1281424,1295044,1308736,1322500,1336336,1350244,1364224,1378276,1392400,1406596,1420864,1435204,1449616,1464100,1478656,1493284,1507984,1522756,1537600,1552516,1567504,1582564,1597696,1612900,1628176,1643524,1658944,1674436,1690000,1705636,1721344,1737124,1752976,1768900,1784896,1800964,1817104,1833316,1849600,1865956,1882384,1898884,1915456,1932100,1948816,1965604,1982464,1999396,2016400,2033476,2050624,2067844,2085136,2102500,2119936,2137444,2155024,2172676,2190400,2208196,2226064,2244004
mul $0,6
mov $1,$0
add $1,4
pow $1,2
|
programs/oeis/238/A238340.asm | karttu/loda | 0 | 20134 | ; A238340: Number of partitions of 4n into 4 parts.
; 1,5,15,34,64,108,169,249,351,478,632,816,1033,1285,1575,1906,2280,2700,3169,3689,4263,4894,5584,6336,7153,8037,8991,10018,11120,12300,13561,14905,16335,17854,19464,21168,22969,24869,26871,28978,31192,33516,35953,38505,41175,43966,46880,49920,53089,56389,59823,63394,67104,70956,74953,79097,83391,87838,92440,97200,102121,107205,112455,117874,123464,129228,135169,141289,147591,154078,160752,167616,174673,181925,189375,197026,204880,212940,221209,229689,238383,247294,256424,265776,275353,285157,295191,305458,315960,326700,337681,348905,360375,372094,384064,396288,408769,421509,434511,447778,461312,475116,489193,503545,518175,533086,548280,563760,579529,595589,611943,628594,645544,662796,680353,698217,716391,734878,753680,772800,792241,812005,832095,852514,873264,894348,915769,937529,959631,982078,1004872,1028016,1051513,1075365,1099575,1124146,1149080,1174380,1200049,1226089,1252503,1279294,1306464,1334016,1361953,1390277,1418991,1448098,1477600,1507500,1537801,1568505,1599615,1631134,1663064,1695408,1728169,1761349,1794951,1828978,1863432,1898316,1933633,1969385,2005575,2042206,2079280,2116800,2154769,2193189,2232063,2271394,2311184,2351436,2392153,2433337,2474991,2517118,2559720,2602800,2646361,2690405,2734935,2779954,2825464,2871468,2917969,2964969,3012471,3060478,3108992,3158016,3207553,3257605,3308175,3359266,3410880,3463020,3515689,3568889,3622623,3676894,3731704,3787056,3842953,3899397,3956391,4013938,4072040,4130700,4189921,4249705,4310055,4370974,4432464,4494528,4557169,4620389,4684191,4748578,4813552,4879116,4945273,5012025,5079375,5147326,5215880,5285040,5354809,5425189,5496183,5567794,5640024,5712876,5786353,5860457,5935191,6010558,6086560,6163200,6240481,6318405,6396975,6476194,6556064,6636588,6717769,6799609,6882111,6965278
mov $14,$0
mov $16,$0
add $16,1
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $11,$0
mov $13,$0
add $13,1
lpb $13,1
mov $0,$11
sub $13,1
sub $0,$13
mov $6,$0
mul $6,8
add $6,3
div $6,3
add $12,$6
lpe
add $15,$12
lpe
mov $1,$15
|
mc-sema/validator/x86/tests/MULSSrr.asm | randolphwong/mcsema | 2 | 101586 | BITS 32
;TEST_FILE_META_BEGIN
;TEST_TYPE=TEST_F
;TEST_IGNOREFLAGS=
;TEST_FILE_META_END
; convert 5 to a double precision float and store in xmm0
mov ecx, 5
cvtsi2ss xmm0, ecx
; convert 11 to a double precision float and store in xmm1
mov ecx, 11
cvtsi2ss xmm1, ecx
;TEST_BEGIN_RECORDING
mulss xmm0, xmm1
;TEST_END_RECORDING
xor ecx, ecx
cvtsi2sd xmm0, ecx
cvtsi2sd xmm1, ecx
|
src/main/antlr4/com/sri/ai/grinder/parser/antlr/AntlrGrinder.g4 | ctjoreilly/aic-expresso | 8 | 6103 | <gh_stars>1-10
grammar AntlrGrinder;
expression : expr ;
expr :
// parenthesis, e.g.:(1+2)
'(' expr ')' #parenthesesAroundExpression
// an expression symbol, e.g.:<X + Y>
| '<' expr '>' #expressionSymbol
// function application, e.g.: f(X)
| functor=expr '(' ( args+=expr (',' args+=expr)* )? ')' # functionApplication
// tuple, e.g.: (A, B, C)
| '(' expr ',' expr (',' expr)* ')' #tuple
// counting formula, e.g.: | X in 1..10 : X < 5 |
| '|' ( indexes+=expr (',' indexes+=expr)* )? ':' body=expr '|' #countingFormula
// cardinality, e.g.: | X |
| '|' expr '|' #cardinality
// intensional uniset, e.g.: { (on X) f(X) | X != a }
| '{' ('(' scope=ON ( scopeargs+=expr (',' scopeargs+=expr)* )? ')')? head=expr (':' condition=expr)? '}' #intensionalUniset
// intensional multiset, e.g.: {{ (on X) f(X) | X != a }}
| '{{' ('(' scope=ON ( scopeargs+=expr (',' scopeargs+=expr)* )? ')')? head=expr (':' condition=expr)? '}}' #intensionalMultiset
// extensional uniset, e.g.: { A, B, C, C, D }
| '{' ( expr (',' expr)* )? '}' #extensionalUniset
// extensional multiset, e.g.: {{ A, B, C, C, D }}
| '{{' ( expr (',' expr)* )? '}}' #extensionalMultiset
// bracketed expression, for parfactors and random variables, e.g. [if p(X) then 1 else 2]
| '[' expr ']' #bracketedExpression
// not, e.g.: not A and B -> (not(A)) and B
| NOT expr #not
// negative, e.g.: 2 * -1 -> 2 * (-1)
| '-' expr #negative // We set the unary minus to higher precedence
// NOTE: P)arentheses, E)xponents, ( M)ultiplication, D)ivision and special case of Integer Interval '..' ), ( A)ddition, S)ubtraction )
// see: http://en.wikipedia.org/wiki/Order_of_operations
// exponentiation, e.g. 2^3^4 -> 2^(3^4)
|<assoc=right> base=expr '^' exponent=expr #Exponentiation
// multiplication or division or an Integer Interval, e.g.: 2*3/2 -> 2*(3/2)
| leftop=expr op=('*' | '/' | '..') rightop=expr #multiplicationOrDivisionOrIntegerInterval
// addition or subtraction, e.g.: 1-2+3 -> (1-2)+3
| leftop=expr op=('+' | '-') rightop=expr #additionOrSubtraction
// real interval
| leftBracket=('[' | ']') lower=expr SEMICOLON upper=expr rightBracket=(']' | '[') #realInterval
// set intersection, e.g.: {a, b, c} intersection {b}
| leftop=expr INTERSECTION rightop=expr #intersection
// set union, {a, b, c} union {b, d}
| leftop=expr UNION rightop=expr #union
// tuple type
| '(' firstarg=expr TUPLE_TYPE additionalargs+=expr (TUPLE_TYPE additionalargs+=expr)* ')' #tupleType
// function type
| domaintypes+=expr (TUPLE_TYPE domaintypes+=expr)* FUNCTION_TYPE rangetype=expr #functionType
// set membership, x in {x, y, z}
| leftop=expr IN rightop=expr #in
// comparison operators, e.g.: X = Y, 2 < 3
| leftop=expr op=('<' | '<=' | '=' | '!=' | '>=' | '>') rightop=expr #comparison
// conjunction, e.g.: A or B and C -> A or (B and C)
| leftconj=expr AND rightconj=expr #and
// disjunction, e.g.: A => B or C -> A => (B or C)
| leftdisj=expr OR rightdisj=expr #or
// implication, e.g.: A = B => C = D
|<assoc=right> antecedent=expr IMPLICATION consequent=expr #implication
// biconditional, e.g.: A = B <=> C = D
|<assoc=right> leftop=expr BICONDITIONAL rightop=expr #biconditional
// conditional, e.g.: if X = Y then 1 else 2
| IF condition=expr THEN thenbranch=expr ELSE elsebranch=expr #ifThenElse
// lambda, e.g.: lambda f(X) : 2 + f(X)
| LAMBDA ( parameters+=expr (',' parameters+=expr)* )? ':' body=expr #lamda
// universal quantification, e.g.: for all X : X != a
| FOR ALL index=expr ':' body=expr #forAll
// existential quantification, e.g.: there exists X : X = a
| THERE EXISTS index=expr ':' body=expr #thereExists
| expr_symbol #symbol
;
expr_symbol
: expr_non_numeric_symbol
| expr_constant_number
;
expr_non_numeric_symbol
: expr_constant_name
// NOTE: even though the expr_constant_name pattern should match these tokens
// ANTLR excludes the set of tokens that are used from matching
// this pattern (see chapter5 of reference manual). Therefore, we
// need to explicitly list all of the keywords and operators that we
// want also to be interpreted as Symbols.
| FUNCTION_TYPE
| IMPLICATION | BICONDITIONAL // Logic Operators
| EXPONENTIATION | DIVIDE | TIMES | PLUS | SUBTRACT // Arithmetic
| LESS_THAN_EQUAL | EQUAL | NOT_EQUAL | GREATER_THAN_EQUAL // Comparison, Note: We intentionally exclude '<' and '>' as these can affect parsing of an expression symbol
| COLON | VERT_BAR | UNDERSCORE | PERIOD // Misc
;
expr_constant_name
: CONSTANT_STR
| QUOTED_CONSTANT_STR
// NOTE: even though the expr_constant_name pattern should match these tokens
// ANTLR excludes the set of tokens that are used from matching
// this pattern (see chapter5 of reference manual). Therefore, we
// need to explicitly list all of the keywords and operators that we
// want also to be interpreted as Symbols.
| NOT | AND | OR | FOR | ALL | THERE | EXISTS // Keywords
| LAMBDA | IF | THEN | ELSE
| INTERSECTION | UNION
| ON | IN
| TUPLE_TYPE
;
expr_constant_number
: INTEGER
| RATIONAL
;
/*
The lexer tokenizes the input string that the parser is asked to
parse. The tokens are all typed. Whitespace
symbols will be excluded from the resulting token stream.
Adding new grammar rules
------------------------
Add any terminal symbols in the new grammar rules to the list below.
Note: Ensure you update the corresponding list in AntlrGrinderTerminalSymbols.java
with any changes made.
*/
// Keywords
NOT : 'not' ;
AND : 'and' ;
OR : 'or' ;
FOR : 'for' ;
ALL : 'all' ;
THERE : 'there' ;
EXISTS : 'exists' ;
LAMBDA : 'lambda' ;
IF : 'if' ;
THEN : 'then' ;
ELSE : 'else' ;
INTERSECTION : 'intersection' ;
UNION : 'union' ;
ON : 'on' ;
IN : 'in' ;
// Special Functions
TUPLE_TYPE : 'x' ;
FUNCTION_TYPE : '->' ;
// Logic Operators
IMPLICATION : '=>' ;
BICONDITIONAL : '<=>' ;
// Arithmetic
EXPONENTIATION : '^' ;
DIVIDE : '/' ;
TIMES : '*' ;
INTEGER_INTERVAL : '..' ;
PLUS : '+' ;
SUBTRACT : '-' ;
// Comparison
LESS_THAN : '<' ;
LESS_THAN_EQUAL : '<=' ;
EQUAL : '=' ;
NOT_EQUAL : '!=' ;
GREATER_THAN_EQUAL : '>=' ;
GREATER_THAN : '>' ;
// Brackets
OPEN_PAREN : '(' ;
CLOSE_PAREN : ')' ;
OPEN_SQUARE : '[' ;
CLOSE_SQUARE : ']' ;
OPEN_CURLY : '{' ;
CLOSE_CURLY : '}' ;
OPEN_DOUBLE_CURLY : '{{' ;
CLOSE_DOUBLE_CURLY : '}}' ;
// Misc
SEMICOLON : ';' ;
COLON : ':' ;
VERT_BAR : '|' ;
COMMA : ',' ;
UNDERSCORE : '_' ;
PERIOD : '.' ;
INTEGER
: ('0'..'9')+
;
RATIONAL
: ('0' | '1'..'9' '0'..'9'*)
| ('0'..'9')+ '.' ('0'..'9')+ EXPONENT? FLOAT_TYPE_SUFFIX?
| '.' ('0'..'9')+ EXPONENT? FLOAT_TYPE_SUFFIX?
| ('0'..'9')+ EXPONENT FLOAT_TYPE_SUFFIX?
| ('0'..'9')+ FLOAT_TYPE_SUFFIX
| ('0x' | '0X') (HEX_DIGIT )*
('.' (HEX_DIGIT)*)?
( 'p' | 'P' )
( '+' | '-' )?
( '0' .. '9' )+
FLOAT_TYPE_SUFFIX?
;
CONSTANT_STR
: ([a-zA-Z] | [0-9] | '_') ([a-zA-Z] | [0-9] | '_')* ('\'')*
;
QUOTED_CONSTANT_STR
: '"' (ESCAPE_SEQUENCE | ~('\\' | '"' ) )* '"'
| '\'' (ESCAPE_SEQUENCE | ~('\\' | '\'') )* '\''
;
fragment
EXPONENT : ('e'|'E') ('+'|'-')? ('0'..'9')+
;
fragment
FLOAT_TYPE_SUFFIX : ('f'|'F'|'d'|'D')
;
fragment
ESCAPE_SEQUENCE
: '\\' ('b'|'t'|'n'|'f'|'r'|'"'|'\''|'\\')
| UNICODE_ESCAPE
| OCTAL_ESCAPE
;
fragment
UNICODE_ESCAPE
: '\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT
;
fragment
OCTAL_ESCAPE
: '\\' ('0'..'3') ('0'..'7') ('0'..'7')
| '\\' ('0'..'7') ('0'..'7')
| '\\' ('0'..'7')
;
fragment
HEX_DIGIT : ('0'..'9'|'a'..'f'|'A'..'F')
;
COMMENT
: '/*' .*? '*/' -> channel(HIDDEN) // match anything between /* and */
;
LINE_COMMENT
: '//' ~[\r\n]* '\r'? ('\n' | EOF) -> channel(HIDDEN)
;
WS : [ \t\r\n]+ -> skip
; // Define whitespace rule, toss it out
|
programs/oeis/159/A159918.asm | neoneye/loda | 22 | 100020 | ; A159918: Number of ones in binary representation of n^2.
; 0,1,1,2,1,3,2,3,1,3,3,5,2,4,3,4,1,3,3,5,3,6,5,3,2,5,4,6,3,5,4,5,1,3,3,5,3,6,5,7,3,5,6,7,5,8,3,4,2,5,5,5,4,8,6,7,3,6,5,7,4,6,5,6,1,3,3,5,3,6,5,7,3,6,6,9,5,7,7,5,3,6,5,8,6,7,7,7,5,9,8,5,3,6,4,5,2,5,5,6
pow $0,2
mov $2,$0
lpb $0
div $2,2
sub $0,$2
lpe
|
programs/oeis/047/A047350.asm | jmorken/loda | 1 | 244548 | <filename>programs/oeis/047/A047350.asm
; A047350: Numbers that are congruent to {1, 2, 4} mod 7.
; 1,2,4,8,9,11,15,16,18,22,23,25,29,30,32,36,37,39,43,44,46,50,51,53,57,58,60,64,65,67,71,72,74,78,79,81,85,86,88,92,93,95,99,100,102,106,107,109,113,114,116,120,121,123,127,128,130,134,135,137,141
mov $2,$0
add $2,1
mov $5,$0
lpb $2
mov $0,$5
sub $2,1
sub $0,$2
mov $4,$0
mov $7,2
lpb $7
mov $0,$4
sub $7,1
add $0,$7
mul $0,4
cal $0,10410 ; Squares mod 49.
mov $3,$0
mov $6,$7
lpb $6
sub $6,1
mov $8,$3
lpe
lpe
lpb $4
mov $4,0
sub $8,$3
lpe
mov $3,$8
sub $3,7
add $1,$3
lpe
|
oeis/040/A040868.asm | neoneye/loda-programs | 11 | 160875 | ; A040868: Continued fraction for sqrt(898).
; Submitted by <NAME>(s1)
; 29,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28,1,58,1,28
gcd $0,262156
mul $0,42
mod $0,13
mov $1,$0
div $1,5
mul $1,24
add $0,$1
sub $0,2
|
wof/lcs/base/1AE.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 244329 | copyright zengfr site:http://github.com/zengfr/romhack
010A04 addq.w #4, A7 [base+1AE]
011396 bne $1138e [base+1AE]
01A610 dbra D1, $1a60e
053CE8 subq.b #1, ($1ae,A5) [base+1C9]
053CEC jmp $1552.w [base+1AE]
copyright zengfr site:http://github.com/zengfr/romhack
|
pwnlib/shellcraft/templates/arm/linux/sendfile.asm | alexpark07/pwntools | 1 | 176098 | <% from pwnlib.shellcraft import common %>
<%page args="in_fd=None, out_fd=None, size=255"/>
<%docstring>
sends a file to user
Args:
in_fd (str/iny): in file descriptor
out_fd (str/iny): out file descriptor
</%docstring>
mov r0, #${out_fd}
mov r1, #${in_fd}
sub r2, r2, r2
mov r3, #${size}
svc SYS_sendfile
|
src/MJSF/Values.agda | metaborg/mj.agda | 10 | 13863 | open import Data.Nat
open import Data.List as List hiding (null)
open import Data.List.Membership.Propositional
open import Data.List.Relation.Unary.Any
open import Data.List.Relation.Unary.All
open import Data.List.Prefix
open import Data.Integer
open import Data.Product
-- This file contains the definition of values for the definitional
-- interpreter for MJ using scopes and frames, described in Section 5
-- of the paper.
module MJSF.Values (k : ℕ) where
open import MJSF.Syntax k
open import ScopesFrames.ScopesFrames k Ty
module ValuesG (g : Graph) where
open SyntaxG g
open UsesGraph g public
open import Common.Weakening
------------
-- VALUES --
------------
-- The values used in our interpreter at run time are either:
--
-- * object references `ref`, represented in terms of a frame scoped
-- by a class scope;
--
-- * null values (`ref` typed);
--
-- * an integer number literal (`int` typed); or
--
-- * `void` (`void typed -- note that there is no expression syntax
-- for producing a `void` value directly, but method bodies still
-- return `void`; we regard `void` as a unit type)
data Val : VTy → List Scope → Set where
ref : ∀ {s s' Σ} → s <: s' → Frame s Σ → Val (ref s') Σ
null : ∀ {s Σ} → Val (ref s) Σ
num : ∀ {Σ} → ℤ → Val int Σ
void : ∀ {Σ} → Val void Σ
-- There are three kinds of values stored in frame slots at run
-- time, corresponding to each of the three kinds of declarations
-- defined in `MJSF.Syntax`:
--
-- * values, as defined above;
--
-- * methods, where a method records a "self" frame `Frame s Σ` and
-- a well-typed method definition `Meth s ts rt`, such that the
-- scope of the method corresponds to the "self"; and
--
-- * classes which record a well-typed class definition and a
-- witness that the class has a finite inheritance chain, both
-- used for initializing new object instances, as well as a frame
-- pointer to the root frame (class table).
data Valᵗ : Ty → List Scope → Set where
vᵗ : ∀ {t Σ} → Val t Σ → Valᵗ (vᵗ t) Σ
mᵗ : ∀ {s ts rt Σ} → (self : Frame s Σ) → (body : Meth s ts rt) → Valᵗ (mᵗ ts rt) Σ
cᵗ : ∀ {sʳ s s' Σ} → (class-def : Class sʳ s) → (ic : Inherits s s') → (root : Frame sʳ Σ) → Valᵗ (cᵗ sʳ s) Σ
---------------
-- WEAKENING --
---------------
-- We define notions of weakening for each of the values summarized above:
val-weaken : ∀ {t Σ Σ'} → Σ ⊑ Σ' → Val t Σ → Val t Σ'
val-weaken ext (num i) = num i
val-weaken ext (ref i f) = ref i (wk ext f)
val-weaken ext null = null
val-weaken ext void = void
instance
val-weakenable : ∀ {t} → Weakenable (Val t)
val-weakenable = record { wk = val-weaken }
valᵗ-weaken : ∀ {t Σ Σ'} → Σ ⊑ Σ' → Valᵗ t Σ → Valᵗ t Σ'
valᵗ-weaken ext (vᵗ v) = vᵗ (val-weaken ext v)
valᵗ-weaken ext (mᵗ f m) = mᵗ (wk ext f) m
valᵗ-weaken ext (cᵗ c ic f) = cᵗ c ic (wk ext f)
-- And pass these to the scope graph definition:
open UsesVal Valᵗ valᵗ-weaken renaming (getFrame to getFrame')
--------------
-- COERCION --
--------------
-- Our definition of sub-typing gives rise to a notion of sub-type
-- coercion, defined below. Coercions essentially traverse the
-- inheritance links of the frame hierarchy for an object instance,
-- as described in the paper.
upcastRef : ∀ {t t' Σ} → t <: t' → Val (ref t) Σ → Val (ref t') Σ
upcastRef i (ref i' f) = ref (concatₚ i' i) f
upcastRef i null = null
|
archive/agda-1/PredicateName.agda | m0davis/oscar | 0 | 10833 | <filename>archive/agda-1/PredicateName.agda
module PredicateName where
open import OscarPrelude
record PredicateName : Set
where
constructor ⟨_⟩
field
name : Nat
open PredicateName public
instance EqPredicateName : Eq PredicateName
Eq._==_ EqPredicateName _ = decEq₁ (cong name) ∘ (_≟_ on name $ _)
|
intel-avx2/axpy/axpy_fma.asm | yanyh15/vectorization-examples | 0 | 3722 | <reponame>yanyh15/vectorization-examples
section .data
section .bss
section .text
global axpy
; void axpy(int N, REAL *Y, REAL *X, REAL a);
; edi rsi rdx xmm0
; AXPY Y[N] = Y[N] + a*X[N]
axpy:
xor rax, rax
vmovups ymm1, [rdx]
vbroadcastss ymm2, xmm0
vfmadd213ps ymm1, ymm2, [rsi]
vmovups [rsi], ymm1
cmp edi, 8
jle done
axpy8:
vmovups ymm1, [rdx+rax*4]
vfmadd213ps ymm1, ymm2, [rsi+rax*4]
vmovups [rsi+rax*4], ymm1
add eax, 8
cmp eax, edi
jl axpy8
;axpy1:
; movss xmm0, [rdx+rax*4]
; addss xmm0, [rsi+rax*4]
; movss [rsi+rax*4], xmm0
; add eax, 1
; cmp eax, edi
; jl axpy1
done:
ret
|
programs/oeis/166/A166466.asm | karttu/loda | 1 | 173153 | <filename>programs/oeis/166/A166466.asm
; A166466: Trisection a(n) = A000265(3n).
; 3,3,9,3,15,9,21,3,27,15,33,9,39,21,45,3,51,27,57,15,63,33,69,9,75,39,81,21,87,45,93,3,99,51,105,27,111,57,117,15,123,63,129,33,135,69,141,9,147,75,153,39,159,81,165,21,171,87,177,45,183,93,189,3,195,99,201,51
add $0,1
mov $1,$0
mul $1,3
mov $2,64
gcd $2,$1
div $1,$2
|
programs/oeis/098/A098077.asm | karttu/loda | 0 | 87612 | ; A098077: a(n) = n^2*(n+1)*(2*n+1)/3.
; 2,20,84,240,550,1092,1960,3264,5130,7700,11132,15600,21294,28420,37200,47872,60690,75924,93860,114800,139062,166980,198904,235200,276250,322452,374220,431984,496190,567300,645792,732160,826914,930580,1043700,1166832,1300550,1445444,1602120,1771200,1953322,2149140,2359324,2584560,2825550,3083012,3357680,3650304,3961650,4292500,4643652,5015920,5410134,5827140,6267800,6732992,7223610,7740564,8284780,8857200,9458782,10090500,10753344,11448320,12176450,12938772,13736340,14570224,15441510,16351300,17300712,18290880,19322954,20398100,21517500,22682352,23893870,25153284,26461840,27820800,29231442,30695060,32212964,33786480,35416950,37105732,38854200,40663744,42535770,44471700,46472972,48541040,50677374,52883460,55160800,57510912,59935330,62435604,65013300,67670000,70407302,73226820,76130184,79119040,82195050,85359892,88615260,91962864,95404430,98941700,102576432,106310400,110145394,114083220,118125700,122274672,126531990,130899524,135379160,139972800,144682362,149509780,154457004,159526000,164718750,170037252,175483520,181059584,186767490,192609300,198587092,204702960,210959014,217357380,223900200,230589632,237427850,244417044,251559420,258857200,266312622,273927940,281705424,289647360,297756050,306033812,314482980,323105904,331904950,340882500,350040952,359382720,368910234,378625940,388532300,398631792,408926910,419420164,430114080,441011200,452114082,463425300,474947444,486683120,498634950,510805572,523197640,535813824,548656810,561729300,575034012,588573680,602351054,616368900,630630000,645137152,659893170,674900884,690163140,705682800,721462742,737505860,753815064,770393280,787243450,804368532,821771500,839455344,857423070,875677700,894222272,913059840,932193474,951626260,971361300,991401712,1011750630,1032411204,1053386600,1074680000,1096294602,1118233620,1140500284,1163097840,1186029550,1209298692,1232908560,1256862464,1281163730,1305815700,1330821732,1356185200,1381909494,1407998020,1434454200,1461281472,1488483290,1516063124,1544024460,1572370800,1601105662,1630232580,1659755104,1689676800,1720001250,1750732052,1781872820,1813427184,1845398790,1877791300,1910608392,1943853760,1977531114,2011644180,2046196700,2081192432,2116635150,2152528644,2188876720,2225683200,2262951922,2300686740,2338891524,2377570160,2416726550,2456364612,2496488280,2537101504,2578208250,2619812500
mov $1,$0
mov $3,$0
mov $5,$0
add $0,5
mov $2,$3
pow $2,2
add $3,$1
add $3,$2
add $3,2
pow $3,2
lpb $0,1
mov $0,$1
div $3,3
mov $1,$3
lpe
sub $1,1
add $1,$3
add $1,1
add $1,$5
mov $6,$5
mul $6,$5
mov $4,$6
mul $4,2
add $1,$4
mul $6,$5
add $1,$6
|
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_21829_478.asm | ljhsiun2/medusa | 9 | 26295 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r14
push %r15
push %r8
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0xba38, %r10
nop
nop
nop
cmp $2446, %r12
mov (%r10), %r9
and $61941, %r10
lea addresses_normal_ht+0x12938, %r10
nop
cmp $15434, %r9
vmovups (%r10), %ymm0
vextracti128 $1, %ymm0, %xmm0
vpextrq $1, %xmm0, %rdi
nop
xor $62477, %r9
lea addresses_WC_ht+0x7738, %r8
nop
nop
nop
mfence
mov $0x6162636465666768, %r14
movq %r14, (%r8)
nop
nop
nop
sub %rdi, %rdi
lea addresses_D_ht+0x199da, %rdi
nop
nop
and $8705, %r9
mov (%rdi), %r8
nop
nop
and %r12, %r12
lea addresses_D_ht+0xfc99, %r10
nop
nop
nop
nop
xor %r15, %r15
mov $0x6162636465666768, %r8
movq %r8, %xmm7
movups %xmm7, (%r10)
nop
nop
nop
nop
dec %r8
lea addresses_normal_ht+0x174b8, %rdi
clflush (%rdi)
nop
nop
nop
inc %r14
movb (%rdi), %r9b
nop
nop
sub $35041, %r8
lea addresses_normal_ht+0x16b78, %rsi
lea addresses_WC_ht+0x1dc60, %rdi
nop
nop
nop
nop
sub $22754, %r15
mov $117, %rcx
rep movsw
nop
nop
nop
add $14222, %r10
lea addresses_A_ht+0x1ec78, %rsi
lea addresses_WT_ht+0x648, %rdi
nop
nop
nop
nop
nop
cmp $28113, %r15
mov $65, %rcx
rep movsw
nop
nop
add $618, %r9
lea addresses_D_ht+0x4af8, %r15
nop
nop
nop
nop
nop
lfence
movw $0x6162, (%r15)
nop
nop
nop
nop
add $56951, %r12
lea addresses_WC_ht+0xe3b8, %rcx
nop
nop
nop
nop
sub $36732, %r12
movb (%rcx), %r9b
nop
nop
nop
sub %r8, %r8
lea addresses_WC_ht+0xe938, %r9
nop
nop
and %r10, %r10
mov (%r9), %r8d
nop
nop
nop
nop
nop
xor %rcx, %rcx
lea addresses_WT_ht+0x82b8, %r15
add $47850, %r8
mov $0x6162636465666768, %r10
movq %r10, %xmm5
and $0xffffffffffffffc0, %r15
vmovntdq %ymm5, (%r15)
nop
nop
nop
cmp %r15, %r15
lea addresses_A_ht+0xdb78, %r15
nop
nop
nop
nop
inc %r14
movups (%r15), %xmm3
vpextrq $1, %xmm3, %rcx
nop
nop
cmp $37754, %r8
lea addresses_UC_ht+0x8006, %rsi
lea addresses_A_ht+0x14138, %rdi
nop
nop
inc %r12
mov $36, %rcx
rep movsb
nop
nop
nop
nop
and $41479, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rdi
// Faulty Load
lea addresses_PSE+0x8138, %r14
nop
nop
cmp %r8, %r8
vmovups (%r14), %ymm5
vextracti128 $0, %ymm5, %xmm5
vpextrq $1, %xmm5, %r15
lea oracles, %r12
and $0xff, %r15
shlq $12, %r15
mov (%r12,%r15,1), %r15
pop %rdi
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 8, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 9, 'size': 32, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 1, 'size': 8, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'congruent': 7, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': True}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 3, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 4, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'congruent': 6, 'size': 2, 'same': True, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'congruent': 11, 'size': 4, 'same': False, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 6, 'size': 32, 'same': False, 'NT': True}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 6, 'size': 16, 'same': False, 'NT': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1104.asm | ljhsiun2/medusa | 9 | 14644 | <gh_stars>1-10
.global s_prepare_buffers
s_prepare_buffers:
push %r12
push %r13
push %r15
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WT_ht+0x16cff, %rsi
lea addresses_WT_ht+0x36a7, %rdi
clflush (%rsi)
clflush (%rdi)
cmp $58320, %rbx
mov $31, %rcx
rep movsb
nop
xor $50171, %rdi
lea addresses_D_ht+0x58a7, %r12
nop
nop
sub $8683, %r13
movups (%r12), %xmm7
vpextrq $0, %xmm7, %r15
nop
nop
nop
nop
and $32863, %r13
lea addresses_WT_ht+0xaf27, %rcx
nop
nop
nop
cmp $35913, %r13
movw $0x6162, (%rcx)
sub $15406, %r15
lea addresses_WC_ht+0xc077, %r13
nop
nop
nop
nop
dec %r12
movl $0x61626364, (%r13)
nop
nop
nop
nop
cmp $48177, %r13
lea addresses_WT_ht+0xeda7, %rcx
nop
nop
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %r13
movq %r13, (%rcx)
and $52886, %rdi
lea addresses_normal_ht+0x9627, %r15
nop
nop
nop
nop
nop
add %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm7
movups %xmm7, (%r15)
nop
nop
nop
nop
nop
xor %r13, %r13
lea addresses_normal_ht+0x3877, %rdi
nop
nop
nop
dec %rsi
vmovups (%rdi), %ymm3
vextracti128 $0, %ymm3, %xmm3
vpextrq $0, %xmm3, %r13
add %rsi, %rsi
lea addresses_UC_ht+0x1e9a7, %r13
nop
cmp $8537, %rsi
movb (%r13), %cl
nop
nop
nop
nop
nop
sub $37047, %rcx
lea addresses_WC_ht+0x9fa7, %rsi
lea addresses_UC_ht+0x8a2a, %rdi
nop
add %r12, %r12
mov $78, %rcx
rep movsw
nop
add %rdi, %rdi
lea addresses_D_ht+0x1ea3, %rsi
lea addresses_D_ht+0xfca7, %rdi
nop
nop
add $26512, %rdx
mov $72, %rcx
rep movsb
nop
nop
nop
xor $18347, %r13
lea addresses_UC_ht+0x3d27, %rdx
nop
inc %r13
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rdx)
nop
sub %rcx, %rcx
lea addresses_A_ht+0x89a7, %rsi
lea addresses_D_ht+0x12127, %rdi
nop
nop
nop
sub %r15, %r15
mov $65, %rcx
rep movsw
nop
nop
and %rcx, %rcx
lea addresses_D_ht+0xe8b2, %rsi
lea addresses_A_ht+0x1dda7, %rdi
clflush (%rdi)
nop
nop
nop
nop
cmp $20294, %r12
mov $90, %rcx
rep movsq
nop
nop
add %r12, %r12
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r13
pop %r12
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %rbp
push %rbx
push %rcx
push %rdi
push %rdx
push %rsi
// Store
lea addresses_WT+0x34a7, %rsi
nop
sub $44303, %r10
movw $0x5152, (%rsi)
nop
nop
nop
nop
nop
cmp %r10, %r10
// Store
lea addresses_WT+0x10a67, %rbx
nop
nop
nop
nop
cmp $61637, %r10
movb $0x51, (%rbx)
nop
nop
nop
nop
nop
dec %r10
// Store
lea addresses_D+0x55a7, %rbp
nop
nop
nop
nop
nop
and $4217, %rdi
movb $0x51, (%rbp)
// Exception!!!
nop
mov (0), %rsi
and $19457, %rdi
// Store
lea addresses_D+0x1c817, %rsi
dec %rcx
mov $0x5152535455565758, %rdx
movq %rdx, %xmm5
movups %xmm5, (%rsi)
// Exception!!!
nop
nop
nop
mov (0), %rdx
nop
nop
nop
nop
xor $41112, %rdx
// Load
lea addresses_A+0x6da7, %r10
nop
nop
nop
nop
nop
add %rbx, %rbx
movb (%r10), %dl
cmp $1710, %rcx
// Store
lea addresses_WT+0x843f, %rsi
nop
nop
nop
nop
nop
sub $43833, %rbp
movw $0x5152, (%rsi)
nop
nop
nop
nop
xor $64100, %rcx
// Store
lea addresses_WC+0xee7, %rcx
nop
xor %rdi, %rdi
mov $0x5152535455565758, %rdx
movq %rdx, (%rcx)
nop
nop
nop
add $25436, %rbp
// Faulty Load
lea addresses_D+0x1bda7, %rcx
xor $45326, %r10
movups (%rcx), %xmm5
vpextrq $0, %xmm5, %rbp
lea oracles, %rbx
and $0xff, %rbp
shlq $12, %rbp
mov (%rbx,%rbp,1), %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': True, 'size': 1, 'congruent': 6}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_A', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 11}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 2}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC', 'NT': False, 'AVXalign': True, 'size': 8, 'congruent': 6}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_D', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 3, 'type': 'addresses_WT_ht'}, 'dst': {'same': False, 'congruent': 7, 'type': 'addresses_WT_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_D_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'same': True, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 5}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WC_ht', 'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_WT_ht', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_normal_ht', 'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 3}}
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 9}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_UC_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 8, 'type': 'addresses_D_ht'}}
{'OP': 'STOR', 'dst': {'same': False, 'type': 'addresses_UC_ht', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 7}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_A_ht'}, 'dst': {'same': False, 'congruent': 3, 'type': 'addresses_D_ht'}}
{'OP': 'REPM', 'src': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}, 'dst': {'same': False, 'congruent': 9, 'type': 'addresses_A_ht'}}
{'36': 21829}
36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36
*/
|
boards/host/stm32gd-usart-peripheral.ads | ekoeppen/STM32_Generic_Ada_Drivers | 1 | 18637 | <gh_stars>1-10
with STM32_SVD; use STM32_SVD;
generic
Filename : String;
package STM32GD.USART.Peripheral is
pragma Preelaborate;
procedure Transmit (Data : in Byte);
end STM32GD.USART.Peripheral;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.