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 |
|---|---|---|---|---|
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_958.asm | ljhsiun2/medusa | 9 | 179509 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r8
push %r9
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x17fcc, %r10
nop
nop
nop
inc %r8
movw $0x6162, (%r10)
nop
nop
add %r9, %r9
lea addresses_WC_ht+0x14a04, %rsi
lea addresses_normal_ht+0x1a124, %rdi
clflush (%rdi)
nop
nop
dec %r12
mov $93, %rcx
rep movsb
xor %rdi, %rdi
lea addresses_normal_ht+0x1d294, %r12
nop
nop
nop
nop
and %rsi, %rsi
mov (%r12), %r9d
nop
nop
add %r8, %r8
lea addresses_WC_ht+0x1a804, %r12
and $26399, %rdi
and $0xffffffffffffffc0, %r12
vmovntdqa (%r12), %ymm7
vextracti128 $1, %ymm7, %xmm7
vpextrq $0, %xmm7, %r8
nop
cmp %rdi, %rdi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r9
pop %r8
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r13
push %rbp
push %rcx
push %rsi
// Store
lea addresses_normal+0x7d44, %r11
nop
and $12221, %rbp
mov $0x5152535455565758, %r13
movq %r13, (%r11)
nop
and $61950, %r12
// Load
lea addresses_WC+0x7c24, %rbp
nop
nop
xor $1855, %rsi
mov (%rbp), %r12w
nop
nop
nop
sub %rcx, %rcx
// Store
lea addresses_WT+0x9704, %r12
nop
nop
nop
sub $50586, %r13
mov $0x5152535455565758, %rsi
movq %rsi, %xmm3
movups %xmm3, (%r12)
nop
nop
cmp $23912, %r11
// Load
lea addresses_UC+0xed04, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
inc %r13
mov (%rsi), %rbp
nop
nop
nop
xor %rbp, %rbp
// Faulty Load
lea addresses_UC+0xed04, %rcx
nop
nop
nop
add %rbp, %rbp
movups (%rcx), %xmm0
vpextrq $1, %xmm0, %r13
lea oracles, %rbp
and $0xff, %r13
shlq $12, %r13
mov (%rbp,%r13,1), %r13
pop %rsi
pop %rcx
pop %rbp
pop %r13
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 4}}
{'src': {'type': 'addresses_WC', 'AVXalign': True, 'size': 2, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_UC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_WC_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 4, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 3}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 32, 'NT': True, 'same': False, 'congruent': 6}, 'OP': 'LOAD'}
{'37': 21829}
37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37 37
*/
|
tools-src/gnu/gcc/gcc/ada/s-taprop.ads | enfoTek/tomato.linksys.e2000.nvram-mod | 80 | 12442 | ------------------------------------------------------------------------------
-- --
-- GNU ADA RUN-TIME LIBRARY (GNARL) COMPONENTS --
-- --
-- S Y S T E M . T A S K _ P R I M I T I V E S .O P E R A T I O N S --
-- --
-- S p e c --
-- --
-- $Revision$
-- --
-- Copyright (C) 1992-2001, Free Software Foundation, Inc. --
-- --
-- GNARL is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 2, or (at your option) any later ver- --
-- sion. GNARL is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
-- for more details. You should have received a copy of the GNU General --
-- Public License distributed with GNARL; see file COPYING. If not, write --
-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
-- MA 02111-1307, USA. --
-- --
-- As a special exception, if other files instantiate generics from this --
-- unit, or you link this unit with other files to produce an executable, --
-- this unit does not by itself cause the resulting executable to be --
-- covered by the GNU General Public License. This exception does not --
-- however invalidate any other reasons why the executable file might be --
-- covered by the GNU Public License. --
-- --
-- GNARL was developed by the GNARL team at Florida State University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains all the GNULL primitives that interface directly
-- with the underlying OS.
with System.Parameters;
-- used for Size_Type
with System.Tasking;
-- used for Task_ID
with System.OS_Interface;
-- used for Thread_Id
package System.Task_Primitives.Operations is
pragma Elaborate_Body;
package ST renames System.Tasking;
package OSI renames System.OS_Interface;
procedure Initialize (Environment_Task : ST.Task_ID);
pragma Inline (Initialize);
-- This must be called once, before any other subprograms of this
-- package are called.
procedure Create_Task
(T : ST.Task_ID;
Wrapper : System.Address;
Stack_Size : System.Parameters.Size_Type;
Priority : System.Any_Priority;
Succeeded : out Boolean);
pragma Inline (Create_Task);
-- Create a new low-level task with ST.Task_ID T and place other needed
-- information in the ATCB.
--
-- A new thread of control is created, with a stack of at least Stack_Size
-- storage units, and the procedure Wrapper is called by this new thread
-- of control. If Stack_Size = Unspecified_Storage_Size, choose a default
-- stack size; this may be effectively "unbounded" on some systems.
--
-- The newly created low-level task is associated with the ST.Task_ID T
-- such that any subsequent call to Self from within the context of the
-- low-level task returns T.
--
-- The caller is responsible for ensuring that the storage of the Ada
-- task control block object pointed to by T persists for the lifetime
-- of the new task.
--
-- Succeeded is set to true unless creation of the task failed,
-- as it may if there are insufficient resources to create another task.
procedure Enter_Task (Self_ID : ST.Task_ID);
pragma Inline (Enter_Task);
-- Initialize data structures specific to the calling task.
-- Self must be the ID of the calling task.
-- It must be called (once) by the task immediately after creation,
-- while abortion is still deferred.
-- The effects of other operations defined below are not defined
-- unless the caller has previously called Initialize_Task.
procedure Exit_Task;
pragma Inline (Exit_Task);
-- Destroy the thread of control.
-- Self must be the ID of the calling task.
-- The effects of further calls to operations defined below
-- on the task are undefined thereafter.
function New_ATCB (Entry_Num : ST.Task_Entry_Index) return ST.Task_ID;
pragma Inline (New_ATCB);
-- Allocate a new ATCB with the specified number of entries.
procedure Initialize_TCB (Self_ID : ST.Task_ID; Succeeded : out Boolean);
pragma Inline (Initialize_TCB);
-- Initialize all fields of the TCB
procedure Finalize_TCB (T : ST.Task_ID);
pragma Inline (Finalize_TCB);
-- Finalizes Private_Data of ATCB, and then deallocates it.
-- This is also responsible for recovering any storage or other resources
-- that were allocated by Create_Task (the one in this package).
-- This should only be called from Free_Task.
-- After it is called there should be no further
-- reference to the ATCB that corresponds to T.
procedure Abort_Task (T : ST.Task_ID);
pragma Inline (Abort_Task);
-- Abort the task specified by T (the target task). This causes
-- the target task to asynchronously raise Abort_Signal if
-- abort is not deferred, or if it is blocked on an interruptible
-- system call.
--
-- precondition:
-- the calling task is holding T's lock and has abort deferred
--
-- postcondition:
-- the calling task is holding T's lock and has abort deferred.
-- ??? modify GNARL to skip wakeup and always call Abort_Task
function Self return ST.Task_ID;
pragma Inline (Self);
-- Return a pointer to the Ada Task Control Block of the calling task.
type Lock_Level is
(PO_Level,
Global_Task_Level,
All_Attrs_Level,
All_Tasks_Level,
Interrupts_Level,
ATCB_Level);
-- Type used to describe kind of lock for second form of Initialize_Lock
-- call specified below.
-- See locking rules in System.Tasking (spec) for more details.
procedure Initialize_Lock (Prio : System.Any_Priority; L : access Lock);
procedure Initialize_Lock (L : access RTS_Lock; Level : Lock_Level);
pragma Inline (Initialize_Lock);
-- Initialize a lock object.
--
-- For Lock, Prio is the ceiling priority associated with the lock.
-- For RTS_Lock, the ceiling is implicitly Priority'Last.
--
-- If the underlying system does not support priority ceiling
-- locking, the Prio parameter is ignored.
--
-- The effect of either initialize operation is undefined unless L
-- is a lock object that has not been initialized, or which has been
-- finalized since it was last initialized.
--
-- The effects of the other operations on lock objects
-- are undefined unless the lock object has been initialized
-- and has not since been finalized.
--
-- Initialization of the per-task lock is implicit in Create_Task.
--
-- These operations raise Storage_Error if a lack of storage is detected.
procedure Finalize_Lock (L : access Lock);
procedure Finalize_Lock (L : access RTS_Lock);
pragma Inline (Finalize_Lock);
-- Finalize a lock object, freeing any resources allocated by the
-- corresponding Initialize_Lock operation.
procedure Write_Lock (L : access Lock; Ceiling_Violation : out Boolean);
procedure Write_Lock (L : access RTS_Lock);
procedure Write_Lock (T : ST.Task_ID);
pragma Inline (Write_Lock);
-- Lock a lock object for write access. After this operation returns,
-- the calling task holds write permission for the lock object. No other
-- Write_Lock or Read_Lock operation on the same lock object will return
-- until this task executes an Unlock operation on the same object. The
-- effect is undefined if the calling task already holds read or write
-- permission for the lock object L.
--
-- For the operation on Lock, Ceiling_Violation is set to true iff the
-- operation failed, which will happen if there is a priority ceiling
-- violation.
--
-- For the operation on ST.Task_ID, the lock is the special lock object
-- associated with that task's ATCB. This lock has effective ceiling
-- priority high enough that it is safe to call by a task with any
-- priority in the range System.Priority. It is implicitly initialized
-- by task creation. The effect is undefined if the calling task already
-- holds T's lock, or has interrupt-level priority. Finalization of the
-- per-task lock is implicit in Exit_Task.
procedure Read_Lock (L : access Lock; Ceiling_Violation : out Boolean);
pragma Inline (Read_Lock);
-- Lock a lock object for read access. After this operation returns,
-- the calling task has non-exclusive read permission for the logical
-- resources that are protected by the lock. No other Write_Lock operation
-- on the same object will return until this task and any other tasks with
-- read permission for this lock have executed Unlock operation(s) on the
-- lock object. A Read_Lock for a lock object may return immediately while
-- there are tasks holding read permission, provided there are no tasks
-- holding write permission for the object. The effect is undefined if
-- the calling task already holds read or write permission for L.
--
-- Alternatively: An implementation may treat Read_Lock identically to
-- Write_Lock. This simplifies the implementation, but reduces the level
-- of concurrency that can be achieved.
--
-- Note that Read_Lock is not defined for RT_Lock and ST.Task_ID.
-- That is because (1) so far Read_Lock has always been implemented
-- the same as Write_Lock, (2) most lock usage inside the RTS involves
-- potential write access, and (3) implementations of priority ceiling
-- locking that make a reader-writer distinction have higher overhead.
procedure Unlock (L : access Lock);
procedure Unlock (L : access RTS_Lock);
procedure Unlock (T : ST.Task_ID);
pragma Inline (Unlock);
-- Unlock a locked lock object.
--
-- The effect is undefined unless the calling task holds read or write
-- permission for the lock L, and L is the lock object most recently
-- locked by the calling task for which the calling task still holds
-- read or write permission. (That is, matching pairs of Lock and Unlock
-- operations on each lock object must be properly nested.)
-- Note that Write_Lock for RTS_Lock does not have an out-parameter.
-- RTS_Locks are used in situations where we have not made provision
-- for recovery from ceiling violations. We do not expect them to
-- occur inside the runtime system, because all RTS locks have ceiling
-- Priority'Last.
-- There is one way there can be a ceiling violation.
-- That is if the runtime system is called from a task that is
-- executing in the Interrupt_Priority range.
-- It is not clear what to do about ceiling violations due
-- to RTS calls done at interrupt priority. In general, it
-- is not acceptable to give all RTS locks interrupt priority,
-- since that whould give terrible performance on systems where
-- this has the effect of masking hardware interrupts, though we
-- could get away with allowing Interrupt_Priority'last where we
-- are layered on an OS that does not allow us to mask interrupts.
-- Ideally, we would like to raise Program_Error back at the
-- original point of the RTS call, but this would require a lot of
-- detailed analysis and recoding, with almost certain performance
-- penalties.
-- For POSIX systems, we considered just skipping setting a
-- priority ceiling on RTS locks. This would mean there is no
-- ceiling violation, but we would end up with priority inversions
-- inside the runtime system, resulting in failure to satisfy the
-- Ada priority rules, and possible missed validation tests.
-- This could be compensated-for by explicit priority-change calls
-- to raise the caller to Priority'Last whenever it first enters
-- the runtime system, but the expected overhead seems high, though
-- it might be lower than using locks with ceilings if the underlying
-- implementation of ceiling locks is an inefficient one.
-- This issue should be reconsidered whenever we get around to
-- checking for calls to potentially blocking operations from
-- within protected operations. If we check for such calls and
-- catch them on entry to the OS, it may be that we can eliminate
-- the possibility of ceiling violations inside the RTS. For this
-- to work, we would have to forbid explicitly setting the priority
-- of a task to anything in the Interrupt_Priority range, at least.
-- We would also have to check that there are no RTS-lock operations
-- done inside any operations that are not treated as potentially
-- blocking.
-- The latter approach seems to be the best, i.e. to check on entry
-- to RTS calls that may need to use locks that the priority is not
-- in the interrupt range. If there are RTS operations that NEED to
-- be called from interrupt handlers, those few RTS locks should then
-- be converted to PO-type locks, with ceiling Interrupt_Priority'Last.
-- For now, we will just shut down the system if there is a
-- ceiling violation.
procedure Yield (Do_Yield : Boolean := True);
pragma Inline (Yield);
-- Yield the processor. Add the calling task to the tail of the
-- ready queue for its active_priority.
-- The Do_Yield argument is only used in some very rare cases very
-- a yield should have an effect on a specific target and not on regular
-- ones.
procedure Set_Priority
(T : ST.Task_ID;
Prio : System.Any_Priority;
Loss_Of_Inheritance : Boolean := False);
pragma Inline (Set_Priority);
-- Set the priority of the task specified by T to T.Current_Priority.
-- The priority set is what would correspond to the Ada concept of
-- "base priority" in the terms of the lower layer system, but
-- the operation may be used by the upper layer to implement
-- changes in "active priority" that are not due to lock effects.
-- The effect should be consistent with the Ada Reference Manual.
-- In particular, when a task lowers its priority due to the loss of
-- inherited priority, it goes at the head of the queue for its new
-- priority (RM D.2.2 par 9).
-- Loss_Of_Inheritance helps the underlying implementation to do it
-- right when the OS doesn't.
function Get_Priority (T : ST.Task_ID) return System.Any_Priority;
pragma Inline (Get_Priority);
-- Returns the priority last set by Set_Priority for this task.
function Monotonic_Clock return Duration;
pragma Inline (Monotonic_Clock);
-- Returns "absolute" time, represented as an offset
-- relative to "the Epoch", which is Jan 1, 1970.
-- This clock implementation is immune to the system's clock changes.
function RT_Resolution return Duration;
pragma Inline (RT_Resolution);
-- Returns the resolution of the underlying clock used to implement
-- RT_Clock.
------------------
-- Extensions --
------------------
-- Whoever calls either of the Sleep routines is responsible
-- for checking for pending aborts before the call.
-- Pending priority changes are handled internally.
procedure Sleep
(Self_ID : ST.Task_ID;
Reason : System.Tasking.Task_States);
pragma Inline (Sleep);
-- Wait until the current task, T, is signaled to wake up.
--
-- precondition:
-- The calling task is holding its own ATCB lock
-- and has abort deferred
--
-- postcondition:
-- The calling task is holding its own ATCB lock
-- and has abort deferred.
-- The effect is to atomically unlock T's lock and wait, so that another
-- task that is able to lock T's lock can be assured that the wait has
-- actually commenced, and that a Wakeup operation will cause the waiting
-- task to become ready for execution once again. When Sleep returns,
-- the waiting task will again hold its own ATCB lock. The waiting task
-- may become ready for execution at any time (that is, spurious wakeups
-- are permitted), but it will definitely become ready for execution when
-- a Wakeup operation is performed for the same task.
procedure Timed_Sleep
(Self_ID : ST.Task_ID;
Time : Duration;
Mode : ST.Delay_Modes;
Reason : System.Tasking.Task_States;
Timedout : out Boolean;
Yielded : out Boolean);
-- Combination of Sleep (above) and Timed_Delay
procedure Timed_Delay
(Self_ID : ST.Task_ID;
Time : Duration;
Mode : ST.Delay_Modes);
-- Implements the semantics of the delay statement. It is assumed that
-- the caller is not abort-deferred and does not hold any locks.
procedure Wakeup
(T : ST.Task_ID;
Reason : System.Tasking.Task_States);
pragma Inline (Wakeup);
-- Wake up task T if it is waiting on a Sleep call (of ordinary
-- or timed variety), making it ready for execution once again.
-- If the task T is not waiting on a Sleep, the operation has no effect.
function Environment_Task return ST.Task_ID;
pragma Inline (Environment_Task);
-- returns the task ID of the environment task
-- Consider putting this into a variable visible directly
-- by the rest of the runtime system. ???
function Get_Thread_Id (T : ST.Task_ID) return OSI.Thread_Id;
-- returns the thread id of the specified task.
--------------------
-- Stack Checking --
--------------------
-- Stack checking in GNAT is done using the concept of stack probes. A
-- stack probe is an operation that will generate a storage error if
-- an insufficient amount of stack space remains in the current task.
-- The exact mechanism for a stack probe is target dependent. Typical
-- possibilities are to use a load from a non-existent page, a store
-- to a read-only page, or a comparison with some stack limit constant.
-- Where possible we prefer to use a trap on a bad page access, since
-- this has less overhead. The generation of stack probes is either
-- automatic if the ABI requires it (as on for example DEC Unix), or
-- is controlled by the gcc parameter -fstack-check.
-- When we are using bad-page accesses, we need a bad page, called a
-- guard page, at the end of each task stack. On some systems, this
-- is provided automatically, but on other systems, we need to create
-- the guard page ourselves, and the procedure Stack_Guard is provided
-- for this purpose.
procedure Stack_Guard (T : ST.Task_ID; On : Boolean);
-- Ensure guard page is set if one is needed and the underlying thread
-- system does not provide it. The procedure is as follows:
--
-- 1. When we create a task adjust its size so a guard page can
-- safely be set at the bottom of the stack
--
-- 2. When the thread is created (and its stack allocated by the
-- underlying thread system), get the stack base (and size, depending
-- how the stack is growing), and create the guard page taking care of
-- page boundaries issues.
--
-- 3. When the task is destroyed, remove the guard page.
--
-- If On is true then protect the stack bottom (i.e make it read only)
-- else unprotect it (i.e. On is True for the call when creating a task,
-- and False when a task is destroyed).
--
-- The call to Stack_Guard has no effect if guard pages are not used on
-- the target, or if guard pages are automatically provided by the system.
-----------------------------------------
-- Runtime System Debugging Interfaces --
-----------------------------------------
-- These interfaces have been added to assist in debugging the
-- tasking runtime system.
function Check_Exit (Self_ID : ST.Task_ID) return Boolean;
pragma Inline (Check_Exit);
-- Check that the current task is holding only Global_Task_Lock.
function Check_No_Locks (Self_ID : ST.Task_ID) return Boolean;
pragma Inline (Check_No_Locks);
-- Check that current task is holding no locks.
function Suspend_Task
(T : ST.Task_ID;
Thread_Self : OSI.Thread_Id)
return Boolean;
-- Suspend a specific task when the underlying thread library provides
-- such functionality, unless the thread associated with T is Thread_Self.
-- Such functionality is needed by gdb on some targets (e.g VxWorks)
-- Return True is the operation is successful
function Resume_Task
(T : ST.Task_ID;
Thread_Self : OSI.Thread_Id)
return Boolean;
-- Resume a specific task when the underlying thread library provides
-- such functionality, unless the thread associated with T is Thread_Self.
-- Such functionality is needed by gdb on some targets (e.g VxWorks)
-- Return True is the operation is successful
procedure Lock_All_Tasks_List;
procedure Unlock_All_Tasks_List;
-- Lock/Unlock the All_Tasks_L lock which protects
-- System.Initialization.All_Tasks_List and Known_Tasks
-- ??? These routines were previousely in System.Tasking.Initialization
-- but were moved here to avoid dependency problems. That would be
-- nice to look at it some day and put it back in Initialization.
end System.Task_Primitives.Operations;
|
tests/subnormal-target/src/main.adb | TUM-EI-RCS/StratoX | 12 | 3927 | with Ada.Real_Time; use Ada.Real_Time;
with HIL.GPIO; use HIL.GPIO;
with HIL.Clock; use HIL.Clock;
with Crash;
pragma Unreferenced (Crash);
with Calc;
procedure main with SPARK_Mode is
f1, f2, res : Float;
next : Time := Clock;
PERIOD : constant Time_Span := Milliseconds(500);
led_on : Boolean := False;
begin
HIL.Clock.configure;
HIL.GPIO.configure;
-- For the following tests, we have set system.Denorm (in RTS) to True
-- Test1: Subnormal OUT FROM FPU: OKAY
-- f1 := 0.00429291604;
-- f2 := -2.02303554e-38;
-- 0.00429291604*-2.02303554e-38 = -8.68468736e-41
-- Test2: Subnormal INTO FPU: WORKS.
f1 := 0.00429291604;
f2 := -8.68468736e-41; -- subnormal INTO FPU
-- 0.00429291604*-8.68468736e-41 = -3.72745392e-43.
res := Calc.calc (f1, f2); -- function call to force use of FPU
loop
if led_on then
write (RED_LED, HIGH);
else
write (RED_LED, LOW);
end if;
led_on := not led_on;
next := next + PERIOD;
delay until next;
end loop;
res := 0.0;
end main;
|
programs/oeis/195/A195162.asm | neoneye/loda | 22 | 90978 | <reponame>neoneye/loda<filename>programs/oeis/195/A195162.asm
; A195162: Generalized 12-gonal numbers: k*(5*k-4) for k = 0, +-1, +-2, ...
; 0,1,9,12,28,33,57,64,96,105,145,156,204,217,273,288,352,369,441,460,540,561,649,672,768,793,897,924,1036,1065,1185,1216,1344,1377,1513,1548,1692,1729,1881,1920,2080,2121,2289,2332,2508,2553,2737,2784,2976,3025,3225,3276,3484,3537,3753,3808,4032,4089,4321,4380,4620,4681,4929,4992,5248,5313,5577,5644,5916,5985,6265,6336,6624,6697,6993,7068,7372,7449,7761,7840,8160,8241,8569,8652,8988,9073,9417,9504,9856,9945,10305,10396,10764,10857,11233,11328,11712,11809,12201,12300
mov $1,$0
mov $2,$0
lpb $1
add $0,$2
sub $1,2
add $0,$1
add $0,5
add $2,4
lpe
|
libsrc/_DEVELOPMENT/arch/sms/SMSlib/c/sdcc/SMS_loadBGPalette.asm | jpoikela/z88dk | 640 | 18089 | <reponame>jpoikela/z88dk
; void SMS_loadBGPalette(void *palette)
SECTION code_clib
SECTION code_SMSlib
PUBLIC _SMS_loadBGPalette
EXTERN asm_SMSlib_loadBGPalette
_SMS_loadBGPalette:
pop af
pop hl
push hl
push af
jp asm_SMSlib_loadBGPalette
|
oeis/051/A051618.asm | neoneye/loda-programs | 11 | 101629 | ; A051618: a(n) = (4*n+6)(!^4)/6(!^4).
; 1,10,140,2520,55440,1441440,43243200,1470268800,55870214400,2346549004800,107941254220800,5397062711040000,291441386396160000,16903600410977280000,1048023225480591360000,69169532881719029760000,4841867301720332083200000,358298180327304574156800000,27947258065529756784230400000,2291675161373440056306892800000,197084063878115844842392780800000,17737565749030426035815350272000000,1667331180408860047366642925568000000,163398455680068284641931006705664000000,16666642479366965033476962683977728000000
mov $1,1
mov $2,6
lpb $0
sub $0,1
add $2,4
mul $1,$2
lpe
mov $0,$1
|
oeis/064/A064949.asm | neoneye/loda-programs | 0 | 3263 | <reponame>neoneye/loda-programs<gh_stars>0
; A064949: a(n) = Sum_{i|n, j|n} min(i,j).
; Submitted by <NAME>(w2)
; 1,5,6,15,8,32,10,37,23,42,14,100,16,52,52,83,20,125,22,132,64,72,26,252,45,82,76,162,32,286,34,177,88,102,88,397,40,112,100,336,44,352,46,222,208,132,50,572,75,239,124,252,56,416,120,414,136,162,62,916,64,172,258,367,136,480,70,312,160,474,74,1017,76,202,298,342,152,544,82,768,237,222,86,1126,168,232,196,564,92,1160,172,402,208,252,184,1228,100,393,354,759
add $0,1
lpb $0
mov $2,$0
lpb $0
mov $3,$2
dif $3,$0
lpb $3
add $5,$3
add $5,$3
cmp $3,$2
cmp $3,0
sub $3,1
add $4,$0
add $4,$5
lpe
sub $0,1
lpe
lpe
mov $0,$4
add $0,1
|
oeis/337/A337566.asm | neoneye/loda-programs | 11 | 17083 | ; A337566: a(n) is the number of possible decompositions of the polynomial n * (x + x^2 + ... + x^q), where q>1, into a sum of k polynomials, not necessarily all different; each of these polynomials is to be of the form b_1 * x + b_2 * x^2 + ... + b_q * x^q where each b_i is one of the numbers 1, 2, 3, ..., q and no two b_i are equal.
; Submitted by <NAME>(s3)
; 0,0,1,1,1,3,1,2,3,3,1,5,1,3,5,3,1,6,1,5,5,3,1,7,3,3,5,5,1,9,1,4,5,3,5,9,1,3,5,7,1,9,1,5,9,3,1,9,3,6,5,5,1,9,5,7,5,3,1,13,1,3,9,5,5,9,1,5,5,9,1,12,1,3,9,5,5,9,1,9,7,3,1,13,5,3,5,7,1,15,5,5
add $0,1
mov $2,$0
mul $2,2
lpb $0
mov $3,$2
dif $3,$0
sub $0,1
cmp $3,$2
cmp $3,0
add $4,$3
lpe
mul $4,2
mov $0,$4
sub $0,1
div $0,2
|
src/Relation/Traced.agda | mckeankylej/agda-ring-solver | 36 | 61 | {-# OPTIONS --without-K --safe #-}
open import Polynomial.Simple.AlmostCommutativeRing
open import Relation.Binary
open import Data.Bool using (Bool; false; true ; _∧_; _∨_; not; if_then_else_)
open import Data.String using (String)
open import EqBool
module Relation.Traced
{c ℓ}
(base : AlmostCommutativeRing c ℓ)
⦃ eqBase : HasEqBool (AlmostCommutativeRing.Carrier base) ⦄
(showBase : AlmostCommutativeRing.Carrier base → String)
where
open import Data.Sum
open import Relation.Binary.Construct.Closure.Equivalence
open import Relation.Binary.Construct.Closure.Symmetric
open import Relation.Binary.Construct.Closure.ReflexiveTransitive
open import Data.String
open import Relation.Nullary
open import Function
open import Level using (_⊔_)
open import Algebra.FunctionProperties
open import Data.String renaming (_==_ to eqBoolString)
open import Data.Maybe
open import Data.Nat using (ℕ)
open AlmostCommutativeRing base
open import Polynomial.Expr.Normalising rawRing showBase
open import Agda.Builtin.FromNat using (Number; fromNat) public
instance
numberVar : {{nc : Number Carrier}} → Number Expr
numberVar {{nc}} = record
{ Constraint = Number.Constraint nc
; fromNat = λ n → C ( (Number.fromNat nc n)) }
data BinOp : Set where
[+] : BinOp
[*] : BinOp
instance
eqBinOp : HasEqBool BinOp
EqBool._==_ ⦃ eqBinOp ⦄ [+] [+] = true
EqBool._==_ ⦃ eqBinOp ⦄ [+] [*] = false
EqBool._==_ ⦃ eqBinOp ⦄ [*] [+] = false
EqBool._==_ ⦃ eqBinOp ⦄ [*] [*] = true
liftBinOp : BinOp → Expr → Expr → Expr
liftBinOp [+] (C x) (C y) = normalise (C (x + y))
liftBinOp [+] (C x) (O y) = normalise (O (K x ⊕ y))
liftBinOp [+] (O x) (C y) = normalise (O (x ⊕ K y))
liftBinOp [+] (O x) (O y) = normalise (O (x ⊕ y))
liftBinOp [*] (C x) (C y) = normalise (C (x * y))
liftBinOp [*] (C x) (O y) = normalise (O (K x ⊗ y))
liftBinOp [*] (O x) (C y) = normalise (O (x ⊗ K y))
liftBinOp [*] (O x) (O y) = normalise (O (x ⊗ y))
⊟_ : Expr → Expr
⊟ C x = C (- x)
⊟ O x = normalise (O (⊝ x))
data Step : Set c where
[sym] : Step → Step
[cong] : Step → BinOp → Step → Step
[-cong] : Step → Step
[refl] : Expr → Step
[assoc] : BinOp → Expr → Expr → Expr → Step
[ident] : BinOp → Expr → Step
[comm] : BinOp → Expr → Expr → Step
[zero] : Expr → Step
[distrib] : Expr → Expr → Expr → Step
[-distrib] : Expr → Expr → Step
[-+comm] : Expr → Expr → Step
_==S_ : Step → Step → Bool
_==S_ ([sym] x) ([sym] y) = x ==S y
_==S_ ([cong] x x₁ x₂) ([cong] y y₁ y₂) = x ==S y ∧ x₁ EqBool.== y₁ ∧ x₂ ==S y₂
_==S_ ([-cong] x) ([-cong] y) = x ==S y
_==S_ ([assoc] x x₁ x₂ x₃) ([assoc] y y₁ y₂ y₃) = x EqBool.== y ∧ x₁ EqBool.== y₁ ∧ x₂ EqBool.== y₂ ∧ x₃ EqBool.== y₃
_==S_ ([ident] x x₁) ([ident] y y₁) = x EqBool.== y ∧ x₁ EqBool.== y₁
_==S_ ([comm] x x₁ x₂) ([comm] y y₁ y₂) = x EqBool.== y ∧ x₁ EqBool.== y₁ ∧ x₂ EqBool.== y₂
_==S_ ([zero] x) ([zero] y) = x EqBool.== y
_==S_ ([distrib] x x₁ x₂) ([distrib] y y₁ y₂) = x EqBool.== y ∧ x₁ EqBool.== y₁ ∧ x₂ EqBool.== y₂
_==S_ ([-distrib] x x₁) ([-distrib] y y₁) = x EqBool.== y ∧ x₁ EqBool.== y₁
_==S_ ([-+comm] x x₁) ([-+comm] y y₁) = x EqBool.== y ∧ x₁ EqBool.== y₁
_==S_ ([refl] x) ([refl] y) = x EqBool.== y
_==S_ _ _ = false
instance
eqStep : HasEqBool Step
EqBool._==_ {{eqStep}} = _==S_
record _≈ⁱ_ (x y : Expr) : Set c where
constructor ~?_
field
why : Step
open _≈ⁱ_
interesting : Step → Maybe Step
interesting ([sym] x) = interesting x
interesting ([-cong] x) = interesting x
interesting ([refl] x) = nothing
interesting ([assoc] x x₁ x₂ x₃) = nothing
interesting ([ident] x x₁) = nothing
interesting ([zero] x) = nothing
interesting ([cong] x x₁ x₂) with interesting x | interesting x₂
interesting ([cong] x x₁ x₂) | just res₁ | just res₂ = just ([cong] res₁ x₁ res₂)
interesting ([cong] x x₁ x₂) | just res₁ | nothing = just res₁
interesting ([cong] x x₁ x₂) | nothing | just res₂ = just res₂
interesting ([cong] x x₁ x₂) | nothing | nothing = nothing
interesting s@([comm] _ x y) with x EqBool.== y
interesting s@([comm] _ x y) | true = nothing
interesting s@([comm] o (C x) (C y)) | false = nothing
interesting s@([comm] [+] (C x) x₂) | false = if x EqBool.== 0# then nothing else just s
interesting s@([comm] [+] (O x) (C x₁)) | false = if x₁ EqBool.== 0# then nothing else just s
interesting s@([comm] [+] (O x) (O x₁)) | false = just s
interesting s@([comm] [*] (C x) x₂) | false = if (x EqBool.== 0# ∨ x EqBool.== 1#) then nothing else just s
interesting s@([comm] [*] (O x) (C x₁)) | false = if (x₁ EqBool.== 0# ∨ x₁ EqBool.== 1#) then nothing else just s
interesting s@([comm] [*] (O x) (O x₁)) | false = just s
interesting s@([distrib] (C _) (C _) (C _)) = nothing
interesting s@([distrib] (C x) x₁ x₂) = if (x EqBool.== 0# ∨ x EqBool.== 1#) then nothing else just s
interesting s@([distrib] x x₁ x₂) = just s
interesting s@([-distrib] x x₁) = nothing
interesting s@([-+comm] x x₁) = nothing
neg-cong : ∀ {x y} → x ≈ⁱ y → ⊟_ x ≈ⁱ ⊟_ y
neg-cong (~? reason) = ~? ( [-cong] reason)
zip-cong : BinOp
→ (f : Expr → Expr → Expr)
→ Congruent₂ (EqClosure _≈ⁱ_) f
zip-cong op f {x₁} {x₂} {y₁} {y₂} ε ε = ε
zip-cong op f {x₁} {x₂} {y₁} {y₂} ε (inj₁ (~? yr) ◅ ys) = inj₁ (~? ([cong] ([refl] x₁) op yr)) ◅ zip-cong op f ε ys
zip-cong op f {x₁} {x₂} {y₁} {y₂} ε (inj₂ (~? yr) ◅ ys) = inj₂ (~? ([cong] ([refl] x₁) op yr)) ◅ zip-cong op f ε ys
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₁ (~? xr) ◅ xs) ε = inj₁ (~? ([cong] xr op ([refl] y₁))) ◅ zip-cong op f xs ε
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₂ (~? xr) ◅ xs) ε = inj₂ (~? ([cong] xr op ([refl] y₁))) ◅ zip-cong op f xs ε
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₁ (~? xr) ◅ xs) (inj₁ (~? yr) ◅ ys) = inj₁ (~? ([cong] xr op yr)) ◅ zip-cong op f xs ys
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₁ (~? xr) ◅ xs) (inj₂ (~? yr) ◅ ys) = inj₁ (~? ([cong] xr op ([sym] yr))) ◅ zip-cong op f xs ys
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₂ (~? xr) ◅ xs) (inj₁ (~? yr) ◅ ys) = inj₂ (~? ([cong] xr op ([sym] yr))) ◅ zip-cong op f xs ys
zip-cong op f {x₁} {x₂} {y₁} {y₂} (inj₂ (~? xr) ◅ xs) (inj₂ (~? yr) ◅ ys) = inj₂ (~? ([cong] xr op yr)) ◅ zip-cong op f xs ys
isZero : (x : Expr) → Maybe (EqClosure _≈ⁱ_ (C 0#) x)
isZero (C x) = if 0# EqBool.== x then just (inj₁ (~? [refl] (C x)) ◅ ε) else nothing
isZero _ = nothing
tracedRing : AlmostCommutativeRing c c
tracedRing = record
{ Carrier = Expr
; _≈_ = EqClosure _≈ⁱ_
; _+_ = liftBinOp [+]
; _*_ = liftBinOp [*]
; -_ = ⊟_
; 0# = C 0#
; 1# = C 1#
; 0≟_ = isZero
; isAlmostCommutativeRing = record
{ -‿cong = Relation.Binary.Construct.Closure.ReflexiveTransitive.gmap ⊟_ (Data.Sum.map neg-cong neg-cong)
; -‿*-distribˡ = λ x y → return (inj₁ (~? [-distrib] x y))
; -‿+-comm = λ x y → return (inj₁ (~? [-+comm] x y))
; isCommutativeSemiring = record
{ distribʳ = λ x y z → return (inj₁ (~? [distrib] x y z))
; zeroˡ = λ x → return (inj₁ (~? ([zero] x)))
; *-isCommutativeMonoid = record
{ identityˡ = λ x → return (inj₁ (~? [ident] [*] x))
; comm = λ x y → return (inj₁ (~? [comm] [*] x y))
; isSemigroup = record
{ assoc = λ x y z → return (inj₁ (~? [assoc] [*] x y z))
; isMagma = record
{ isEquivalence = Relation.Binary.Construct.Closure.Equivalence.isEquivalence _≈ⁱ_
; ∙-cong = zip-cong [*] (liftBinOp [*])
}
}
}
; +-isCommutativeMonoid = record
{ identityˡ = λ x → return (inj₁ (~? ([ident] [+] x)))
; comm = λ x y → return (inj₁ (~? ([comm] [+] x y)))
; isSemigroup = record
{ assoc = λ x y z → return (inj₁ (~? ([assoc] [+] x y z)))
; isMagma = record
{ isEquivalence = Relation.Binary.Construct.Closure.Equivalence.isEquivalence _≈ⁱ_
; ∙-cong = zip-cong [+] (liftBinOp [+])
}
}
}
}
}
}
open import Data.List as List using (List; _∷_; [])
record Explanation {a} (A : Set a) : Set (a ⊔ c) where
constructor _≈⟨_⟩≈_
field
lhs : A
step : Step
rhs : A
open Explanation
toExplanation : ∀ {x y} → x ≈ⁱ y → Explanation Expr
toExplanation {x} {y} x≈y = x ≈⟨ why x≈y ⟩≈ y
showProof′ : ∀ {x y} → EqClosure _≈ⁱ_ x y → List (Explanation Expr)
showProof′ ε = []
showProof′ (inj₁ x ◅ xs) = toExplanation x ∷ showProof′ xs
showProof′ (inj₂ y ◅ xs) = toExplanation y ∷ showProof′ xs
open import Data.String.Printf
open Printf standard
⟨_⟩ₛ : Step → String
⟨ [sym] x ⟩ₛ = printf "sym (%s)" ⟨ x ⟩ₛ
⟨ [cong] x [+] x₂ ⟩ₛ = printf "(%s) + (%s)" ⟨ x ⟩ₛ ⟨ x₂ ⟩ₛ
⟨ [cong] x [*] x₂ ⟩ₛ = printf "(%s) * (%s)" ⟨ x ⟩ₛ ⟨ x₂ ⟩ₛ
⟨ [-cong] x ⟩ₛ = printf "- (%s)" ⟨ x ⟩ₛ
⟨ [refl] x ⟩ₛ = "eval"
⟨ [assoc] [+] x₁ x₂ x₃ ⟩ₛ = printf "+-assoc(%s, %s, %s)" ⟨ x₁ ⟩ₑ ⟨ x₂ ⟩ₑ ⟨ x₃ ⟩ₑ
⟨ [assoc] [*] x₁ x₂ x₃ ⟩ₛ = printf "*-assoc(%s, %s, %s)" ⟨ x₁ ⟩ₑ ⟨ x₂ ⟩ₑ ⟨ x₃ ⟩ₑ
⟨ [ident] [+] x₁ ⟩ₛ = printf "+-ident(%s)" ⟨ x₁ ⟩ₑ
⟨ [ident] [*] x₁ ⟩ₛ = printf "*-ident(%s)" ⟨ x₁ ⟩ₑ
⟨ [comm] [+] x₁ x₂ ⟩ₛ = printf "+-comm(%s, %s)" ⟨ x₁ ⟩ₑ ⟨ x₂ ⟩ₑ
⟨ [comm] [*] x₁ x₂ ⟩ₛ = printf "*-comm(%s, %s)" ⟨ x₁ ⟩ₑ ⟨ x₂ ⟩ₑ
⟨ [zero] x ⟩ₛ = printf "*-zero(%s)" ⟨ x ⟩ₑ
⟨ [distrib] x x₁ x₂ ⟩ₛ = printf "*-distrib(%s, %s, %s)" ⟨ x ⟩ₑ ⟨ x₁ ⟩ₑ ⟨ x₂ ⟩ₑ
⟨ [-distrib] x x₁ ⟩ₛ = printf "-‿distrib(%s, %s)" ⟨ x ⟩ₑ ⟨ x₁ ⟩ₑ
⟨ [-+comm] x x₁ ⟩ₛ = printf "-+-comm(%s, %s)" ⟨ x ⟩ₑ ⟨ x₁ ⟩ₑ
showProof : ∀ {x y} → EqClosure _≈ⁱ_ x y → List String
showProof = List.foldr unparse [] ∘ List.foldr spotReverse [] ∘ List.mapMaybe interesting′ ∘ showProof′
where
unparse : Explanation Expr → List String → List String
unparse (lhs₁ ≈⟨ step₁ ⟩≈ rhs₁) [] = ⟨ lhs₁ ⟩ₑ ∷ printf " ={ %s }" ⟨ step₁ ⟩ₛ ∷ ⟨ rhs₁ ⟩ₑ ∷ []
unparse (lhs₁ ≈⟨ step₁ ⟩≈ rhs₁) (y ∷ ys) = if r EqBool.== y then l ∷ m ∷ y ∷ ys else l ∷ m ∷ r ∷ " ={ eval }" ∷ y ∷ ys
where
l = ⟨ lhs₁ ⟩ₑ
m = printf " ={ %s }" ⟨ step₁ ⟩ₛ
r = ⟨ rhs₁ ⟩ₑ
spotReverse : Explanation Expr → List (Explanation Expr) → List (Explanation Expr)
spotReverse x [] = x ∷ []
spotReverse x (y ∷ xs) = if lhs x EqBool.== rhs y then xs else x ∷ y ∷ xs
interesting′ : Explanation Expr → Maybe (Explanation Expr)
interesting′ (lhs ≈⟨ stp ⟩≈ rhs) with interesting stp
interesting′ (lhs ≈⟨ stp ⟩≈ rhs) | just x = just (lhs ≈⟨ x ⟩≈ rhs)
interesting′ (lhs ≈⟨ stp ⟩≈ rhs) | nothing = nothing
open import Agda.Builtin.FromString using (IsString; fromString) public
import Data.String.Literals
open import Data.Unit using (⊤)
open import Level using (Lift)
instance
stringString : IsString String
stringString = Data.String.Literals.isString
instance
lift-inst : ∀ {ℓ a} { A : Set a } → ⦃ x : A ⦄ → Lift ℓ A
lift-inst ⦃ x = x ⦄ = Level.lift x
instance
exprString : IsString Expr
exprString = record
{ Constraint = λ _ → Lift _ ⊤ ; fromString = λ s → O (V s) }
|
oeis/199/A199930.asm | neoneye/loda-programs | 11 | 164593 | ; A199930: Trisection 0 of A199803.
; Submitted by <NAME>
; 1,-2,-1,12,-10,-49,112,111,-710,316,3233,-5634,-9505,40592,-1934,-204897,264664,717295,-2243578,-873336,12543857,-11138050,-50210993,119318436,108054622,-743719745,372976064,3334358847,-6051013534,-9504084892,42720535345,-4585483266,-212470264817,287622301384,727423004090,-2373419292561,-763603161688,13070500327199,-12353326815410,-51389358689712,126990096255649,104532870050302,-778519383202849,434234487896700,3435905201912198,-6490129894648849,-9476642243812592,44928962431072335
mul $0,3
add $0,3
lpb $0
sub $0,1
add $2,1
sub $3,$4
add $1,$3
mov $5,$4
mov $4,$2
add $5,$2
mov $2,$3
add $4,$1
sub $5,$1
mov $3,$5
lpe
mov $0,$2
|
libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccix_pow_callee.asm | jpoikela/z88dk | 640 | 97188 | <filename>libsrc/_DEVELOPMENT/math/float/math48/c/sdcc_ix/cm48_sdccix_pow_callee.asm
; float pow(float x, float y) __z88dk_callee
SECTION code_clib
SECTION code_fp_math48
PUBLIC cm48_sdccix_pow_callee, l0_cm48_sdccix_pow_callee
EXTERN am48_pow, cm48_sdccixp_dcallee2, cm48_sdccixp_m482d
cm48_sdccix_pow_callee:
call cm48_sdccixp_dcallee2
; AC'= y
; AC = x
l0_cm48_sdccix_pow_callee:
exx
call am48_pow
jp cm48_sdccixp_m482d
|
src/SlimShader.Tests/Shaders/Sdk/Direct3D11/FluidCS11/FluidRender_VS.asm | tgjones/slimshader | 125 | 242133 | //
// Generated by Microsoft (R) HLSL Shader Compiler 9.30.9200.20714
//
//
///
// Buffer Definitions:
//
// Resource bind info for ParticlesRO
// {
//
// struct Particle
// {
//
// float2 position; // Offset: 0
// float2 velocity; // Offset: 8
//
// } $Element; // Offset: 0 Size: 16
//
// }
//
// Resource bind info for ParticleDensityRO
// {
//
// struct ParticleDensity
// {
//
// float density; // Offset: 0
//
// } $Element; // Offset: 0 Size: 4
//
// }
//
//
// Resource Bindings:
//
// Name Type Format Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// ParticlesRO texture struct r/o 0 1
// ParticleDensityRO texture struct r/o 1 1
//
//
//
// Input signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_VertexID 0 x 0 VERTID uint x
//
//
// Output signature:
//
// Name Index Mask Register SysValue Format Used
// -------------------- ----- ------ -------- -------- ------- ------
// POSITION 0 xy 0 NONE float xy
// COLOR 0 xyzw 1 NONE float xyzw
//
vs_5_0
dcl_globalFlags refactoringAllowed
dcl_immediateConstantBuffer { { 1.000000, 0, 0, 1.000000},
{ 1.000000, 1.000000, 0, 1.000000},
{ 0, 1.000000, 0, 1.000000},
{ 0, 1.000000, 1.000000, 1.000000},
{ 0, 0, 1.000000, 1.000000} }
dcl_resource_structured t0, 16
dcl_resource_structured t1, 4
dcl_input_sgv v0.x, vertex_id
dcl_output o0.xy
dcl_output o1.xyzw
dcl_temps 3
ld_structured_indexable(structured_buffer, stride=16)(mixed,mixed,mixed,mixed) o0.xy, v0.x, l(0), t0.xyxx
ld_structured_indexable(structured_buffer, stride=4)(mixed,mixed,mixed,mixed) r0.x, v0.x, l(0), t1.xxxx
add r0.x, r0.x, l(-1000.000000)
mul_sat r0.x, r0.x, l(0.001000)
mul r0.x, r0.x, l(4.000000)
round_pi r0.y, r0.x
ftou r0.y, r0.y
mov r1.xyz, icb[r0.y + 0].xyzx
round_ni r0.y, r0.x
frc r0.x, r0.x
ftou r0.y, r0.y
mov r2.xyz, icb[r0.y + 0].xyzx
mov r1.w, l(1.000000)
mov r2.w, l(1.000000)
add r1.xyzw, r1.xyzw, -r2.xyzw
mad o1.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
ret
// Approximately 17 instruction slots used
|
code/Forec/t38.asm | KongoHuster/assembly-exercise | 1 | 162340 | ;; last edit date: 2016/10/26
;; author: Forec
;; LICENSE
;; Copyright (c) 2015-2017, Forec <<EMAIL>>
;; Permission to use, copy, modify, and/or distribute this code for any
;; purpose with or without fee is hereby granted, provided that the above
;; copyright notice and this permission notice appear in all copies.
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
;; WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
;; MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
;; ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
;; WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
;; ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
;; OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
title forec_t38
data segment
val1 dw 1234h
bininfo db 'BIN: $'
octinfo db 'OCT: $'
skip db 0dh, 0ah, '$'
data ends
stack segment para stack 'stack'
db 100h dup(?)
stack ends
code segment
assume cs:code, ds:data
start:
mov ax, data
mov ds, ax
mov es, ax
call bando
quit_pro:
mov ah, 4ch
int 21h
bando proc near
push val1
call pairs
ret
bando endp
pairs proc near
pop bx
pop ax
push bx
call outbin
call outoct
ret
pairs endp
outbin proc near
push ax
push bx
push cx
push dx
mov bx, ax
mov ah, 09h
mov dx, offset bininfo
int 21h
mov cx, 10h
mov ah, 02h
loopp1:
mov dl, bh
and dl, 10000000b
push cx
mov cl, 07h
shr dl, cl
pop cx
add dl, 30h
int 21h
shl bx, 1
loop loopp1
mov ah, 02h
mov dl, 'B'
int 21h ;; 输出 B
call nextline
pop dx
pop cx
pop bx
pop ax
ret
outbin endp
outoct proc near
push ax
push bx
push cx
push dx
mov bx, ax
mov dx, offset octinfo
mov ah, 09h
int 21h
mov ah, 02h
mov dl, bh
and dl, 10000000b
mov cl, 07h
shr dl, cl
add dl, 30h
int 21h ;; 输出第一位
shl bx, 1
mov cx, 05h
loopp2:
mov dl, bh
and dl, 11100000b
push cx
mov cl, 05h
shr dl, cl ;; 八进制右移5位
mov cl, 03h
shl bx, cl ;; 原数左移3位
pop cx
add dl, 30h
int 21h
loop loopp2
mov ah, 02h
mov dl, 'O'
int 21h ;; 输出 O
call nextline
pop dx
pop cx
pop bx
pop ax
ret
outoct endp
nextline proc near
push ax
push dx
mov ah, 09h
mov dx, offset skip
int 21h
pop dx
pop ax
ret
nextline endp
code ends
end start |
TakeScreenShot.scpt | hascong/ExerciseForAppleScript | 0 | 281 | <filename>TakeScreenShot.scpt
-- Take screen shot
-- Save to desktop
-- File name use current date and time
set desktopPath to POSIX path of (path to desktop as string)
set currentDate to current date
set shellCommandToTakeScreenShot to "/usr/sbin/screencapture \"" & desktopPath & "Screen Shot " & currentDate & ".png\""
do shell script shellCommandToTakeScreenShot
|
ADL/drivers/stm32g474/stm32-rng.adb | JCGobbi/Nucleo-STM32G474RE | 0 | 8183 | <reponame>JCGobbi/Nucleo-STM32G474RE
------------------------------------------------------------------------------
-- --
-- Copyright (C) 2015, AdaCore --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions are --
-- met: --
-- 1. Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- 2. Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in --
-- the documentation and/or other materials provided with the --
-- distribution. --
-- 3. Neither the name of STMicroelectronics nor the names of its --
-- contributors may be used to endorse or promote products derived --
-- from this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT --
-- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, --
-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY --
-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT --
-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE --
-- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
-- --
-- This file is based on: --
-- --
-- @file stm32f4xx_hal_rng.c --
-- @author MCD Application Team --
-- @version V1.1.0 --
-- @date 19-June-2014 --
-- @brief RNG HAL module driver. --
-- --
-- COPYRIGHT(c) 2014 STMicroelectronics --
------------------------------------------------------------------------------
with STM32_SVD.RCC; use STM32_SVD.RCC;
with STM32_SVD.RNG; use STM32_SVD.RNG;
package body STM32.RNG is
------------
-- Enable --
------------
procedure Enable (This : in out RNG_Generator) is
begin
This.CR.RNGEN := True;
end Enable;
-------------
-- Disable --
-------------
procedure Disable (This : in out RNG_Generator) is
begin
This.CR.RNGEN := False;
end Disable;
-------------
-- Enabled --
-------------
function Enabled (This : RNG_Generator) return Boolean is
(This.CR.RNGEN);
----------------------
-- Enable_Interrupt --
----------------------
procedure Enable_Interrupt (This : in out RNG_Generator) is
begin
This.CR.IE := True;
end Enable_Interrupt;
-----------------------
-- Disable_Interrupt --
-----------------------
procedure Disable_Interrupt (This : in out RNG_Generator) is
begin
This.CR.IE := False;
end Disable_Interrupt;
-----------------------
-- Interrupt_Enabled --
-----------------------
function Interrupt_Enabled (This : RNG_Generator) return Boolean is
(This.CR.IE);
---------------
-- Read_Data --
---------------
function Read_Data (This : RNG_Generator) return UInt32
is (This.DR);
------------
-- Status --
------------
function Status
(This : RNG_Generator;
Flag : Status_Flag) return Boolean
is
begin
case Flag is
when Data_Ready =>
return This.SR.DRDY;
when Clock_Error =>
return This.SR.CECS;
when Seed_Error =>
return This.SR.SECS;
when Clock_Error_Interrupt =>
return This.SR.CEIS;
when Seed_Error_Interrupt =>
return This.SR.SEIS;
end case;
end Status;
-----------------------------
-- Clear_Interrupt_Pending --
-----------------------------
procedure Clear_Interrupt_Pending
(This : in out RNG_Generator;
Flag : Clearable_Status_Flag)
is
begin
case Flag is
when Clock_Error_Interrupt =>
This.SR.CEIS := False;
when Seed_Error_Interrupt =>
This.SR.CEIS := False;
end case;
end Clear_Interrupt_Pending;
end STM32.RNG;
|
programs/oeis/039/A039274.asm | karttu/loda | 1 | 174195 | <filename>programs/oeis/039/A039274.asm
; A039274: Numbers n such that representation in base 12 has same number of 10's and 11's.
; 0,1,2,3,4,5,6,7,8,9,12,13,14,15,16,17,18,19,20,21,24,25,26,27,28,29,30,31,32,33,36,37,38,39,40,41,42,43,44,45,48,49,50,51,52,53,54,55,56,57,60,61,62,63,64,65,66,67,68,69,72,73,74,75,76,77,78,79,80,81
mov $1,$0
div $0,10
mul $0,2
add $1,$0
|
tests/natools-chunked_strings-tests-cxa4031.adb | faelys/natools | 0 | 3885 | ------------------------------------------------------------------------------
-- Copyright (c) 2011, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
with Ada.Exceptions;
procedure Natools.Chunked_Strings.Tests.CXA4031
(Report : in out Natools.Tests.Reporter'Class)
is
package NT renames Natools.Tests;
begin
NT.Section (Report, "Port of ACATS CXA4031");
declare
subtype LC_Characters is Character range 'a' .. 'z';
Null_String : constant String := "";
TC_String : constant String := "A Standard String";
TC_Chunked_String,
TC_New_Chunked_String : Chunked_String := Null_Chunked_String;
begin
NT.Section (Report, "Function To_Chunked_String with Length parameter");
declare
Name : constant String := "Length = 10";
Result : Natural;
begin
Result := Length (To_Chunked_String (Length => 10));
if Result = 10 then
NT.Item (Report, Name, NT.Success);
else
NT.Item (Report, Name, NT.Fail);
NT.Info (Report, "Found length" & Natural'Image (Result));
end if;
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Singleton";
Result : Natural;
begin
Result := Length (To_Chunked_String (1));
if Result = 1 then
NT.Item (Report, Name, NT.Success);
else
NT.Item (Report, Name, NT.Fail);
NT.Info (Report, "Found length" & Natural'Image (Result));
end if;
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty string";
Result : Natural;
begin
Result := Length (To_Chunked_String (0));
if Result = 0 then
NT.Item (Report, Name, NT.Success);
else
NT.Item (Report, Name, NT.Fail);
NT.Info (Report, "Found length" & Natural'Image (Result));
end if;
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Concatenation of the above";
Result : Natural;
begin
Result := Length (To_Chunked_String (Length => 10)
& To_Chunked_String (1)
& To_Chunked_String (0));
if Result = 10 + 1 + 0 then
NT.Item (Report, Name, NT.Success);
else
NT.Item (Report, Name, NT.Fail);
NT.Info (Report, "Found length" & Natural'Image (Result));
end if;
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Procedure Append (Chunked, Chunked)");
declare
Name : constant String := "Non-empty and non-empty";
begin
TC_Chunked_String := To_Chunked_String ("Sample string of length L");
TC_New_Chunked_String := To_Chunked_String (" and then some");
Append (TC_Chunked_String, TC_New_Chunked_String);
Test (Report, Name, TC_Chunked_String,
"Sample string of length L and then some");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Non-empty and empty";
begin
TC_Chunked_String := To_Chunked_String ("Sample string of length L");
TC_New_Chunked_String := Null_Chunked_String;
Test (Report, Name, TC_Chunked_String, "Sample string of length L");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty and non-empty";
begin
TC_Chunked_String := Null_Chunked_String;
Append (TC_Chunked_String,
To_Chunked_String ("New Chunked String"));
Test (Report, Name, TC_Chunked_String, "New Chunked String");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Procedure Append (Chunked, String)");
declare
Name : constant String := "Non-empty and non-empty";
begin
TC_Chunked_String := To_Chunked_String ("A Chunked String and ");
Append (Source => TC_Chunked_String, New_Item => TC_String);
Test (Report, Name, TC_Chunked_String,
"A Chunked String and A Standard String");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Non-empty and empty";
begin
TC_Chunked_String := To_Chunked_String ("A Chunked String");
Append (TC_Chunked_String, New_Item => Null_String);
Test (Report, Name, TC_Chunked_String, "A Chunked String");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty and non-empty";
begin
TC_Chunked_String := Null_Chunked_String;
Append (TC_Chunked_String, TC_String);
Test (Report, Name, TC_Chunked_String, "A Standard String");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Procedure Append (Chunked, Character)");
declare
Name : constant String := "Non-empty initial string";
begin
TC_Chunked_String := To_Chunked_String ("Lower Case = ");
for I in LC_Characters'Range loop
Append (Source => TC_Chunked_String,
New_Item => I);
end loop;
Test (Report, Name, TC_Chunked_String,
"Lower Case = abcdefghijklmnopqrstuvwxyz");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty initial string";
begin
TC_Chunked_String := Null_Chunked_String;
Append (TC_Chunked_String, New_Item => 'a');
Test (Report, Name, TC_Chunked_String, "a");
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Function ""=""");
TC_Chunked_String := To_Chunked_String (TC_String);
declare
Name : constant String := "Chunked_String and String";
begin
NT.Item (Report, Name, NT.To_Result (TC_Chunked_String = TC_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "String and Chunked_String";
begin
NT.Item (Report, Name,
NT.To_Result ("A Standard String" = TC_Chunked_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty chunked string and empty string";
begin
NT.Item (Report, Name, NT.To_Result (Null_Chunked_String = ""));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "With inline conversion";
begin
NT.Item (Report, Name,
NT.To_Result ("Test String" = To_Chunked_String ("Test String")));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Function ""<""");
declare
Name : constant String := "Differing by a trailing space";
begin
NT.Item (Report, Name,
NT.To_Result ("Extra Space" < To_Chunked_String ("Extra Space ")));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by the last letter";
begin
NT.Item (Report, Name,
NT.To_Result (To_Chunked_String ("tess") < "test"));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by the first letter";
begin
NT.Item (Report, Name,
NT.To_Result (To_Chunked_String ("best") < "test"));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty strings";
begin
NT.Item (Report, Name,
NT.To_Result (not (Null_Chunked_String < Null_String)));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Equal with leading blank";
begin
NT.Item (Report, Name,
NT.To_Result (not (" leading blank"
< To_Chunked_String (" leading blank"))));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Equal with ending blank";
begin
NT.Item (Report, Name,
NT.To_Result (not ("ending blank "
< To_Chunked_String ("ending blank "))));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Function ""<=""");
TC_Chunked_String := To_Chunked_String ("Sample string");
declare
Name : constant String := "Prefix";
begin
NT.Item (Report, Name,
NT.To_Result (not (TC_Chunked_String <= "Sample strin")));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by case";
begin
NT.Item (Report, Name,
NT.To_Result (not ("sample string" <= TC_Chunked_String)));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty strings";
begin
NT.Item (Report, Name, NT.To_Result (Null_Chunked_String <= ""));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Equal strings";
begin
NT.Item (Report, Name,
NT.To_Result ("Sample string" <= TC_Chunked_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Function "">""");
TC_Chunked_String := To_Chunked_String ("A MUCH LONGER STRING");
declare
Name : constant String := "Differing by case";
begin
NT.Item (Report, Name,
NT.To_Result ("A much longer string" > TC_Chunked_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Prefix";
begin
NT.Item (Report, Name,
NT.To_Result (To_Chunked_String (TC_String) > "A Standard Strin"));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by case";
begin
NT.Item (Report, Name,
NT.To_Result ("abcdefgh" > To_Chunked_String ("ABCDEFGH")));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty strings";
begin
NT.Item (Report, Name,
NT.To_Result (not (Null_Chunked_String > Null_String)));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
NT.Section (Report, "Function "">=""");
TC_Chunked_String := To_Chunked_String (TC_String);
declare
Name : constant String := "Equal strings";
begin
NT.Item (Report, Name, NT.To_Result (TC_Chunked_String >= TC_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Empty strings";
begin
NT.Item (Report, Name,
NT.To_Result (Null_String >= Null_Chunked_String));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by the last letter";
begin
NT.Item (Report, Name,
NT.To_Result ("test" >= To_Chunked_String ("tess")));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
declare
Name : constant String := "Differing by case";
begin
NT.Item (Report, Name,
NT.To_Result (To_Chunked_String ("Programming") >= "PROGRAMMING"));
exception
when Error : others => NT.Report_Exception (Report, Name, Error);
end;
NT.End_Section (Report);
exception
when Error : others =>
NT.Item (Report, "Preparation", NT.Error);
NT.Info (Report, "Exception: "
& Ada.Exceptions.Exception_Name (Error));
NT.Info (Report, Ada.Exceptions.Exception_Message (Error));
end;
NT.End_Section (Report);
end Natools.Chunked_Strings.Tests.CXA4031;
|
Hardware/ADS Gerbers/Oscar_Romeu_mmGerbers_wrk/workspace.ads | oscaromeu/FMCW-Radar | 0 | 25982 | <ADSWorkspace Revision="2" Version="100">
<Workspace Name="">
<Library Name="ads_standard_layers" />
<Library Name="adstechlib" />
<Library Name="ads_schematic_layers" />
<Library Name="empro_standard_layers" />
<Library Name="ads_standard_layers_ic" />
<Library Name="ads_schematic_layers_ic" />
<Library Name="ads_schematic_ports_ic" />
<Library Name="ads_rflib" />
<Library Name="ads_sources" />
<Library Name="ads_simulation" />
<Library Name="ads_tlines" />
<Library Name="ads_bondwires" />
<Library Name="ads_datacmps" />
<Library Name="ads_behavioral" />
<Library Name="ads_textfonts" />
<Library Name="ads_common_cmps" />
<Library Name="ads_designs" />
<Library Name="ads_verification_test_bench" />
<Library Name="Oscar_Romeu_mmGerbers_lib" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:GainBlock" />
<Log Name="readgbr.log" />
<Log Name="search_history.log" />
<Log Name="writegbr.log" />
<Preferences Name="layout.prf" />
<Preferences Name="Oscar_Romeu_mmGerbers_lib_lay.prf" />
<Preferences Name="schematic.prf" />
<LibraryDefs Name="lib.defs" />
<ConfigFile Name="de_sim.cfg" />
<ConfigFile Name="hpeesofsim.cfg" />
<Layer_Preference Name="ads_standard_layers.layerprf" />
<Layer_Preference Name="Oscar_Romeu_mmGerbers_lib.layerprf" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:PowerDivider" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:PowerDividerOpen" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:PowerDividerShort" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:PowerDividerLoad" />
<Cell Name="Oscar_Romeu_mmGerbers_lib:RadarFMCW" />
</Workspace>
</ADSWorkspace>
|
src/main/antlr/CalcParser.g4 | TMPHAM1/AntlrMonacoPractice | 0 | 6208 | parser grammar CalcParser;
options { tokenVocab=CalcLexer; }
compilationUnit:
(products+=product)*
(inputs+=input)*
(calcs+=calc)*
(outputs+=output)*
EOF
;
product: PRODUCT_KW productIdentifier productCountryIssuance productClass eol;
productCountryIssuance :
PRODUCT_COUNTRY_LIST
;
productClass :
PRODUCT_CLASS
;
productIdentifier :
IDENTIFIER
;
eol:
NL
;
input:
INPUT_KW ID eol
;
output:
OUTPUT_KW ID eol
;
calc:
target=ID EQUAL value=expression eol
;
expression:
NUMBER_LIT
| ID
| LPAREN expression RPAREN
| expression operator=(MUL|DIV) expression
| expression operator=(MINUS|PLUS) expression
| MINUS expression
;
|
TotalParserCombinators/InitialBag.agda | nad/parser-combinators | 1 | 13487 | ------------------------------------------------------------------------
-- Lemmas about the initial bag index
------------------------------------------------------------------------
module TotalParserCombinators.InitialBag where
open import Category.Monad
open import Data.List
import Data.List.Categorical
open import Data.List.Membership.Propositional using (_∈_)
open import Data.List.Membership.Propositional.Properties as M
hiding (⊛-∈↔)
open import Data.List.Relation.Binary.BagAndSetEquality
using () renaming (_∼[_]_ to _List-∼[_]_)
open import Data.List.Relation.Unary.Any
open import Data.List.Relation.Unary.Any.Properties
open import Data.Maybe hiding (_>>=_)
open import Data.Product
open import Data.Sum
open import Function.Base
open import Function.Equality using (_⟨$⟩_)
open import Function.Inverse as Inv using (_↔_)
import Function.Related as Related
open import Level
open import Relation.Binary.PropositionalEquality as P
using (_≡_; refl)
open import Relation.Binary.HeterogeneousEquality as H
using (refl) renaming (_≅_ to _≅′_)
open Inv.Inverse
open RawMonadPlus {f = zero} Data.List.Categorical.monadPlus
using () renaming (_⊛_ to _⊛′_)
open Related using (SK-sym)
open import TotalParserCombinators.Parser
open import TotalParserCombinators.Semantics
------------------------------------------------------------------------
-- Optimisation
private
abstract
⊛-∈↔ : ∀ {A B : Set} (fs : List (A → B)) {xs y} →
(∃₂ λ f x → f ∈ fs × x ∈ xs × y ≡ f x) ↔ y ∈ (fs ⊛′ xs)
⊛-∈↔ = M.⊛-∈↔
------------------------------------------------------------------------
-- Sanity check: The initial set index is correctly defined
mutual
complete : ∀ {Tok R xs x} {p : Parser Tok R xs} →
x ∈ p · [] → x ∈ xs
complete x∈p = complete′ x∈p refl
private
complete′ : ∀ {Tok R xs x s} {p : Parser Tok R xs} →
x ∈ p · s → s ≡ [] → x ∈ xs
complete′ return refl = to return↔ ⟨$⟩ refl
complete′ (∣-left x∈p₁) refl = to ++↔ ⟨$⟩ inj₁ (complete x∈p₁)
complete′ (∣-right xs₁ x∈p₂) refl = to (++↔ {P = _≡_ _}
{xs = xs₁}) ⟨$⟩ inj₂ (complete x∈p₂)
complete′ (<$> x∈p) refl = to (map-∈↔ _) ⟨$⟩ (_ , complete x∈p , refl)
complete′ (_⊛_ {s₁ = []} {xs = just _} f∈p₁ x∈p₂) refl = to (⊛-∈↔ _) ⟨$⟩ (_ , _ , complete f∈p₁
, complete x∈p₂ , refl)
complete′ (_>>=_ {s₁ = []} {xs = just xs} {f = just _} x∈p₁ y∈p₂x) refl = to (>>=-∈↔ {xs = xs}) ⟨$⟩ (_ , complete x∈p₁
, complete y∈p₂x)
complete′ (cast {xs₁≈xs₂ = xs₁≈xs₂} x∈p) refl = to xs₁≈xs₂ ⟨$⟩ complete x∈p
complete′ (_⊛_ {s₁ = []} {xs = nothing} f∈p₁ x∈p₂) refl with complete x∈p₂
... | ()
complete′ (_>>=_ {s₁ = []} {xs = nothing} x∈p₁ y∈p₂x) refl with complete x∈p₁
... | ()
complete′ (_>>=_ {s₁ = []} {xs = just _} {f = nothing} x∈p₁ y∈p₂x) refl with complete y∈p₂x
... | ()
complete′ token ()
complete′ (_⊛_ {s₁ = _ ∷ _} _ _) ()
complete′ (_>>=_ {s₁ = _ ∷ _} _ _) ()
complete′ (nonempty _) ()
mutual
sound : ∀ {Tok R xs x} (p : Parser Tok R xs) →
x ∈ xs → x ∈ p · []
sound (return x) (here refl) = return
sound (_∣_ {xs₁ = xs₁} p₁ p₂) x∈xs with from (++↔ {P = _≡_ _} {xs = xs₁}) ⟨$⟩ x∈xs
... | inj₁ x∈xs₁ = ∣-left (sound p₁ x∈xs₁)
... | inj₂ x∈xs₂ = ∣-right xs₁ (sound p₂ x∈xs₂)
sound (f <$> p) x∈xs with from (map-∈↔ f) ⟨$⟩ x∈xs
... | (y , y∈xs , refl) = <$> sound p y∈xs
sound (_⊛_ {fs = fs} {just xs} p₁ p₂) y∈ys
with from (⊛-∈↔ (flatten fs) {xs = xs}) ⟨$⟩ y∈ys
sound (_⊛_ {fs = nothing} {just xs} p₁ p₂) y∈ys | (f′ , x′ , () , x′∈xs , refl)
sound (_⊛_ {fs = just fs} {just xs} p₁ p₂) y∈ys | (f′ , x′ , f′∈fs , x′∈xs , refl) =
_⊛_ {fs = ○} {xs = ○} (sound p₁ f′∈fs) (sound p₂ x′∈xs)
sound (_>>=_ {xs = zs} {f = just f} p₁ p₂) y∈ys
with from (>>=-∈↔ {xs = flatten zs} {f = f}) ⟨$⟩ y∈ys
... | (x , x∈zs , y∈fx) =
_>>=_ {xs = zs} {f = just f} (sound p₁ x∈zs) (sound′ (p₂ x) x∈zs y∈fx)
sound (cast xs₁≈xs₂ p) x∈xs = cast (sound p (from xs₁≈xs₂ ⟨$⟩ x∈xs))
sound (return _) (there ())
sound fail ()
sound token ()
sound (_⊛_ {xs = nothing} _ _) ()
sound (_>>=_ {f = nothing} _ _) ()
sound (nonempty _) ()
private
sound′ : ∀ {Tok R₁ R₂ x y xs} {zs : Maybe (List R₁)}
(p : ∞⟨ zs ⟩Parser Tok R₂ xs) →
x ∈ flatten zs → y ∈ xs → y ∈ ♭? p · []
sound′ {zs = just _} p _ = sound p
sound′ {zs = nothing} p ()
mutual
sound∘complete : ∀ {Tok R xs x} {p : Parser Tok R xs}
(x∈p : x ∈ p · []) →
sound p (complete x∈p) ≡ x∈p
sound∘complete x∈p = H.≅-to-≡ (sound∘complete′ x∈p refl)
private
sound∘complete′ : ∀ {Tok R xs x s} {p : Parser Tok R xs}
(x∈p : x ∈ p · s) (s≡[] : s ≡ []) →
sound p (complete′ x∈p s≡[]) ≅′ x∈p
sound∘complete′ return refl = refl
sound∘complete′ (∣-left {xs₁ = xs₁} {xs₂ = xs₂} x∈p₁) refl
rewrite left-inverse-of (++↔ {P = _≡_ _} {xs = xs₁} {ys = xs₂}) (inj₁ (complete x∈p₁)) =
H.cong _∈_·_.∣-left (sound∘complete′ x∈p₁ refl)
sound∘complete′ (∣-right xs₁ x∈p₂) refl
rewrite left-inverse-of (++↔ {P = _≡_ _} {xs = xs₁}) (inj₂ (complete x∈p₂)) =
H.cong (_∈_·_.∣-right xs₁) (sound∘complete′ x∈p₂ refl)
sound∘complete′ (<$>_ {f = f} x∈p) refl
rewrite left-inverse-of (map-∈↔ f) (_ , complete x∈p , refl) =
H.cong _∈_·_.<$>_ (sound∘complete′ x∈p refl)
sound∘complete′ (_⊛_ {s₁ = []} {fs = fs} {xs = just xs} f∈p₁ x∈p₂) refl
with complete f∈p₁ | complete x∈p₂
| from inv ⟨$⟩ (to inv ⟨$⟩ (_ , _ , complete f∈p₁ , complete x∈p₂ , refl))
| left-inverse-of inv (_ , _ , complete f∈p₁ , complete x∈p₂ , refl)
| sound∘complete f∈p₁ | sound∘complete x∈p₂
where inv = ⊛-∈↔ (flatten fs) {xs = xs}
sound∘complete′ (_⊛_ {s₁ = []} {fs = nothing} {xs = just xs} _ _) refl | () | _ | _ | _ | _ | _
sound∘complete′ (_⊛_ {s₁ = []} {fs = just fs} {xs = just xs} {p₁ = p₁} {p₂ = p₂}
.(sound p₁ ∈fs) .(sound p₂ ∈xs)) refl
| ∈fs | ∈xs | ._ | refl | refl | refl = refl
sound∘complete′ (_>>=_ {x = x} {y = y} {s₁ = []} {xs = just _} {f = just f} {p₁ = p₁} {p₂ = p₂} x∈p₁ y∈p₂x) refl
rewrite left-inverse-of (>>=-∈↔ {f = f}) (_ , complete x∈p₁ , complete y∈p₂x)
with sound p₁ (complete x∈p₁)
| sound∘complete x∈p₁
| sound′ (p₂ x) (complete x∈p₁) (complete y∈p₂x)
| helper (p₂ x) (complete x∈p₁) y∈p₂x
where
helper : ∀ {Tok R₁ R₂ x y ys} {xs : Maybe (List R₁)}
(p : ∞⟨ xs ⟩Parser Tok R₂ ys) →
(x∈xs : x ∈ flatten xs) (y∈p : y ∈ ♭? p · []) →
sound′ p x∈xs (complete y∈p) ≡ y∈p
helper {xs = nothing} p () _
helper {xs = just _} p _ y∈p = sound∘complete y∈p
... | ._ | refl | ._ | refl = refl
sound∘complete′ (cast {xs₁≈xs₂ = xs₁≈xs₂} x∈p) refl with complete x∈p | sound∘complete x∈p
sound∘complete′ (cast {xs₁≈xs₂ = xs₁≈xs₂} .(sound _ x∈xs)) refl | x∈xs | refl
rewrite left-inverse-of xs₁≈xs₂ x∈xs = refl
sound∘complete′ (_⊛_ {s₁ = []} {xs = nothing} _ x∈p₂) refl with complete x∈p₂
... | ()
sound∘complete′ (_>>=_ {s₁ = []} {xs = nothing} x∈p₁ y∈p₂x) refl with complete x∈p₁
... | ()
sound∘complete′ (_>>=_ {s₁ = []} {xs = just _} {f = nothing} x∈p₁ y∈p₂x) refl with complete y∈p₂x
... | ()
sound∘complete′ token ()
sound∘complete′ (_⊛_ {s₁ = _ ∷ _} _ _) ()
sound∘complete′ (_>>=_ {s₁ = _ ∷ _} _ _) ()
sound∘complete′ (nonempty _) ()
complete∘sound : ∀ {Tok R xs x}
(p : Parser Tok R xs) (x∈p : x ∈ xs) →
complete (sound p x∈p) ≡ x∈p
complete∘sound (return x) (here refl) = refl
complete∘sound (_∣_ {xs₁ = xs₁} p₁ p₂) x∈xs
with from (++↔ {P = _≡_ _} {xs = xs₁}) ⟨$⟩ x∈xs
| right-inverse-of (++↔ {P = _≡_ _} {xs = xs₁}) x∈xs
complete∘sound (_∣_ {xs₁ = xs₁} p₁ p₂) .(to ++↔ ⟨$⟩ inj₁ x∈xs₁) | inj₁ x∈xs₁ | refl =
P.cong (_⟨$⟩_ (to ++↔) ∘ inj₁) $ complete∘sound p₁ x∈xs₁
complete∘sound (_∣_ {xs₁ = xs₁} p₁ p₂) .(to (++↔ {P = _≡_ _} {xs = xs₁}) ⟨$⟩ inj₂ x∈xs₂) | inj₂ x∈xs₂ | refl =
P.cong (_⟨$⟩_ (to (++↔ {P = _≡_ _} {xs = xs₁})) ∘ inj₂) $ complete∘sound p₂ x∈xs₂
complete∘sound (f <$> p) x∈xs
with from (map-∈↔ f) ⟨$⟩ x∈xs
| right-inverse-of (map-∈↔ f) x∈xs
complete∘sound (f <$> p) .(to (map-∈↔ f) ⟨$⟩ (y , y∈xs , refl)) | (y , y∈xs , refl) | refl =
P.cong (λ y∈ → to (map-∈↔ _) ⟨$⟩ (y , y∈ , refl))
(complete∘sound p y∈xs)
complete∘sound (_⊛_ {fs = fs} {just xs} p₁ p₂) y∈ys
with from (⊛-∈↔ (flatten fs) {xs = xs}) ⟨$⟩ y∈ys
| right-inverse-of (⊛-∈↔ (flatten fs) {xs = xs}) y∈ys
complete∘sound (_⊛_ {fs = nothing} {xs = just xs} p₁ p₂)
y∈ys | (f′ , x′ , () , x′∈xs , refl) | _
complete∘sound (_⊛_ {fs = just fs} {xs = just xs} p₁ p₂)
.(to (⊛-∈↔ _) ⟨$⟩ (f′ , x′ , f′∈fs , x′∈xs , refl)) | (f′ , x′ , f′∈fs , x′∈xs , refl) | refl =
P.cong₂ (λ f′∈ x′∈ → to (⊛-∈↔ _) ⟨$⟩ (f′ , x′ , f′∈ , x′∈ , refl))
(complete∘sound p₁ f′∈fs)
(complete∘sound p₂ x′∈xs)
complete∘sound (_>>=_ {xs = zs} {just f} p₁ p₂) y∈ys
with from (>>=-∈↔ {xs = flatten zs} {f = f}) ⟨$⟩ y∈ys
| right-inverse-of (>>=-∈↔ {xs = flatten zs} {f = f}) y∈ys
complete∘sound (_>>=_ {xs = nothing} {just f} p₁ p₂) ._ | (x , () , y∈fx) | refl
complete∘sound (_>>=_ {xs = just zs} {just f} p₁ p₂) .(to (>>=-∈↔ {f = f}) ⟨$⟩ (x , x∈zs , y∈fx)) | (x , x∈zs , y∈fx) | refl =
P.cong₂ (λ x∈ y∈ → to (>>=-∈↔ {f = f}) ⟨$⟩ (x , x∈ , y∈))
(complete∘sound p₁ x∈zs)
(complete∘sound (p₂ x) y∈fx)
complete∘sound (cast xs₁≈xs₂ p) x∈xs
rewrite complete∘sound p (from xs₁≈xs₂ ⟨$⟩ x∈xs) =
right-inverse-of xs₁≈xs₂ x∈xs
complete∘sound (return _) (there ())
complete∘sound fail ()
complete∘sound token ()
complete∘sound (_⊛_ {xs = nothing} _ _) ()
complete∘sound (_>>=_ {f = nothing} _ _) ()
complete∘sound (nonempty _) ()
correct : ∀ {Tok R xs x} {p : Parser Tok R xs} → x ∈ p · [] ↔ x ∈ xs
correct {p = p} = record
{ to = P.→-to-⟶ complete
; from = P.→-to-⟶ $ sound p
; inverse-of = record
{ left-inverse-of = sound∘complete
; right-inverse-of = complete∘sound p
}
}
------------------------------------------------------------------------
-- Equal parsers have equal initial bags/sets
-- Note that this property holds also for the subbag and subset
-- relations.
cong : ∀ {k Tok R xs₁ xs₂}
{p₁ : Parser Tok R xs₁} {p₂ : Parser Tok R xs₂} →
p₁ ∼[ k ] p₂ → initial-bag p₁ List-∼[ k ] initial-bag p₂
cong {xs₁ = xs₁} {xs₂} {p₁} {p₂} p₁≈p₂ {x} =
(x ∈ xs₁) ↔⟨ SK-sym correct ⟩
x ∈ p₁ · [] ∼⟨ p₁≈p₂ ⟩
x ∈ p₂ · [] ↔⟨ correct ⟩
(x ∈ xs₂) ∎
where open Related.EquationalReasoning
|
3-mid/impact/source/3d/collision/dispatch/impact-d3-collision-algorithm-activating-convex_convex.ads | charlie5/lace | 20 | 10808 | <filename>3-mid/impact/source/3d/collision/dispatch/impact-d3-collision-algorithm-activating-convex_convex.ads
-- #include "impact.d3.collision.Algorithm.activating.h"
-- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.Detector.discrete.gjk_pair.h"
-- #include "BulletCollision/NarrowPhaseCollision/impact.d3.Manifold.h"
-- #include "BulletCollision/BroadphaseCollision/impact.d3.collision.Proxy.h"
-- #include "BulletCollision/NarrowPhaseCollision/impact.d3.collision.simplex_Solver.voronoi.h"
-- #include "btCollisionCreateFunc.h"
-- #include "impact.d3.Dispatcher.collision.h"
-- #include "LinearMath/impact.d3.TransformUtil.h" //for btConvexSeparatingDistanceUtil
--
-- class impact.d3.collision.convex_penetration_depth_Solver;
with impact.d3.collision.Algorithm.activating,
impact.d3.collision.simplex_Solver,
impact.d3.collision.convex_penetration_depth_Solver,
impact.d3.Manifold,
impact.d3.collision.create_Func,
impact.d3.transform_Util;
with impact.d3.collision.Algorithm;
with impact.d3.Object;
with impact.d3.Dispatcher;
with impact.d3.collision.manifold_Result;
package impact.d3.collision.Algorithm.activating.convex_convex
--
-- The convexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations between two convex objects.
--
-- Multiple contact points are calculated by perturbing the orientation of the smallest object orthogonal to the separating normal.
-- This idea was described by <NAME> in this forum topic http://www.bulletphysics.com/Bullet/phpBB3/viewtopic.php?f=4&t=288&p=888#p888
--
is
use impact.d3.transform_Util,
Math;
USE_SEPDISTANCE_UTIL2 : constant Boolean := True;
--
-- Enabling USE_SEPDISTANCE_UTIL2 requires 100% reliable distance computation. However, when using large size ratios GJK can be imprecise
-- so the distance is not conservative. In that case, enabling this USE_SEPDISTANCE_UTIL2 would result in failing/missing collisions.
-- Either improve GJK for large size ratios (testing a 100 units versus a 0.1 unit object) or only enable the util
-- for certain pairs that have a small size ratio
type Item is new impact.d3.collision.Algorithm.activating.item with private;
--- CreateFunc
--
type CreateFunc is new create_Func.item with
record
m_pdSolver : access impact.d3.collision.convex_penetration_depth_Solver.item'Class;
m_simplexSolver : access impact.d3.collision.simplex_Solver.item'Class;
m_numPerturbationIterations : Integer;
m_minimumPointsPerturbationThreshold : Integer;
end record;
function to_CreateFunc (simplexSolver : access impact.d3.collision.simplex_Solver.item'Class;
pdSolver : access impact.d3.collision.convex_penetration_depth_Solver.item'Class) return CreateFunc;
function new_CreateFunc (simplexSolver : access impact.d3.collision.simplex_Solver.item'Class;
pdSolver : access impact.d3.collision.convex_penetration_depth_Solver.item'Class) return access CreateFunc'Class;
overriding procedure destruct (Self : in out CreateFunc);
overriding function CreateCollisionAlgorithm (Self : in CreateFunc; info : in AlgorithmConstructionInfo;
body0,
body1 : access impact.d3.Object.item'Class) return impact.d3.Dispatcher.Algorithm_view;
-- struct CreateFunc :public impact.d3.collision.AlgorithmCreateFunc
-- {
--
--
-- virtual impact.d3.collision.Algorithm* CreateCollisionAlgorithm(impact.d3.collision.AlgorithmConstructionInfo& ci, impact.d3.Object* body0,impact.d3.Object* body1)
-- {
-- void* mem = ci.m_dispatcher1->allocateCollisionAlgorithm(sizeof(impact.d3.collision.Algorithm.activating.convex_convex));
-- return new(mem) impact.d3.collision.Algorithm.activating.convex_convex(ci.m_manifold,ci,body0,body1,m_simplexSolver,m_pdSolver,m_numPerturbationIterations,m_minimumPointsPerturbationThreshold);
-- }
-- };
--- impact.d3.collision.Algorithm.activating.convex_convex
--
function to_convex_convex_Algorithm (mf : access impact.d3.Manifold.item'Class;
ci : in AlgorithmConstructionInfo;
body0, body1 : access impact.d3.Object.item'Class;
simplexSolver : access impact.d3.collision.simplex_Solver.item'Class;
pdSolver : access impact.d3.collision.convex_penetration_depth_Solver.item'Class;
numPerturbationIterations : in Integer;
minimumPointsPerturbationThreshold : in Integer) return impact.d3.collision.Algorithm.activating.convex_convex.item;
overriding procedure destruct (Self : in out Item);
overriding procedure processCollision (Self : in out Item; body0, body1 : access impact.d3.Object.item'Class;
dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo;
resultOut : out impact.d3.collision.manifold_Result.item);
overriding function calculateTimeOfImpact (Self : in Item; body0, body1 : access impact.d3.Object.item'Class;
dispatchInfo : in impact.d3.Dispatcher.DispatcherInfo;
resultOut : access impact.d3.collision.manifold_Result.item) return math.Real;
overriding procedure getAllContactManifolds (Self : in out Item; manifoldArray : out impact.d3.collision.Algorithm.btManifoldArray);
procedure setLowLevelOfDetail (Self : in out Item; useLowLevel : in Boolean);
function getManifold (Self : in Item) return access impact.d3.Manifold.item'Class;
private
type Item is new impact.d3.collision.Algorithm.activating.item with
record
m_sepDistance : btConvexSeparatingDistanceUtil; -- Used by USE_SEPDISTANCE_UTIL2.
m_simplexSolver : access impact.d3.collision.simplex_Solver.item'Class;
m_pdSolver : access impact.d3.collision.convex_penetration_depth_Solver.item'Class;
m_ownManifold : Boolean;
m_manifoldPtr : access impact.d3.Manifold.item'Class;
m_lowLevelOfDetail : Boolean;
m_numPerturbationIterations : Integer;
m_minimumPointsPerturbationThreshold : Integer;
-- todo: cache separating vector to speedup collision detection
end record;
end impact.d3.collision.Algorithm.activating.convex_convex;
|
libsrc/_DEVELOPMENT/target/rc2014/driver/ide/8080/ide_drive_id.asm | UnivEngineer/z88dk | 4 | 89657 | <filename>libsrc/_DEVELOPMENT/target/rc2014/driver/ide/8080/ide_drive_id.asm
SECTION code_driver
PUBLIC ide_drive_id
EXTERN __IO_IDE_COMMAND
EXTERN __IO_IDE_HEAD
EXTERN __IDE_CMD_ID
EXTERN ide_wait_ready, ide_wait_drq
EXTERN ide_test_error
EXTERN ide_write_byte
EXTERN ide_read_block
;------------------------------------------------------------------------------
; Routines that talk with the IDE drive, these should be called by
; the main program.
; do the identify drive command, and return with the buffer
; filled with info about the drive.
; uses AF, DE, HL
; the buffer to fill is in HL
.ide_drive_id
call ide_wait_ready
jp NC,ide_test_error ;carry = 0 on return = operation failed
ld e, 11100000b
ld a, __IO_IDE_HEAD
call ide_write_byte ;select the master device, LBA mode
call ide_wait_ready
jp NC,ide_test_error ;carry = 0 on return = operation failed
ld e, __IDE_CMD_ID
ld a, __IO_IDE_COMMAND
call ide_write_byte ;issue the command
call ide_wait_ready ;make sure drive is ready to proceed
jp NC,ide_test_error ;carry = 0 on return = operation failed
call ide_wait_drq ;wait until it's got the data
jp NC,ide_test_error ;carry = 0 on return = operation failed
call ide_read_block ;grab the data buffer in (HL++)
scf ;carry = 1 on return = operation ok
ret
|
gfx/pokemon/anims.asm | Ebernacher90/pokecrystal-allworld | 0 | 86785 | BulbasaurAnimation: INCLUDE "gfx/pokemon/bulbasaur/anim.asm"
IvysaurAnimation: INCLUDE "gfx/pokemon/ivysaur/anim.asm"
VenusaurAnimation: INCLUDE "gfx/pokemon/venusaur/anim.asm"
CharmanderAnimation: INCLUDE "gfx/pokemon/charmander/anim.asm"
CharmeleonAnimation: INCLUDE "gfx/pokemon/charmeleon/anim.asm"
CharizardAnimation: INCLUDE "gfx/pokemon/charizard/anim.asm"
SquirtleAnimation: INCLUDE "gfx/pokemon/squirtle/anim.asm"
WartortleAnimation: INCLUDE "gfx/pokemon/wartortle/anim.asm"
BlastoiseAnimation: INCLUDE "gfx/pokemon/blastoise/anim.asm"
CaterpieAnimation: INCLUDE "gfx/pokemon/caterpie/anim.asm"
MetapodAnimation: INCLUDE "gfx/pokemon/metapod/anim.asm"
ButterfreeAnimation: INCLUDE "gfx/pokemon/butterfree/anim.asm"
WeedleAnimation: INCLUDE "gfx/pokemon/weedle/anim.asm"
KakunaAnimation: INCLUDE "gfx/pokemon/kakuna/anim.asm"
BeedrillAnimation: INCLUDE "gfx/pokemon/beedrill/anim.asm"
PidgeyAnimation: INCLUDE "gfx/pokemon/pidgey/anim.asm"
PidgeottoAnimation: INCLUDE "gfx/pokemon/pidgeotto/anim.asm"
PidgeotAnimation: INCLUDE "gfx/pokemon/pidgeot/anim.asm"
RattataAnimation: INCLUDE "gfx/pokemon/rattata/anim.asm"
RaticateAnimation: INCLUDE "gfx/pokemon/raticate/anim.asm"
SpearowAnimation: INCLUDE "gfx/pokemon/spearow/anim.asm"
FearowAnimation: INCLUDE "gfx/pokemon/fearow/anim.asm"
EkansAnimation: INCLUDE "gfx/pokemon/ekans/anim.asm"
ArbokAnimation: INCLUDE "gfx/pokemon/arbok/anim.asm"
PikachuAnimation: INCLUDE "gfx/pokemon/pikachu/anim.asm"
RaichuAnimation: INCLUDE "gfx/pokemon/raichu/anim.asm"
SandshrewAnimation: INCLUDE "gfx/pokemon/sandshrew/anim.asm"
SandslashAnimation: INCLUDE "gfx/pokemon/sandslash/anim.asm"
NidoranFAnimation: INCLUDE "gfx/pokemon/nidoran_f/anim.asm"
NidorinaAnimation: INCLUDE "gfx/pokemon/nidorina/anim.asm"
NidoqueenAnimation: INCLUDE "gfx/pokemon/nidoqueen/anim.asm"
NidoranMAnimation: INCLUDE "gfx/pokemon/nidoran_m/anim.asm"
NidorinoAnimation: INCLUDE "gfx/pokemon/nidorino/anim.asm"
NidokingAnimation: INCLUDE "gfx/pokemon/nidoking/anim.asm"
ClefairyAnimation: INCLUDE "gfx/pokemon/clefairy/anim.asm"
ClefableAnimation: INCLUDE "gfx/pokemon/clefable/anim.asm"
VulpixAnimation: INCLUDE "gfx/pokemon/vulpix/anim.asm"
NinetalesAnimation: INCLUDE "gfx/pokemon/ninetales/anim.asm"
JigglypuffAnimation: INCLUDE "gfx/pokemon/jigglypuff/anim.asm"
WigglytuffAnimation: INCLUDE "gfx/pokemon/wigglytuff/anim.asm"
ZubatAnimation: INCLUDE "gfx/pokemon/zubat/anim.asm"
GolbatAnimation: INCLUDE "gfx/pokemon/golbat/anim.asm"
OddishAnimation: INCLUDE "gfx/pokemon/oddish/anim.asm"
GloomAnimation: INCLUDE "gfx/pokemon/gloom/anim.asm"
VileplumeAnimation: INCLUDE "gfx/pokemon/vileplume/anim.asm"
ParasAnimation: INCLUDE "gfx/pokemon/paras/anim.asm"
ParasectAnimation: INCLUDE "gfx/pokemon/parasect/anim.asm"
VenonatAnimation: INCLUDE "gfx/pokemon/venonat/anim.asm"
VenomothAnimation: INCLUDE "gfx/pokemon/venomoth/anim.asm"
DiglettAnimation: INCLUDE "gfx/pokemon/diglett/anim.asm"
DugtrioAnimation: INCLUDE "gfx/pokemon/dugtrio/anim.asm"
MeowthAnimation: INCLUDE "gfx/pokemon/meowth/anim.asm"
PersianAnimation: INCLUDE "gfx/pokemon/persian/anim.asm"
PsyduckAnimation: INCLUDE "gfx/pokemon/psyduck/anim.asm"
GolduckAnimation: INCLUDE "gfx/pokemon/golduck/anim.asm"
MankeyAnimation: INCLUDE "gfx/pokemon/mankey/anim.asm"
PrimeapeAnimation: INCLUDE "gfx/pokemon/primeape/anim.asm"
GrowlitheAnimation: INCLUDE "gfx/pokemon/growlithe/anim.asm"
ArcanineAnimation: INCLUDE "gfx/pokemon/arcanine/anim.asm"
PoliwagAnimation: INCLUDE "gfx/pokemon/poliwag/anim.asm"
PoliwhirlAnimation: INCLUDE "gfx/pokemon/poliwhirl/anim.asm"
PoliwrathAnimation: INCLUDE "gfx/pokemon/poliwrath/anim.asm"
AbraAnimation: INCLUDE "gfx/pokemon/abra/anim.asm"
KadabraAnimation: INCLUDE "gfx/pokemon/kadabra/anim.asm"
AlakazamAnimation: INCLUDE "gfx/pokemon/alakazam/anim.asm"
MachopAnimation: INCLUDE "gfx/pokemon/machop/anim.asm"
MachokeAnimation: INCLUDE "gfx/pokemon/machoke/anim.asm"
MachampAnimation: INCLUDE "gfx/pokemon/machamp/anim.asm"
BellsproutAnimation: INCLUDE "gfx/pokemon/bellsprout/anim.asm"
WeepinbellAnimation: INCLUDE "gfx/pokemon/weepinbell/anim.asm"
VictreebelAnimation: INCLUDE "gfx/pokemon/victreebel/anim.asm"
TentacoolAnimation: INCLUDE "gfx/pokemon/tentacool/anim.asm"
TentacruelAnimation: INCLUDE "gfx/pokemon/tentacruel/anim.asm"
GeodudeAnimation: INCLUDE "gfx/pokemon/geodude/anim.asm"
GravelerAnimation: INCLUDE "gfx/pokemon/graveler/anim.asm"
GolemAnimation: INCLUDE "gfx/pokemon/golem/anim.asm"
PonytaAnimation: INCLUDE "gfx/pokemon/ponyta/anim.asm"
RapidashAnimation: INCLUDE "gfx/pokemon/rapidash/anim.asm"
SlowpokeAnimation: INCLUDE "gfx/pokemon/slowpoke/anim.asm"
SlowbroAnimation: INCLUDE "gfx/pokemon/slowbro/anim.asm"
MagnemiteAnimation: INCLUDE "gfx/pokemon/magnemite/anim.asm"
MagnetonAnimation: INCLUDE "gfx/pokemon/magneton/anim.asm"
FarfetchDAnimation: INCLUDE "gfx/pokemon/farfetch_d/anim.asm"
DoduoAnimation: INCLUDE "gfx/pokemon/doduo/anim.asm"
DodrioAnimation: INCLUDE "gfx/pokemon/dodrio/anim.asm"
SeelAnimation: INCLUDE "gfx/pokemon/seel/anim.asm"
DewgongAnimation: INCLUDE "gfx/pokemon/dewgong/anim.asm"
GrimerAnimation: INCLUDE "gfx/pokemon/grimer/anim.asm"
MukAnimation: INCLUDE "gfx/pokemon/muk/anim.asm"
ShellderAnimation: INCLUDE "gfx/pokemon/shellder/anim.asm"
CloysterAnimation: INCLUDE "gfx/pokemon/cloyster/anim.asm"
GastlyAnimation: INCLUDE "gfx/pokemon/gastly/anim.asm"
HaunterAnimation: INCLUDE "gfx/pokemon/haunter/anim.asm"
GengarAnimation: INCLUDE "gfx/pokemon/gengar/anim.asm"
OnixAnimation: INCLUDE "gfx/pokemon/onix/anim.asm"
DrowzeeAnimation: INCLUDE "gfx/pokemon/drowzee/anim.asm"
HypnoAnimation: INCLUDE "gfx/pokemon/hypno/anim.asm"
KrabbyAnimation: INCLUDE "gfx/pokemon/krabby/anim.asm"
KinglerAnimation: INCLUDE "gfx/pokemon/kingler/anim.asm"
VoltorbAnimation: INCLUDE "gfx/pokemon/voltorb/anim.asm"
ElectrodeAnimation: INCLUDE "gfx/pokemon/electrode/anim.asm"
ExeggcuteAnimation: INCLUDE "gfx/pokemon/exeggcute/anim.asm"
ExeggutorAnimation: INCLUDE "gfx/pokemon/exeggutor/anim.asm"
CuboneAnimation: INCLUDE "gfx/pokemon/cubone/anim.asm"
MarowakAnimation: INCLUDE "gfx/pokemon/marowak/anim.asm"
HitmonleeAnimation: INCLUDE "gfx/pokemon/hitmonlee/anim.asm"
HitmonchanAnimation: INCLUDE "gfx/pokemon/hitmonchan/anim.asm"
LickitungAnimation: INCLUDE "gfx/pokemon/lickitung/anim.asm"
KoffingAnimation: INCLUDE "gfx/pokemon/koffing/anim.asm"
WeezingAnimation: INCLUDE "gfx/pokemon/weezing/anim.asm"
RhyhornAnimation: INCLUDE "gfx/pokemon/rhyhorn/anim.asm"
RhydonAnimation: INCLUDE "gfx/pokemon/rhydon/anim.asm"
ChanseyAnimation: INCLUDE "gfx/pokemon/chansey/anim.asm"
TangelaAnimation: INCLUDE "gfx/pokemon/tangela/anim.asm"
KangaskhanAnimation: INCLUDE "gfx/pokemon/kangaskhan/anim.asm"
HorseaAnimation: INCLUDE "gfx/pokemon/horsea/anim.asm"
SeadraAnimation: INCLUDE "gfx/pokemon/seadra/anim.asm"
GoldeenAnimation: INCLUDE "gfx/pokemon/goldeen/anim.asm"
SeakingAnimation: INCLUDE "gfx/pokemon/seaking/anim.asm"
StaryuAnimation: INCLUDE "gfx/pokemon/staryu/anim.asm"
StarmieAnimation: INCLUDE "gfx/pokemon/starmie/anim.asm"
MrMimeAnimation: INCLUDE "gfx/pokemon/mr__mime/anim.asm"
ScytherAnimation: INCLUDE "gfx/pokemon/scyther/anim.asm"
JynxAnimation: INCLUDE "gfx/pokemon/jynx/anim.asm"
ElectabuzzAnimation: INCLUDE "gfx/pokemon/electabuzz/anim.asm"
MagmarAnimation: INCLUDE "gfx/pokemon/magmar/anim.asm"
PinsirAnimation: INCLUDE "gfx/pokemon/pinsir/anim.asm"
TaurosAnimation: INCLUDE "gfx/pokemon/tauros/anim.asm"
MagikarpAnimation: INCLUDE "gfx/pokemon/magikarp/anim.asm"
GyaradosAnimation: INCLUDE "gfx/pokemon/gyarados/anim.asm"
LaprasAnimation: INCLUDE "gfx/pokemon/lapras/anim.asm"
DittoAnimation: INCLUDE "gfx/pokemon/ditto/anim.asm"
EeveeAnimation: INCLUDE "gfx/pokemon/eevee/anim.asm"
VaporeonAnimation: INCLUDE "gfx/pokemon/vaporeon/anim.asm"
JolteonAnimation: INCLUDE "gfx/pokemon/jolteon/anim.asm"
FlareonAnimation: INCLUDE "gfx/pokemon/flareon/anim.asm"
PorygonAnimation: INCLUDE "gfx/pokemon/porygon/anim.asm"
OmanyteAnimation: INCLUDE "gfx/pokemon/omanyte/anim.asm"
OmastarAnimation: INCLUDE "gfx/pokemon/omastar/anim.asm"
KabutoAnimation: INCLUDE "gfx/pokemon/kabuto/anim.asm"
KabutopsAnimation: INCLUDE "gfx/pokemon/kabutops/anim.asm"
AerodactylAnimation: INCLUDE "gfx/pokemon/aerodactyl/anim.asm"
SnorlaxAnimation: INCLUDE "gfx/pokemon/snorlax/anim.asm"
ArticunoAnimation: INCLUDE "gfx/pokemon/articuno/anim.asm"
ZapdosAnimation: INCLUDE "gfx/pokemon/zapdos/anim.asm"
MoltresAnimation: INCLUDE "gfx/pokemon/moltres/anim.asm"
DratiniAnimation: INCLUDE "gfx/pokemon/dratini/anim.asm"
DragonairAnimation: INCLUDE "gfx/pokemon/dragonair/anim.asm"
DragoniteAnimation: INCLUDE "gfx/pokemon/dragonite/anim.asm"
MewtwoAnimation: INCLUDE "gfx/pokemon/mewtwo/anim.asm"
MewAnimation: INCLUDE "gfx/pokemon/mew/anim.asm"
ChikoritaAnimation: INCLUDE "gfx/pokemon/chikorita/anim.asm"
BayleefAnimation: INCLUDE "gfx/pokemon/bayleef/anim.asm"
MeganiumAnimation: INCLUDE "gfx/pokemon/meganium/anim.asm"
CyndaquilAnimation: INCLUDE "gfx/pokemon/cyndaquil/anim.asm"
QuilavaAnimation: INCLUDE "gfx/pokemon/quilava/anim.asm"
TyphlosionAnimation: INCLUDE "gfx/pokemon/typhlosion/anim.asm"
TotodileAnimation: INCLUDE "gfx/pokemon/totodile/anim.asm"
CroconawAnimation: INCLUDE "gfx/pokemon/croconaw/anim.asm"
FeraligatrAnimation: INCLUDE "gfx/pokemon/feraligatr/anim.asm"
SentretAnimation: INCLUDE "gfx/pokemon/sentret/anim.asm"
FurretAnimation: INCLUDE "gfx/pokemon/furret/anim.asm"
HoothootAnimation: INCLUDE "gfx/pokemon/hoothoot/anim.asm"
NoctowlAnimation: INCLUDE "gfx/pokemon/noctowl/anim.asm"
LedybaAnimation: INCLUDE "gfx/pokemon/ledyba/anim.asm"
LedianAnimation: INCLUDE "gfx/pokemon/ledian/anim.asm"
SpinarakAnimation: INCLUDE "gfx/pokemon/spinarak/anim.asm"
AriadosAnimation: INCLUDE "gfx/pokemon/ariados/anim.asm"
CrobatAnimation: INCLUDE "gfx/pokemon/crobat/anim.asm"
ChinchouAnimation: INCLUDE "gfx/pokemon/chinchou/anim.asm"
LanturnAnimation: INCLUDE "gfx/pokemon/lanturn/anim.asm"
PichuAnimation: INCLUDE "gfx/pokemon/pichu/anim.asm"
CleffaAnimation: INCLUDE "gfx/pokemon/cleffa/anim.asm"
IgglybuffAnimation: INCLUDE "gfx/pokemon/igglybuff/anim.asm"
TogepiAnimation: INCLUDE "gfx/pokemon/togepi/anim.asm"
TogeticAnimation: INCLUDE "gfx/pokemon/togetic/anim.asm"
NatuAnimation: INCLUDE "gfx/pokemon/natu/anim.asm"
XatuAnimation: INCLUDE "gfx/pokemon/xatu/anim.asm"
MareepAnimation: INCLUDE "gfx/pokemon/mareep/anim.asm"
FlaaffyAnimation: INCLUDE "gfx/pokemon/flaaffy/anim.asm"
AmpharosAnimation: INCLUDE "gfx/pokemon/ampharos/anim.asm"
BellossomAnimation: INCLUDE "gfx/pokemon/bellossom/anim.asm"
MarillAnimation: INCLUDE "gfx/pokemon/marill/anim.asm"
AzumarillAnimation: INCLUDE "gfx/pokemon/azumarill/anim.asm"
SudowoodoAnimation: INCLUDE "gfx/pokemon/sudowoodo/anim.asm"
PolitoedAnimation: INCLUDE "gfx/pokemon/politoed/anim.asm"
HoppipAnimation: INCLUDE "gfx/pokemon/hoppip/anim.asm"
SkiploomAnimation: INCLUDE "gfx/pokemon/skiploom/anim.asm"
JumpluffAnimation: INCLUDE "gfx/pokemon/jumpluff/anim.asm"
AipomAnimation: INCLUDE "gfx/pokemon/aipom/anim.asm"
SunkernAnimation: INCLUDE "gfx/pokemon/sunkern/anim.asm"
SunfloraAnimation: INCLUDE "gfx/pokemon/sunflora/anim.asm"
YanmaAnimation: INCLUDE "gfx/pokemon/yanma/anim.asm"
WooperAnimation: INCLUDE "gfx/pokemon/wooper/anim.asm"
QuagsireAnimation: INCLUDE "gfx/pokemon/quagsire/anim.asm"
EspeonAnimation: INCLUDE "gfx/pokemon/espeon/anim.asm"
UmbreonAnimation: INCLUDE "gfx/pokemon/umbreon/anim.asm"
MurkrowAnimation: INCLUDE "gfx/pokemon/murkrow/anim.asm"
SlowkingAnimation: INCLUDE "gfx/pokemon/slowking/anim.asm"
MisdreavusAnimation: INCLUDE "gfx/pokemon/misdreavus/anim.asm"
UnownAnimation: INCLUDE "gfx/pokemon/unown/anim.asm"
WobbuffetAnimation: INCLUDE "gfx/pokemon/wobbuffet/anim.asm"
GirafarigAnimation: INCLUDE "gfx/pokemon/girafarig/anim.asm"
PinecoAnimation: INCLUDE "gfx/pokemon/pineco/anim.asm"
ForretressAnimation: INCLUDE "gfx/pokemon/forretress/anim.asm"
DunsparceAnimation: INCLUDE "gfx/pokemon/dunsparce/anim.asm"
GligarAnimation: INCLUDE "gfx/pokemon/gligar/anim.asm"
SteelixAnimation: INCLUDE "gfx/pokemon/steelix/anim.asm"
SnubbullAnimation: INCLUDE "gfx/pokemon/snubbull/anim.asm"
GranbullAnimation: INCLUDE "gfx/pokemon/granbull/anim.asm"
QwilfishAnimation: INCLUDE "gfx/pokemon/qwilfish/anim.asm"
ScizorAnimation: INCLUDE "gfx/pokemon/scizor/anim.asm"
ShuckleAnimation: INCLUDE "gfx/pokemon/shuckle/anim.asm"
HeracrossAnimation: INCLUDE "gfx/pokemon/heracross/anim.asm"
SneaselAnimation: INCLUDE "gfx/pokemon/sneasel/anim.asm"
TeddiursaAnimation: INCLUDE "gfx/pokemon/teddiursa/anim.asm"
UrsaringAnimation: INCLUDE "gfx/pokemon/ursaring/anim.asm"
SlugmaAnimation: INCLUDE "gfx/pokemon/slugma/anim.asm"
MagcargoAnimation: INCLUDE "gfx/pokemon/magcargo/anim.asm"
SwinubAnimation: INCLUDE "gfx/pokemon/swinub/anim.asm"
PiloswineAnimation: INCLUDE "gfx/pokemon/piloswine/anim.asm"
CorsolaAnimation: INCLUDE "gfx/pokemon/corsola/anim.asm"
RemoraidAnimation: INCLUDE "gfx/pokemon/remoraid/anim.asm"
OctilleryAnimation: INCLUDE "gfx/pokemon/octillery/anim.asm"
DelibirdAnimation: INCLUDE "gfx/pokemon/delibird/anim.asm"
MantineAnimation: INCLUDE "gfx/pokemon/mantine/anim.asm"
SkarmoryAnimation: INCLUDE "gfx/pokemon/skarmory/anim.asm"
HoundourAnimation: INCLUDE "gfx/pokemon/houndour/anim.asm"
HoundoomAnimation: INCLUDE "gfx/pokemon/houndoom/anim.asm"
KingdraAnimation: INCLUDE "gfx/pokemon/kingdra/anim.asm"
PhanpyAnimation: INCLUDE "gfx/pokemon/phanpy/anim.asm"
DonphanAnimation: INCLUDE "gfx/pokemon/donphan/anim.asm"
Porygon2Animation: INCLUDE "gfx/pokemon/porygon2/anim.asm"
StantlerAnimation: INCLUDE "gfx/pokemon/stantler/anim.asm"
SmeargleAnimation: INCLUDE "gfx/pokemon/smeargle/anim.asm"
TyrogueAnimation: INCLUDE "gfx/pokemon/tyrogue/anim.asm"
HitmontopAnimation: INCLUDE "gfx/pokemon/hitmontop/anim.asm"
SmoochumAnimation: INCLUDE "gfx/pokemon/smoochum/anim.asm"
ElekidAnimation: INCLUDE "gfx/pokemon/elekid/anim.asm"
MagbyAnimation: INCLUDE "gfx/pokemon/magby/anim.asm"
MiltankAnimation: INCLUDE "gfx/pokemon/miltank/anim.asm"
BlisseyAnimation: INCLUDE "gfx/pokemon/blissey/anim.asm"
RaikouAnimation: INCLUDE "gfx/pokemon/raikou/anim.asm"
EnteiAnimation: INCLUDE "gfx/pokemon/entei/anim.asm"
SuicuneAnimation: INCLUDE "gfx/pokemon/suicune/anim.asm"
LarvitarAnimation: INCLUDE "gfx/pokemon/larvitar/anim.asm"
PupitarAnimation: INCLUDE "gfx/pokemon/pupitar/anim.asm"
TyranitarAnimation: INCLUDE "gfx/pokemon/tyranitar/anim.asm"
LugiaAnimation: INCLUDE "gfx/pokemon/lugia/anim.asm"
HoOhAnimation: INCLUDE "gfx/pokemon/ho_oh/anim.asm"
CelebiAnimation: INCLUDE "gfx/pokemon/celebi/anim.asm"
TreeckoAnimation: INCLUDE "gfx/pokemon/treecko/anim.asm"
GrovyleAnimation: INCLUDE "gfx/pokemon/grovyle/anim.asm"
SceptileAnimation: INCLUDE "gfx/pokemon/sceptile/anim.asm"
TorchicAnimation: INCLUDE "gfx/pokemon/torchic/anim.asm"
CombuskenAnimation: INCLUDE "gfx/pokemon/combusken/anim.asm"
BlazikenAnimation: INCLUDE "gfx/pokemon/blaziken/anim.asm"
MudkipAnimation: INCLUDE "gfx/pokemon/mudkip/anim.asm"
MarshtompAnimation: INCLUDE "gfx/pokemon/marshtomp/anim.asm"
SwampertAnimation: INCLUDE "gfx/pokemon/swampert/anim.asm"
PoochyenaAnimation: INCLUDE "gfx/pokemon/poochyena/anim.asm"
MightyenaAnimation: INCLUDE "gfx/pokemon/mightyena/anim.asm"
ZigzagoonAnimation: INCLUDE "gfx/pokemon/zigzagoon/anim.asm"
LinooneAnimation: INCLUDE "gfx/pokemon/linoone/anim.asm"
WurmpleAnimation: INCLUDE "gfx/pokemon/wurmple/anim.asm"
SilcoonAnimation: INCLUDE "gfx/pokemon/silcoon/anim.asm"
BeautiflyAnimation: INCLUDE "gfx/pokemon/beautifly/anim.asm"
CascoonAnimation: INCLUDE "gfx/pokemon/cascoon/anim.asm"
DustoxAnimation: INCLUDE "gfx/pokemon/dustox/anim.asm"
LotadAnimation: INCLUDE "gfx/pokemon/lotad/anim.asm"
LombreAnimation: INCLUDE "gfx/pokemon/lombre/anim.asm"
LudicoloAnimation: INCLUDE "gfx/pokemon/ludicolo/anim.asm"
SeedotAnimation: INCLUDE "gfx/pokemon/seedot/anim.asm"
NuzleafAnimation: INCLUDE "gfx/pokemon/nuzleaf/anim.asm"
ShiftryAnimation: INCLUDE "gfx/pokemon/shiftry/anim.asm"
TaillowAnimation: INCLUDE "gfx/pokemon/taillow/anim.asm"
SwellowAnimation: INCLUDE "gfx/pokemon/swellow/anim.asm"
WingullAnimation: INCLUDE "gfx/pokemon/wingull/anim.asm"
PelipperAnimation: INCLUDE "gfx/pokemon/pelipper/anim.asm"
RaltsAnimation: INCLUDE "gfx/pokemon/ralts/anim.asm"
KirliaAnimation: INCLUDE "gfx/pokemon/kirlia/anim.asm"
GardevoirAnimation: INCLUDE "gfx/pokemon/gardevoir/anim.asm"
SurskitAnimation: INCLUDE "gfx/pokemon/surskit/anim.asm"
MasquerainAnimation: INCLUDE "gfx/pokemon/masquerain/anim.asm"
ShroomishAnimation: INCLUDE "gfx/pokemon/shroomish/anim.asm"
BreloomAnimation: INCLUDE "gfx/pokemon/breloom/anim.asm"
SlakothAnimation: INCLUDE "gfx/pokemon/slakoth/anim.asm"
VigorothAnimation: INCLUDE "gfx/pokemon/vigoroth/anim.asm"
SlakingAnimation: INCLUDE "gfx/pokemon/slaking/anim.asm"
NincadaAnimation: INCLUDE "gfx/pokemon/nincada/anim.asm"
NinjaskAnimation: INCLUDE "gfx/pokemon/ninjask/anim.asm"
ShedinjaAnimation: INCLUDE "gfx/pokemon/shedinja/anim.asm"
WhismurAnimation: INCLUDE "gfx/pokemon/whismur/anim.asm"
LoudredAnimation: INCLUDE "gfx/pokemon/loudred/anim.asm"
ExploudAnimation: INCLUDE "gfx/pokemon/exploud/anim.asm"
MakuhitaAnimation: INCLUDE "gfx/pokemon/makuhita/anim.asm"
HariyamaAnimation: INCLUDE "gfx/pokemon/hariyama/anim.asm"
AzurillAnimation: INCLUDE "gfx/pokemon/azurill/anim.asm"
NosepassAnimation: INCLUDE "gfx/pokemon/nosepass/anim.asm"
SkittyAnimation: INCLUDE "gfx/pokemon/skitty/anim.asm"
DelcattyAnimation: INCLUDE "gfx/pokemon/delcatty/anim.asm"
SableyeAnimation: INCLUDE "gfx/pokemon/sableye/anim.asm"
MawileAnimation: INCLUDE "gfx/pokemon/mawile/anim.asm"
AronAnimation: INCLUDE "gfx/pokemon/aron/anim.asm"
LaironAnimation: INCLUDE "gfx/pokemon/lairon/anim.asm"
AggronAnimation: INCLUDE "gfx/pokemon/aggron/anim.asm"
MedititeAnimation: INCLUDE "gfx/pokemon/meditite/anim.asm"
MedichamAnimation: INCLUDE "gfx/pokemon/medicham/anim.asm"
ElectrikeAnimation: INCLUDE "gfx/pokemon/electrike/anim.asm"
ManectricAnimation: INCLUDE "gfx/pokemon/manectric/anim.asm"
EggAnimation: INCLUDE "gfx/pokemon/egg/anim.asm"
|
programs/oeis/022/A022270.asm | karttu/loda | 1 | 5711 | <gh_stars>1-10
; A022270: a(n) = n*(13*n - 1)/2.
; 0,6,25,57,102,160,231,315,412,522,645,781,930,1092,1267,1455,1656,1870,2097,2337,2590,2856,3135,3427,3732,4050,4381,4725,5082,5452,5835,6231,6640,7062,7497,7945,8406,8880,9367,9867,10380,10906,11445,11997,12562,13140,13731,14335,14952,15582,16225,16881,17550,18232,18927,19635,20356,21090,21837,22597,23370,24156,24955,25767,26592,27430,28281,29145,30022,30912,31815,32731,33660,34602,35557,36525,37506,38500,39507,40527,41560,42606,43665,44737,45822,46920,48031,49155,50292,51442,52605,53781,54970,56172,57387,58615,59856,61110,62377,63657,64950,66256,67575,68907,70252,71610,72981,74365,75762,77172,78595,80031,81480,82942,84417,85905,87406,88920,90447,91987,93540,95106,96685,98277,99882,101500,103131,104775,106432,108102,109785,111481,113190,114912,116647,118395,120156,121930,123717,125517,127330,129156,130995,132847,134712,136590,138481,140385,142302,144232,146175,148131,150100,152082,154077,156085,158106,160140,162187,164247,166320,168406,170505,172617,174742,176880,179031,181195,183372,185562,187765,189981,192210,194452,196707,198975,201256,203550,205857,208177,210510,212856,215215,217587,219972,222370,224781,227205,229642,232092,234555,237031,239520,242022,244537,247065,249606,252160,254727,257307,259900,262506,265125,267757,270402,273060,275731,278415,281112,283822,286545,289281,292030,294792,297567,300355,303156,305970,308797,311637,314490,317356,320235,323127,326032,328950,331881,334825,337782,340752,343735,346731,349740,352762,355797,358845,361906,364980,368067,371167,374280,377406,380545,383697,386862,390040,393231,396435,399652,402882
mov $1,$0
mul $1,13
bin $1,2
div $1,13
|
applescripts/mute.scpt | jgiboney/clean_iTunes | 0 | 795 | <filename>applescripts/mute.scpt
on run(arguments)
set e to item 1 of arguments
tell app "itunes"
set v to the sound volume
end tell
tell app "itunes" to set the sound volume to 0
set done to 0
repeat while done = 0
tell app "itunes"
set p to player position
end tell
if p >= e
set done to 1
end if
end repeat
tell app "itunes" to set the sound volume to v
end run |
awa/src/awa-index_arrays.adb | fuzzysloth/ada-awa | 81 | 19349 | <reponame>fuzzysloth/ada-awa
-----------------------------------------------------------------------
-- awa-index_arrays -- Static index arrays
-- Copyright (C) 2015 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Util.Log.Loggers;
with Ada.Unchecked_Deallocation;
package body AWA.Index_Arrays is
Log : constant Util.Log.Loggers.Logger := Util.Log.Loggers.Create ("AWA.Index_Arrays");
type Name_Pair is record
Name : Element_Type_Access := null;
Index : Index_Type := Index_Type'First;
end record;
type Name_Pair_Array is array (Index_Type range <>) of Name_Pair;
type Name_Pair_Array_Access is access all Name_Pair_Array;
type Name_Array is array (Index_Type range <>) of Element_Type_Access;
type Name_Array_Access is access all Name_Array;
-- Register a definition by its name and allocate a unique runtime index.
procedure Add_Index (Name : in Element_Type_Access;
Index : out Index_Type);
-- A static list of names. This array is created during the elaboration
-- of definitions. It is sorted on names.
Indexes : Name_Pair_Array_Access;
-- A static list of names indexed by the index.
Names : Name_Array_Access;
-- The index of the last definition.
Last_Index : Index_Type := Index_Type'First;
-- ------------------------------
-- Register a definition by its name and allocate a unique runtime index.
-- ------------------------------
procedure Add_Index (Name : in Element_Type_Access;
Index : out Index_Type) is
procedure Free is
new Ada.Unchecked_Deallocation (Object => Name_Pair_Array,
Name => Name_Pair_Array_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Object => Name_Array,
Name => Name_Array_Access);
Left : Index_Type := Index_Type'First + 1;
Right : Index_Type := Last_Index;
begin
-- Check the storage and allocate it if necessary.
if Indexes = null then
Indexes := new Name_Pair_Array (Index_Type'First + 1 .. Index_Type'First + 10);
Names := new Name_Array (Index_Type'First + 1 .. Index_Type'First + 10);
elsif Indexes'Last = Last_Index then
declare
E : constant Name_Pair_Array_Access
:= new Name_Pair_Array (1 .. Last_Index + 10);
N : constant Name_Array_Access := new Name_Array (1 .. Last_Index + 10);
begin
E (Indexes'Range) := Indexes.all;
N (Names'Range) := Names.all;
Free (Indexes);
Free (Names);
Names := N;
Indexes := E;
end;
end if;
-- Find the definition position within the sorted table.
-- If a definition is already registered, bark and re-use the previous index.
while Left <= Right loop
declare
Pos : constant Index_Type := (Left + Right + 1) / 2;
Item : constant Element_Type_Access := Indexes (Pos).Name;
begin
if Name.all = Item.all then
Log.Error ("Definition " & Name.all & " is already registered.");
Index := Indexes (Pos).Index;
return;
elsif Name.all < Item.all then
Right := Pos - 1;
else
Left := Pos + 1;
end if;
end;
end loop;
-- Insert the new definition at the good position now.
if Left = 0 then
Left := Left + 1;
end if;
if Left <= Last_Index then
Indexes (Left + 1 .. Last_Index + 1) := Indexes (Left .. Last_Index);
end if;
Last_Index := Last_Index + 1;
Indexes (Left).Name := Name;
Indexes (Left).Index := Last_Index;
Names (Last_Index) := Name;
Index := Last_Index;
Log.Debug ("Definition " & Name.all & " index is {0}", Index_Type'Image (Index));
end Add_Index;
-- ------------------------------
-- Declare a new definition
-- ------------------------------
package body Definition is
Index : Index_Type;
Index_Name : aliased constant Element_Type := Name;
function Kind return Index_Type is
begin
return Index;
end Kind;
begin
Add_Index (Index_Name'Access, Index);
end Definition;
-- ------------------------------
-- Find the runtime index given the name.
-- Raises Not_Found exception if the name is not recognized.
-- ------------------------------
function Find (Name : in Element_Type) return Index_Type is
Left : Index_Type := 1;
Right : Index_Type := Last_Index;
begin
while Left <= Right loop
declare
Pos : constant Index_Type := (Left + Right + 1) / 2;
Item : constant Element_Type_Access := Indexes (Pos).Name;
begin
if Name = Item.all then
return Indexes (Pos).Index;
elsif Name < Item.all then
Right := Pos - 1;
else
Left := Pos + 1;
end if;
end;
end loop;
Log.Error ("Definition " & Name & " not recognized.");
raise Not_Found with "Definition " & Name & " not found";
end Find;
-- ------------------------------
-- Get the element associated with the index.
-- ------------------------------
function Get_Element (Index : in Index_Type) return Element_Type_Access is
begin
if Index = Invalid_Index or Index > Last_Index then
Log.Error ("Index {0} is out of bounds", Index_Type'Image (Index));
raise Not_Found;
end if;
return Names (Index);
end Get_Element;
-- ------------------------------
-- Check if the index is a valid index.
-- ------------------------------
function Is_Valid (Index : in Index_Type) return Boolean is
begin
return Index > Invalid_Index and Index <= Last_Index;
end Is_Valid;
-- ------------------------------
-- Get the last valid index.
-- ------------------------------
function Get_Last return Index_Type is
begin
return Last_Index;
end Get_Last;
end AWA.Index_Arrays;
|
programs/oeis/212/A212743.asm | karttu/loda | 0 | 99461 | <reponame>karttu/loda
; A212743: Number of (w,x,y,z) with all terms in {0,...,n} and max{w,x,y,z}>2*min{w,x,y,z}.
; 0,14,64,224,528,1134,2064,3584,5680,8750,12720,18144,24864,33614,44128,57344,72864,91854,113760,140000,169840,204974,244464,290304,341328,399854,464464,537824,618240,708750,807360,917504,1036864
mov $14,$0
mov $16,$0
lpb $16,1
clr $0,14
mov $0,$14
sub $16,1
sub $0,$16
mov $13,$0
add $13,1
lpb $13,1
clr $0,11
sub $13,1
sub $0,$13
pow $0,2
add $4,$0
mul $0,4
mov $3,2
add $3,$0
sub $4,$3
mov $6,$4
mod $4,2
sub $4,3
sub $6,2
mov $5,$6
add $5,2
mul $4,$5
mov $1,$4
sub $1,6
div $1,2
mul $1,2
add $12,$1
lpe
add $15,$12
lpe
mov $1,$15
|
orka/src/orka/interface/orka-jobs.ads | onox/orka | 52 | 25326 | -- SPDX-License-Identifier: Apache-2.0
--
-- Copyright (c) 2017 onox <<EMAIL>>
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
private with Ada.Finalization;
private with Orka.Atomics;
package Orka.Jobs is
pragma Preelaborate;
type Job is limited interface;
type Job_Ptr is not null access all Job'Class;
type Execution_Context is limited interface;
procedure Enqueue (Object : Execution_Context; Element : Job_Ptr) is abstract;
procedure Execute
(Object : Job;
Context : Execution_Context'Class) is abstract;
-- Execute the job. The job can insert extra jobs between itself and its
-- Dependent by calling the Enqueue procedure
function Dependent (Object : Job) return Job_Ptr is abstract;
-- Return a pointer to the job (if there is any) that depends on this job
function Decrement_Dependencies (Object : in out Job) return Boolean is abstract;
-- Decrement the number of dependencies (jobs) that still need to be
-- executed. Return True if all have been executed, False if there is
-- at least one job that still needs to run.
--
-- When this function returns True, this job can and should be scheduled.
function Has_Dependencies (Object : Job) return Boolean is abstract;
type Dependency_Array is array (Positive range <>) of Job_Ptr;
procedure Set_Dependency
(Object : access Job; Dependency : Job_Ptr) is abstract;
-- Set a job as the dependency of the given job. Object becomes the
-- dependent (successor) job of Dependency
--
-- J2.Set_Dependency (J1) creates the link J1 --> J2
procedure Set_Dependencies
(Object : access Job; Dependencies : Dependency_Array) is abstract;
-- Set some jobs as dependencies of the given job. Object becomes
-- the dependent (successor) job of each job in Dependencies
--
-- J4.Set_Dependencies ((J1, J2, J3)) gives:
--
-- J1 --
-- \
-- J2 ---> J4
-- /
-- J3 --
procedure Chain (Jobs : Dependency_Array);
-- Create a chain of jobs such that each job is a dependency of the
-- next job
--
-- Chain ((J1, J2, J3)) will result in:
--
-- J1 --> J2 --> J3
--
-- where J1 is the first job that will be executed and J3 the last job.
-----------------------------------------------------------------------------
Null_Job : constant Job_Ptr;
function Get_Null_Job return Job_Ptr is (Null_Job);
-- A function that is used when a non-static constant (Null_Job) is
-- needed in a preelaborated unit
procedure Free (Pointer : in out Job_Ptr)
with Pre => Pointer /= Null_Job;
function Create_Empty_Job return Job_Ptr;
-----------------------------------------------------------------------------
type Parallel_Job is interface and Job;
type Parallel_Job_Ptr is not null access all Parallel_Job'Class;
procedure Set_Range (Object : in out Parallel_Job; From, To : Positive) is abstract;
procedure Execute
(Object : Parallel_Job;
Context : Execution_Context'Class;
From, To : Positive) is abstract;
-- Any job which inherits Abstract_Parallel_Job needs to override this
-- procedure instead of the regular Execute procedure
type Parallel_Job_Cloner is not null access function
(Job : Parallel_Job_Ptr;
Length : Positive) return Dependency_Array;
function Parallelize
(Job : Parallel_Job_Ptr;
Clone : Parallel_Job_Cloner;
Length, Slice : Positive) return Job_Ptr;
-- Parallelize a job by returning a new job that will enqueue multiple
-- instances of the given job with different ranges
--
-- Length is the total number of elements and Slice is the maximum range
-- of a slice. For example, Length => 24 and Slice => 6 will spawn 4 jobs
-- with the ranges 1..6, 7..12, 13..18, and 19..24.
-----------------------------------------------------------------------------
type Abstract_Job is abstract new Job with private;
type Abstract_Parallel_Job is abstract new Abstract_Job and Parallel_Job with private;
overriding
procedure Execute
(Object : Abstract_Parallel_Job;
Context : Execution_Context'Class);
overriding
procedure Set_Range (Object : in out Abstract_Parallel_Job; From, To : Positive);
-----------------------------------------------------------------------------
type GPU_Job is interface and Job;
private
type No_Job is new Job with null record;
overriding
procedure Execute
(Object : No_Job;
Context : Execution_Context'Class);
overriding
function Dependent (Object : No_Job) return Job_Ptr is (Null_Job);
overriding
function Decrement_Dependencies (Object : in out No_Job) return Boolean is (False);
overriding
function Has_Dependencies (Object : No_Job) return Boolean is (False);
overriding
procedure Set_Dependency
(Object : access No_Job; Dependency : Job_Ptr) is null;
overriding
procedure Set_Dependencies
(Object : access No_Job; Dependencies : Dependency_Array) is null;
Null_Job : constant Job_Ptr := new No_Job;
-----------------------------------------------------------------------------
subtype Zero_Counter is Atomics.Counter (Initial_Value => 0);
type Zero_Counter_Access is access Zero_Counter;
type Counter_Controlled is new Ada.Finalization.Controlled with record
Counter : Zero_Counter_Access := new Zero_Counter;
end record;
overriding
procedure Adjust (Object : in out Counter_Controlled);
overriding
procedure Finalize (Object : in out Counter_Controlled);
type Abstract_Job is abstract new Job with record
Dependent : Job_Ptr := Null_Job;
Dependencies : Counter_Controlled;
end record;
overriding
function Dependent (Object : Abstract_Job) return Job_Ptr is (Object.Dependent);
overriding
function Decrement_Dependencies (Object : in out Abstract_Job) return Boolean;
overriding
function Has_Dependencies (Object : Abstract_Job) return Boolean;
overriding
procedure Set_Dependency
(Object : access Abstract_Job; Dependency : Job_Ptr);
overriding
procedure Set_Dependencies
(Object : access Abstract_Job; Dependencies : Dependency_Array);
-----------------------------------------------------------------------------
type Empty_Job is new Abstract_Job with null record;
overriding
procedure Execute
(Object : Empty_Job;
Context : Execution_Context'Class) is null;
function Create_Empty_Job return Job_Ptr is (new Empty_Job);
-----------------------------------------------------------------------------
type Parallel_For_Job is new Abstract_Job with record
Length, Slice : Positive;
Job : Parallel_Job_Ptr;
Clone : Parallel_Job_Cloner;
end record
with Dynamic_Predicate => not Parallel_For_Job.Job.Has_Dependencies;
overriding
procedure Execute
(Object : Parallel_For_Job;
Context : Execution_Context'Class);
type Abstract_Parallel_Job is abstract new Abstract_Job and Parallel_Job with record
From, To : Positive;
end record;
end Orka.Jobs;
|
wc.asm | reubenct/OSproject-xv6 | 1 | 87307 | <reponame>reubenct/OSproject-xv6<filename>wc.asm
_wc: file format elf32-i386
Disassembly of section .text:
00000000 <main>:
0: 8d 4c 24 04 lea 0x4(%esp),%ecx
4: 83 e4 f0 and $0xfffffff0,%esp
7: ff 71 fc pushl -0x4(%ecx)
a: 55 push %ebp
b: 89 e5 mov %esp,%ebp
d: 57 push %edi
e: 56 push %esi
f: 53 push %ebx
10: 51 push %ecx
11: be 01 00 00 00 mov $0x1,%esi
16: 83 ec 18 sub $0x18,%esp
19: 8b 01 mov (%ecx),%eax
1b: 8b 59 04 mov 0x4(%ecx),%ebx
1e: 83 c3 04 add $0x4,%ebx
21: 83 f8 01 cmp $0x1,%eax
24: 89 45 e4 mov %eax,-0x1c(%ebp)
27: 7e 56 jle 7f <main+0x7f>
29: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
30: 83 ec 08 sub $0x8,%esp
33: 6a 00 push $0x0
35: ff 33 pushl (%ebx)
37: e8 c6 03 00 00 call 402 <open>
3c: 83 c4 10 add $0x10,%esp
3f: 85 c0 test %eax,%eax
41: 89 c7 mov %eax,%edi
43: 78 26 js 6b <main+0x6b>
45: 83 ec 08 sub $0x8,%esp
48: ff 33 pushl (%ebx)
4a: 83 c6 01 add $0x1,%esi
4d: 50 push %eax
4e: 83 c3 04 add $0x4,%ebx
51: e8 4a 00 00 00 call a0 <wc>
56: 89 3c 24 mov %edi,(%esp)
59: e8 8c 03 00 00 call 3ea <close>
5e: 83 c4 10 add $0x10,%esp
61: 39 75 e4 cmp %esi,-0x1c(%ebp)
64: 75 ca jne 30 <main+0x30>
66: e8 57 03 00 00 call 3c2 <exit>
6b: 50 push %eax
6c: ff 33 pushl (%ebx)
6e: 68 c1 08 00 00 push $0x8c1
73: 6a 01 push $0x1
75: e8 b6 04 00 00 call 530 <printf>
7a: e8 43 03 00 00 call 3c2 <exit>
7f: 52 push %edx
80: 52 push %edx
81: 68 b3 08 00 00 push $0x8b3
86: 6a 00 push $0x0
88: e8 13 00 00 00 call a0 <wc>
8d: e8 30 03 00 00 call 3c2 <exit>
92: 66 90 xchg %ax,%ax
94: 66 90 xchg %ax,%ax
96: 66 90 xchg %ax,%ax
98: 66 90 xchg %ax,%ax
9a: 66 90 xchg %ax,%ax
9c: 66 90 xchg %ax,%ax
9e: 66 90 xchg %ax,%ax
000000a0 <wc>:
a0: 55 push %ebp
a1: 89 e5 mov %esp,%ebp
a3: 57 push %edi
a4: 56 push %esi
a5: 53 push %ebx
a6: 31 f6 xor %esi,%esi
a8: 31 db xor %ebx,%ebx
aa: 83 ec 1c sub $0x1c,%esp
ad: c7 45 dc 00 00 00 00 movl $0x0,-0x24(%ebp)
b4: c7 45 e0 00 00 00 00 movl $0x0,-0x20(%ebp)
bb: 90 nop
bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
c0: 83 ec 04 sub $0x4,%esp
c3: 68 00 02 00 00 push $0x200
c8: 68 e0 0b 00 00 push $0xbe0
cd: ff 75 08 pushl 0x8(%ebp)
d0: e8 05 03 00 00 call 3da <read>
d5: 83 c4 10 add $0x10,%esp
d8: 83 f8 00 cmp $0x0,%eax
db: 89 45 e4 mov %eax,-0x1c(%ebp)
de: 7e 5f jle 13f <wc+0x9f>
e0: 31 ff xor %edi,%edi
e2: eb 0e jmp f2 <wc+0x52>
e4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
e8: 31 f6 xor %esi,%esi
ea: 83 c7 01 add $0x1,%edi
ed: 39 7d e4 cmp %edi,-0x1c(%ebp)
f0: 74 3a je 12c <wc+0x8c>
f2: 0f be 87 e0 0b 00 00 movsbl 0xbe0(%edi),%eax
f9: 31 c9 xor %ecx,%ecx
fb: 3c 0a cmp $0xa,%al
fd: 0f 94 c1 sete %cl
100: 83 ec 08 sub $0x8,%esp
103: 50 push %eax
104: 68 9e 08 00 00 push $0x89e
109: 01 cb add %ecx,%ebx
10b: e8 40 01 00 00 call 250 <strchr>
110: 83 c4 10 add $0x10,%esp
113: 85 c0 test %eax,%eax
115: 75 d1 jne e8 <wc+0x48>
117: 85 f6 test %esi,%esi
119: 75 1d jne 138 <wc+0x98>
11b: 83 45 e0 01 addl $0x1,-0x20(%ebp)
11f: 83 c7 01 add $0x1,%edi
122: 39 7d e4 cmp %edi,-0x1c(%ebp)
125: be 01 00 00 00 mov $0x1,%esi
12a: 75 c6 jne f2 <wc+0x52>
12c: 8b 55 e4 mov -0x1c(%ebp),%edx
12f: 01 55 dc add %edx,-0x24(%ebp)
132: eb 8c jmp c0 <wc+0x20>
134: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
138: be 01 00 00 00 mov $0x1,%esi
13d: eb ab jmp ea <wc+0x4a>
13f: 75 24 jne 165 <wc+0xc5>
141: 83 ec 08 sub $0x8,%esp
144: ff 75 0c pushl 0xc(%ebp)
147: ff 75 dc pushl -0x24(%ebp)
14a: ff 75 e0 pushl -0x20(%ebp)
14d: 53 push %ebx
14e: 68 b4 08 00 00 push $0x8b4
153: 6a 01 push $0x1
155: e8 d6 03 00 00 call 530 <printf>
15a: 83 c4 20 add $0x20,%esp
15d: 8d 65 f4 lea -0xc(%ebp),%esp
160: 5b pop %ebx
161: 5e pop %esi
162: 5f pop %edi
163: 5d pop %ebp
164: c3 ret
165: 83 ec 08 sub $0x8,%esp
168: 68 a4 08 00 00 push $0x8a4
16d: 6a 01 push $0x1
16f: e8 bc 03 00 00 call 530 <printf>
174: e8 49 02 00 00 call 3c2 <exit>
179: 66 90 xchg %ax,%ax
17b: 66 90 xchg %ax,%ax
17d: 66 90 xchg %ax,%ax
17f: 90 nop
00000180 <strcpy>:
180: 55 push %ebp
181: 89 e5 mov %esp,%ebp
183: 53 push %ebx
184: 8b 45 08 mov 0x8(%ebp),%eax
187: 8b 4d 0c mov 0xc(%ebp),%ecx
18a: 89 c2 mov %eax,%edx
18c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
190: 83 c1 01 add $0x1,%ecx
193: 0f b6 59 ff movzbl -0x1(%ecx),%ebx
197: 83 c2 01 add $0x1,%edx
19a: 84 db test %bl,%bl
19c: 88 5a ff mov %bl,-0x1(%edx)
19f: 75 ef jne 190 <strcpy+0x10>
1a1: 5b pop %ebx
1a2: 5d pop %ebp
1a3: c3 ret
1a4: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
1aa: 8d bf 00 00 00 00 lea 0x0(%edi),%edi
000001b0 <strcmp>:
1b0: 55 push %ebp
1b1: 89 e5 mov %esp,%ebp
1b3: 56 push %esi
1b4: 53 push %ebx
1b5: 8b 55 08 mov 0x8(%ebp),%edx
1b8: 8b 4d 0c mov 0xc(%ebp),%ecx
1bb: 0f b6 02 movzbl (%edx),%eax
1be: 0f b6 19 movzbl (%ecx),%ebx
1c1: 84 c0 test %al,%al
1c3: 75 1e jne 1e3 <strcmp+0x33>
1c5: eb 29 jmp 1f0 <strcmp+0x40>
1c7: 89 f6 mov %esi,%esi
1c9: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
1d0: 83 c2 01 add $0x1,%edx
1d3: 0f b6 02 movzbl (%edx),%eax
1d6: 8d 71 01 lea 0x1(%ecx),%esi
1d9: 0f b6 59 01 movzbl 0x1(%ecx),%ebx
1dd: 84 c0 test %al,%al
1df: 74 0f je 1f0 <strcmp+0x40>
1e1: 89 f1 mov %esi,%ecx
1e3: 38 d8 cmp %bl,%al
1e5: 74 e9 je 1d0 <strcmp+0x20>
1e7: 29 d8 sub %ebx,%eax
1e9: 5b pop %ebx
1ea: 5e pop %esi
1eb: 5d pop %ebp
1ec: c3 ret
1ed: 8d 76 00 lea 0x0(%esi),%esi
1f0: 31 c0 xor %eax,%eax
1f2: 29 d8 sub %ebx,%eax
1f4: 5b pop %ebx
1f5: 5e pop %esi
1f6: 5d pop %ebp
1f7: c3 ret
1f8: 90 nop
1f9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000200 <strlen>:
200: 55 push %ebp
201: 89 e5 mov %esp,%ebp
203: 8b 4d 08 mov 0x8(%ebp),%ecx
206: 80 39 00 cmpb $0x0,(%ecx)
209: 74 12 je 21d <strlen+0x1d>
20b: 31 d2 xor %edx,%edx
20d: 8d 76 00 lea 0x0(%esi),%esi
210: 83 c2 01 add $0x1,%edx
213: 80 3c 11 00 cmpb $0x0,(%ecx,%edx,1)
217: 89 d0 mov %edx,%eax
219: 75 f5 jne 210 <strlen+0x10>
21b: 5d pop %ebp
21c: c3 ret
21d: 31 c0 xor %eax,%eax
21f: 5d pop %ebp
220: c3 ret
221: eb 0d jmp 230 <memset>
223: 90 nop
224: 90 nop
225: 90 nop
226: 90 nop
227: 90 nop
228: 90 nop
229: 90 nop
22a: 90 nop
22b: 90 nop
22c: 90 nop
22d: 90 nop
22e: 90 nop
22f: 90 nop
00000230 <memset>:
230: 55 push %ebp
231: 89 e5 mov %esp,%ebp
233: 57 push %edi
234: 8b 55 08 mov 0x8(%ebp),%edx
237: 8b 4d 10 mov 0x10(%ebp),%ecx
23a: 8b 45 0c mov 0xc(%ebp),%eax
23d: 89 d7 mov %edx,%edi
23f: fc cld
240: f3 aa rep stos %al,%es:(%edi)
242: 89 d0 mov %edx,%eax
244: 5f pop %edi
245: 5d pop %ebp
246: c3 ret
247: 89 f6 mov %esi,%esi
249: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000250 <strchr>:
250: 55 push %ebp
251: 89 e5 mov %esp,%ebp
253: 53 push %ebx
254: 8b 45 08 mov 0x8(%ebp),%eax
257: 8b 5d 0c mov 0xc(%ebp),%ebx
25a: 0f b6 10 movzbl (%eax),%edx
25d: 84 d2 test %dl,%dl
25f: 74 1d je 27e <strchr+0x2e>
261: 38 d3 cmp %dl,%bl
263: 89 d9 mov %ebx,%ecx
265: 75 0d jne 274 <strchr+0x24>
267: eb 17 jmp 280 <strchr+0x30>
269: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
270: 38 ca cmp %cl,%dl
272: 74 0c je 280 <strchr+0x30>
274: 83 c0 01 add $0x1,%eax
277: 0f b6 10 movzbl (%eax),%edx
27a: 84 d2 test %dl,%dl
27c: 75 f2 jne 270 <strchr+0x20>
27e: 31 c0 xor %eax,%eax
280: 5b pop %ebx
281: 5d pop %ebp
282: c3 ret
283: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
289: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000290 <gets>:
290: 55 push %ebp
291: 89 e5 mov %esp,%ebp
293: 57 push %edi
294: 56 push %esi
295: 53 push %ebx
296: 31 f6 xor %esi,%esi
298: 8d 7d e7 lea -0x19(%ebp),%edi
29b: 83 ec 1c sub $0x1c,%esp
29e: eb 29 jmp 2c9 <gets+0x39>
2a0: 83 ec 04 sub $0x4,%esp
2a3: 6a 01 push $0x1
2a5: 57 push %edi
2a6: 6a 00 push $0x0
2a8: e8 2d 01 00 00 call 3da <read>
2ad: 83 c4 10 add $0x10,%esp
2b0: 85 c0 test %eax,%eax
2b2: 7e 1d jle 2d1 <gets+0x41>
2b4: 0f b6 45 e7 movzbl -0x19(%ebp),%eax
2b8: 8b 55 08 mov 0x8(%ebp),%edx
2bb: 89 de mov %ebx,%esi
2bd: 3c 0a cmp $0xa,%al
2bf: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1)
2c3: 74 1b je 2e0 <gets+0x50>
2c5: 3c 0d cmp $0xd,%al
2c7: 74 17 je 2e0 <gets+0x50>
2c9: 8d 5e 01 lea 0x1(%esi),%ebx
2cc: 3b 5d 0c cmp 0xc(%ebp),%ebx
2cf: 7c cf jl 2a0 <gets+0x10>
2d1: 8b 45 08 mov 0x8(%ebp),%eax
2d4: c6 04 30 00 movb $0x0,(%eax,%esi,1)
2d8: 8d 65 f4 lea -0xc(%ebp),%esp
2db: 5b pop %ebx
2dc: 5e pop %esi
2dd: 5f pop %edi
2de: 5d pop %ebp
2df: c3 ret
2e0: 8b 45 08 mov 0x8(%ebp),%eax
2e3: 89 de mov %ebx,%esi
2e5: c6 04 30 00 movb $0x0,(%eax,%esi,1)
2e9: 8d 65 f4 lea -0xc(%ebp),%esp
2ec: 5b pop %ebx
2ed: 5e pop %esi
2ee: 5f pop %edi
2ef: 5d pop %ebp
2f0: c3 ret
2f1: eb 0d jmp 300 <stat>
2f3: 90 nop
2f4: 90 nop
2f5: 90 nop
2f6: 90 nop
2f7: 90 nop
2f8: 90 nop
2f9: 90 nop
2fa: 90 nop
2fb: 90 nop
2fc: 90 nop
2fd: 90 nop
2fe: 90 nop
2ff: 90 nop
00000300 <stat>:
300: 55 push %ebp
301: 89 e5 mov %esp,%ebp
303: 56 push %esi
304: 53 push %ebx
305: 83 ec 08 sub $0x8,%esp
308: 6a 00 push $0x0
30a: ff 75 08 pushl 0x8(%ebp)
30d: e8 f0 00 00 00 call 402 <open>
312: 83 c4 10 add $0x10,%esp
315: 85 c0 test %eax,%eax
317: 78 27 js 340 <stat+0x40>
319: 83 ec 08 sub $0x8,%esp
31c: ff 75 0c pushl 0xc(%ebp)
31f: 89 c3 mov %eax,%ebx
321: 50 push %eax
322: e8 f3 00 00 00 call 41a <fstat>
327: 89 c6 mov %eax,%esi
329: 89 1c 24 mov %ebx,(%esp)
32c: e8 b9 00 00 00 call 3ea <close>
331: 83 c4 10 add $0x10,%esp
334: 89 f0 mov %esi,%eax
336: 8d 65 f8 lea -0x8(%ebp),%esp
339: 5b pop %ebx
33a: 5e pop %esi
33b: 5d pop %ebp
33c: c3 ret
33d: 8d 76 00 lea 0x0(%esi),%esi
340: b8 ff ff ff ff mov $0xffffffff,%eax
345: eb ef jmp 336 <stat+0x36>
347: 89 f6 mov %esi,%esi
349: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
00000350 <atoi>:
350: 55 push %ebp
351: 89 e5 mov %esp,%ebp
353: 53 push %ebx
354: 8b 4d 08 mov 0x8(%ebp),%ecx
357: 0f be 11 movsbl (%ecx),%edx
35a: 8d 42 d0 lea -0x30(%edx),%eax
35d: 3c 09 cmp $0x9,%al
35f: b8 00 00 00 00 mov $0x0,%eax
364: 77 1f ja 385 <atoi+0x35>
366: 8d 76 00 lea 0x0(%esi),%esi
369: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
370: 8d 04 80 lea (%eax,%eax,4),%eax
373: 83 c1 01 add $0x1,%ecx
376: 8d 44 42 d0 lea -0x30(%edx,%eax,2),%eax
37a: 0f be 11 movsbl (%ecx),%edx
37d: 8d 5a d0 lea -0x30(%edx),%ebx
380: 80 fb 09 cmp $0x9,%bl
383: 76 eb jbe 370 <atoi+0x20>
385: 5b pop %ebx
386: 5d pop %ebp
387: c3 ret
388: 90 nop
389: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
00000390 <memmove>:
390: 55 push %ebp
391: 89 e5 mov %esp,%ebp
393: 56 push %esi
394: 53 push %ebx
395: 8b 5d 10 mov 0x10(%ebp),%ebx
398: 8b 45 08 mov 0x8(%ebp),%eax
39b: 8b 75 0c mov 0xc(%ebp),%esi
39e: 85 db test %ebx,%ebx
3a0: 7e 14 jle 3b6 <memmove+0x26>
3a2: 31 d2 xor %edx,%edx
3a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
3a8: 0f b6 0c 16 movzbl (%esi,%edx,1),%ecx
3ac: 88 0c 10 mov %cl,(%eax,%edx,1)
3af: 83 c2 01 add $0x1,%edx
3b2: 39 da cmp %ebx,%edx
3b4: 75 f2 jne 3a8 <memmove+0x18>
3b6: 5b pop %ebx
3b7: 5e pop %esi
3b8: 5d pop %ebp
3b9: c3 ret
000003ba <fork>:
3ba: b8 01 00 00 00 mov $0x1,%eax
3bf: cd 40 int $0x40
3c1: c3 ret
000003c2 <exit>:
3c2: b8 02 00 00 00 mov $0x2,%eax
3c7: cd 40 int $0x40
3c9: c3 ret
000003ca <wait>:
3ca: b8 03 00 00 00 mov $0x3,%eax
3cf: cd 40 int $0x40
3d1: c3 ret
000003d2 <pipe>:
3d2: b8 04 00 00 00 mov $0x4,%eax
3d7: cd 40 int $0x40
3d9: c3 ret
000003da <read>:
3da: b8 05 00 00 00 mov $0x5,%eax
3df: cd 40 int $0x40
3e1: c3 ret
000003e2 <write>:
3e2: b8 10 00 00 00 mov $0x10,%eax
3e7: cd 40 int $0x40
3e9: c3 ret
000003ea <close>:
3ea: b8 15 00 00 00 mov $0x15,%eax
3ef: cd 40 int $0x40
3f1: c3 ret
000003f2 <kill>:
3f2: b8 06 00 00 00 mov $0x6,%eax
3f7: cd 40 int $0x40
3f9: c3 ret
000003fa <exec>:
3fa: b8 07 00 00 00 mov $0x7,%eax
3ff: cd 40 int $0x40
401: c3 ret
00000402 <open>:
402: b8 0f 00 00 00 mov $0xf,%eax
407: cd 40 int $0x40
409: c3 ret
0000040a <mknod>:
40a: b8 11 00 00 00 mov $0x11,%eax
40f: cd 40 int $0x40
411: c3 ret
00000412 <unlink>:
412: b8 12 00 00 00 mov $0x12,%eax
417: cd 40 int $0x40
419: c3 ret
0000041a <fstat>:
41a: b8 08 00 00 00 mov $0x8,%eax
41f: cd 40 int $0x40
421: c3 ret
00000422 <link>:
422: b8 13 00 00 00 mov $0x13,%eax
427: cd 40 int $0x40
429: c3 ret
0000042a <mkdir>:
42a: b8 14 00 00 00 mov $0x14,%eax
42f: cd 40 int $0x40
431: c3 ret
00000432 <chdir>:
432: b8 09 00 00 00 mov $0x9,%eax
437: cd 40 int $0x40
439: c3 ret
0000043a <dup>:
43a: b8 0a 00 00 00 mov $0xa,%eax
43f: cd 40 int $0x40
441: c3 ret
00000442 <getpid>:
442: b8 0b 00 00 00 mov $0xb,%eax
447: cd 40 int $0x40
449: c3 ret
0000044a <sbrk>:
44a: b8 0c 00 00 00 mov $0xc,%eax
44f: cd 40 int $0x40
451: c3 ret
00000452 <sleep>:
452: b8 0d 00 00 00 mov $0xd,%eax
457: cd 40 int $0x40
459: c3 ret
0000045a <uptime>:
45a: b8 0e 00 00 00 mov $0xe,%eax
45f: cd 40 int $0x40
461: c3 ret
00000462 <random>:
462: b8 16 00 00 00 mov $0x16,%eax
467: cd 40 int $0x40
469: c3 ret
0000046a <cprocstate>:
46a: b8 18 00 00 00 mov $0x18,%eax
46f: cd 40 int $0x40
471: c3 ret
00000472 <signalinfo>:
472: b8 19 00 00 00 mov $0x19,%eax
477: cd 40 int $0x40
479: c3 ret
0000047a <setseed>:
47a: b8 17 00 00 00 mov $0x17,%eax
47f: cd 40 int $0x40
481: c3 ret
482: 66 90 xchg %ax,%ax
484: 66 90 xchg %ax,%ax
486: 66 90 xchg %ax,%ax
488: 66 90 xchg %ax,%ax
48a: 66 90 xchg %ax,%ax
48c: 66 90 xchg %ax,%ax
48e: 66 90 xchg %ax,%ax
00000490 <printint>:
write(fd, &c, 1);
}
static void
printint(int fd, int xx, int base, int sgn)
{
490: 55 push %ebp
491: 89 e5 mov %esp,%ebp
493: 57 push %edi
494: 56 push %esi
495: 89 c6 mov %eax,%esi
497: 53 push %ebx
498: 83 ec 4c sub $0x4c,%esp
char buf[16];
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
49b: 8b 5d 08 mov 0x8(%ebp),%ebx
49e: 85 db test %ebx,%ebx
4a0: 74 09 je 4ab <printint+0x1b>
4a2: 89 d0 mov %edx,%eax
4a4: c1 e8 1f shr $0x1f,%eax
4a7: 84 c0 test %al,%al
4a9: 75 75 jne 520 <printint+0x90>
neg = 1;
x = -xx;
} else {
x = xx;
4ab: 89 d0 mov %edx,%eax
static char digits[] = "0123456789ABCDEF";
char buf[16];
int i, neg;
uint x;
neg = 0;
4ad: c7 45 c4 00 00 00 00 movl $0x0,-0x3c(%ebp)
4b4: 89 75 c0 mov %esi,-0x40(%ebp)
x = -xx;
} else {
x = xx;
}
i = 0;
4b7: 31 ff xor %edi,%edi
4b9: 89 ce mov %ecx,%esi
4bb: 8d 5d d7 lea -0x29(%ebp),%ebx
4be: eb 02 jmp 4c2 <printint+0x32>
do{
buf[i++] = digits[x % base];
4c0: 89 cf mov %ecx,%edi
4c2: 31 d2 xor %edx,%edx
4c4: f7 f6 div %esi
4c6: 8d 4f 01 lea 0x1(%edi),%ecx
4c9: 0f b6 92 dc 08 00 00 movzbl 0x8dc(%edx),%edx
}while((x /= base) != 0);
4d0: 85 c0 test %eax,%eax
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
4d2: 88 14 0b mov %dl,(%ebx,%ecx,1)
}while((x /= base) != 0);
4d5: 75 e9 jne 4c0 <printint+0x30>
if(neg)
4d7: 8b 55 c4 mov -0x3c(%ebp),%edx
x = xx;
}
i = 0;
do{
buf[i++] = digits[x % base];
4da: 89 c8 mov %ecx,%eax
4dc: 8b 75 c0 mov -0x40(%ebp),%esi
}while((x /= base) != 0);
if(neg)
4df: 85 d2 test %edx,%edx
4e1: 74 08 je 4eb <printint+0x5b>
buf[i++] = '-';
4e3: 8d 4f 02 lea 0x2(%edi),%ecx
4e6: c6 44 05 d8 2d movb $0x2d,-0x28(%ebp,%eax,1)
while(--i >= 0)
4eb: 8d 79 ff lea -0x1(%ecx),%edi
4ee: 66 90 xchg %ax,%ax
4f0: 0f b6 44 3d d8 movzbl -0x28(%ebp,%edi,1),%eax
4f5: 83 ef 01 sub $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
4f8: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
4ff: 00
500: 89 5c 24 04 mov %ebx,0x4(%esp)
504: 89 34 24 mov %esi,(%esp)
507: 88 45 d7 mov %al,-0x29(%ebp)
50a: e8 d3 fe ff ff call 3e2 <write>
buf[i++] = digits[x % base];
}while((x /= base) != 0);
if(neg)
buf[i++] = '-';
while(--i >= 0)
50f: 83 ff ff cmp $0xffffffff,%edi
512: 75 dc jne 4f0 <printint+0x60>
putc(fd, buf[i]);
}
514: 83 c4 4c add $0x4c,%esp
517: 5b pop %ebx
518: 5e pop %esi
519: 5f pop %edi
51a: 5d pop %ebp
51b: c3 ret
51c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
x = -xx;
520: 89 d0 mov %edx,%eax
522: f7 d8 neg %eax
int i, neg;
uint x;
neg = 0;
if(sgn && xx < 0){
neg = 1;
524: c7 45 c4 01 00 00 00 movl $0x1,-0x3c(%ebp)
52b: eb 87 jmp 4b4 <printint+0x24>
52d: 8d 76 00 lea 0x0(%esi),%esi
00000530 <printf>:
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
530: 55 push %ebp
531: 89 e5 mov %esp,%ebp
533: 57 push %edi
char *s;
int c, i, state;
uint *ap;
state = 0;
534: 31 ff xor %edi,%edi
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
536: 56 push %esi
537: 53 push %ebx
538: 83 ec 3c sub $0x3c,%esp
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
53b: 8b 5d 0c mov 0xc(%ebp),%ebx
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
53e: 8d 45 10 lea 0x10(%ebp),%eax
}
// Print to the given fd. Only understands %d, %x, %p, %s.
void
printf(int fd, char *fmt, ...)
{
541: 8b 75 08 mov 0x8(%ebp),%esi
char *s;
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
544: 89 45 d4 mov %eax,-0x2c(%ebp)
for(i = 0; fmt[i]; i++){
547: 0f b6 13 movzbl (%ebx),%edx
54a: 83 c3 01 add $0x1,%ebx
54d: 84 d2 test %dl,%dl
54f: 75 39 jne 58a <printf+0x5a>
551: e9 c2 00 00 00 jmp 618 <printf+0xe8>
556: 66 90 xchg %ax,%ax
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
558: 83 fa 25 cmp $0x25,%edx
55b: 0f 84 bf 00 00 00 je 620 <printf+0xf0>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
561: 8d 45 e2 lea -0x1e(%ebp),%eax
564: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
56b: 00
56c: 89 44 24 04 mov %eax,0x4(%esp)
570: 89 34 24 mov %esi,(%esp)
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
} else {
putc(fd, c);
573: 88 55 e2 mov %dl,-0x1e(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
576: e8 67 fe ff ff call 3e2 <write>
57b: 83 c3 01 add $0x1,%ebx
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
57e: 0f b6 53 ff movzbl -0x1(%ebx),%edx
582: 84 d2 test %dl,%dl
584: 0f 84 8e 00 00 00 je 618 <printf+0xe8>
c = fmt[i] & 0xff;
if(state == 0){
58a: 85 ff test %edi,%edi
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
58c: 0f be c2 movsbl %dl,%eax
if(state == 0){
58f: 74 c7 je 558 <printf+0x28>
if(c == '%'){
state = '%';
} else {
putc(fd, c);
}
} else if(state == '%'){
591: 83 ff 25 cmp $0x25,%edi
594: 75 e5 jne 57b <printf+0x4b>
if(c == 'd'){
596: 83 fa 64 cmp $0x64,%edx
599: 0f 84 31 01 00 00 je 6d0 <printf+0x1a0>
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
59f: 25 f7 00 00 00 and $0xf7,%eax
5a4: 83 f8 70 cmp $0x70,%eax
5a7: 0f 84 83 00 00 00 je 630 <printf+0x100>
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
5ad: 83 fa 73 cmp $0x73,%edx
5b0: 0f 84 a2 00 00 00 je 658 <printf+0x128>
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
5b6: 83 fa 63 cmp $0x63,%edx
5b9: 0f 84 35 01 00 00 je 6f4 <printf+0x1c4>
putc(fd, *ap);
ap++;
} else if(c == '%'){
5bf: 83 fa 25 cmp $0x25,%edx
5c2: 0f 84 e0 00 00 00 je 6a8 <printf+0x178>
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5c8: 8d 45 e6 lea -0x1a(%ebp),%eax
5cb: 83 c3 01 add $0x1,%ebx
5ce: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5d5: 00
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
5d6: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5d8: 89 44 24 04 mov %eax,0x4(%esp)
5dc: 89 34 24 mov %esi,(%esp)
5df: 89 55 d0 mov %edx,-0x30(%ebp)
5e2: c6 45 e6 25 movb $0x25,-0x1a(%ebp)
5e6: e8 f7 fd ff ff call 3e2 <write>
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
5eb: 8b 55 d0 mov -0x30(%ebp),%edx
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
5ee: 8d 45 e7 lea -0x19(%ebp),%eax
5f1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
5f8: 00
5f9: 89 44 24 04 mov %eax,0x4(%esp)
5fd: 89 34 24 mov %esi,(%esp)
} else if(c == '%'){
putc(fd, c);
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
600: 88 55 e7 mov %dl,-0x19(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
603: e8 da fd ff ff call 3e2 <write>
int c, i, state;
uint *ap;
state = 0;
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
608: 0f b6 53 ff movzbl -0x1(%ebx),%edx
60c: 84 d2 test %dl,%dl
60e: 0f 85 76 ff ff ff jne 58a <printf+0x5a>
614: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
putc(fd, c);
}
state = 0;
}
}
}
618: 83 c4 3c add $0x3c,%esp
61b: 5b pop %ebx
61c: 5e pop %esi
61d: 5f pop %edi
61e: 5d pop %ebp
61f: c3 ret
ap = (uint*)(void*)&fmt + 1;
for(i = 0; fmt[i]; i++){
c = fmt[i] & 0xff;
if(state == 0){
if(c == '%'){
state = '%';
620: bf 25 00 00 00 mov $0x25,%edi
625: e9 51 ff ff ff jmp 57b <printf+0x4b>
62a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
630: 8b 45 d4 mov -0x2c(%ebp),%eax
633: b9 10 00 00 00 mov $0x10,%ecx
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
638: 31 ff xor %edi,%edi
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
63a: c7 04 24 00 00 00 00 movl $0x0,(%esp)
641: 8b 10 mov (%eax),%edx
643: 89 f0 mov %esi,%eax
645: e8 46 fe ff ff call 490 <printint>
ap++;
64a: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
64e: e9 28 ff ff ff jmp 57b <printf+0x4b>
653: 90 nop
654: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
} else if(c == 's'){
s = (char*)*ap;
658: 8b 45 d4 mov -0x2c(%ebp),%eax
ap++;
65b: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
ap++;
} else if(c == 'x' || c == 'p'){
printint(fd, *ap, 16, 0);
ap++;
} else if(c == 's'){
s = (char*)*ap;
65f: 8b 38 mov (%eax),%edi
ap++;
if(s == 0)
s = "(null)";
661: b8 d5 08 00 00 mov $0x8d5,%eax
666: 85 ff test %edi,%edi
668: 0f 44 f8 cmove %eax,%edi
while(*s != 0){
66b: 0f b6 07 movzbl (%edi),%eax
66e: 84 c0 test %al,%al
670: 74 2a je 69c <printf+0x16c>
672: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
678: 88 45 e3 mov %al,-0x1d(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
67b: 8d 45 e3 lea -0x1d(%ebp),%eax
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
putc(fd, *s);
s++;
67e: 83 c7 01 add $0x1,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
681: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
688: 00
689: 89 44 24 04 mov %eax,0x4(%esp)
68d: 89 34 24 mov %esi,(%esp)
690: e8 4d fd ff ff call 3e2 <write>
} else if(c == 's'){
s = (char*)*ap;
ap++;
if(s == 0)
s = "(null)";
while(*s != 0){
695: 0f b6 07 movzbl (%edi),%eax
698: 84 c0 test %al,%al
69a: 75 dc jne 678 <printf+0x148>
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
69c: 31 ff xor %edi,%edi
69e: e9 d8 fe ff ff jmp 57b <printf+0x4b>
6a3: 90 nop
6a4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6a8: 8d 45 e5 lea -0x1b(%ebp),%eax
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
6ab: 31 ff xor %edi,%edi
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6ad: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
6b4: 00
6b5: 89 44 24 04 mov %eax,0x4(%esp)
6b9: 89 34 24 mov %esi,(%esp)
6bc: c6 45 e5 25 movb $0x25,-0x1b(%ebp)
6c0: e8 1d fd ff ff call 3e2 <write>
6c5: e9 b1 fe ff ff jmp 57b <printf+0x4b>
6ca: 8d b6 00 00 00 00 lea 0x0(%esi),%esi
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
6d0: 8b 45 d4 mov -0x2c(%ebp),%eax
6d3: b9 0a 00 00 00 mov $0xa,%ecx
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
6d8: 66 31 ff xor %di,%di
} else {
putc(fd, c);
}
} else if(state == '%'){
if(c == 'd'){
printint(fd, *ap, 10, 1);
6db: c7 04 24 01 00 00 00 movl $0x1,(%esp)
6e2: 8b 10 mov (%eax),%edx
6e4: 89 f0 mov %esi,%eax
6e6: e8 a5 fd ff ff call 490 <printint>
ap++;
6eb: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
6ef: e9 87 fe ff ff jmp 57b <printf+0x4b>
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
6f4: 8b 45 d4 mov -0x2c(%ebp),%eax
} else {
// Unknown % sequence. Print it to draw attention.
putc(fd, '%');
putc(fd, c);
}
state = 0;
6f7: 31 ff xor %edi,%edi
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
6f9: 8b 00 mov (%eax),%eax
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
6fb: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp)
702: 00
703: 89 34 24 mov %esi,(%esp)
while(*s != 0){
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
706: 88 45 e4 mov %al,-0x1c(%ebp)
#include "user.h"
static void
putc(int fd, char c)
{
write(fd, &c, 1);
709: 8d 45 e4 lea -0x1c(%ebp),%eax
70c: 89 44 24 04 mov %eax,0x4(%esp)
710: e8 cd fc ff ff call 3e2 <write>
putc(fd, *s);
s++;
}
} else if(c == 'c'){
putc(fd, *ap);
ap++;
715: 83 45 d4 04 addl $0x4,-0x2c(%ebp)
719: e9 5d fe ff ff jmp 57b <printf+0x4b>
71e: 66 90 xchg %ax,%ax
00000720 <free>:
720: 55 push %ebp
721: a1 c0 0b 00 00 mov 0xbc0,%eax
726: 89 e5 mov %esp,%ebp
728: 57 push %edi
729: 56 push %esi
72a: 53 push %ebx
72b: 8b 5d 08 mov 0x8(%ebp),%ebx
72e: 8b 10 mov (%eax),%edx
730: 8d 4b f8 lea -0x8(%ebx),%ecx
733: 39 c8 cmp %ecx,%eax
735: 73 19 jae 750 <free+0x30>
737: 89 f6 mov %esi,%esi
739: 8d bc 27 00 00 00 00 lea 0x0(%edi,%eiz,1),%edi
740: 39 d1 cmp %edx,%ecx
742: 72 1c jb 760 <free+0x40>
744: 39 d0 cmp %edx,%eax
746: 73 18 jae 760 <free+0x40>
748: 89 d0 mov %edx,%eax
74a: 39 c8 cmp %ecx,%eax
74c: 8b 10 mov (%eax),%edx
74e: 72 f0 jb 740 <free+0x20>
750: 39 d0 cmp %edx,%eax
752: 72 f4 jb 748 <free+0x28>
754: 39 d1 cmp %edx,%ecx
756: 73 f0 jae 748 <free+0x28>
758: 90 nop
759: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
760: 8b 73 fc mov -0x4(%ebx),%esi
763: 8d 3c f1 lea (%ecx,%esi,8),%edi
766: 39 d7 cmp %edx,%edi
768: 74 19 je 783 <free+0x63>
76a: 89 53 f8 mov %edx,-0x8(%ebx)
76d: 8b 50 04 mov 0x4(%eax),%edx
770: 8d 34 d0 lea (%eax,%edx,8),%esi
773: 39 f1 cmp %esi,%ecx
775: 74 23 je 79a <free+0x7a>
777: 89 08 mov %ecx,(%eax)
779: a3 c0 0b 00 00 mov %eax,0xbc0
77e: 5b pop %ebx
77f: 5e pop %esi
780: 5f pop %edi
781: 5d pop %ebp
782: c3 ret
783: 03 72 04 add 0x4(%edx),%esi
786: 89 73 fc mov %esi,-0x4(%ebx)
789: 8b 10 mov (%eax),%edx
78b: 8b 12 mov (%edx),%edx
78d: 89 53 f8 mov %edx,-0x8(%ebx)
790: 8b 50 04 mov 0x4(%eax),%edx
793: 8d 34 d0 lea (%eax,%edx,8),%esi
796: 39 f1 cmp %esi,%ecx
798: 75 dd jne 777 <free+0x57>
79a: 03 53 fc add -0x4(%ebx),%edx
79d: a3 c0 0b 00 00 mov %eax,0xbc0
7a2: 89 50 04 mov %edx,0x4(%eax)
7a5: 8b 53 f8 mov -0x8(%ebx),%edx
7a8: 89 10 mov %edx,(%eax)
7aa: 5b pop %ebx
7ab: 5e pop %esi
7ac: 5f pop %edi
7ad: 5d pop %ebp
7ae: c3 ret
7af: 90 nop
000007b0 <malloc>:
7b0: 55 push %ebp
7b1: 89 e5 mov %esp,%ebp
7b3: 57 push %edi
7b4: 56 push %esi
7b5: 53 push %ebx
7b6: 83 ec 0c sub $0xc,%esp
7b9: 8b 45 08 mov 0x8(%ebp),%eax
7bc: 8b 15 c0 0b 00 00 mov 0xbc0,%edx
7c2: 8d 78 07 lea 0x7(%eax),%edi
7c5: c1 ef 03 shr $0x3,%edi
7c8: 83 c7 01 add $0x1,%edi
7cb: 85 d2 test %edx,%edx
7cd: 0f 84 a3 00 00 00 je 876 <malloc+0xc6>
7d3: 8b 02 mov (%edx),%eax
7d5: 8b 48 04 mov 0x4(%eax),%ecx
7d8: 39 cf cmp %ecx,%edi
7da: 76 74 jbe 850 <malloc+0xa0>
7dc: 81 ff 00 10 00 00 cmp $0x1000,%edi
7e2: be 00 10 00 00 mov $0x1000,%esi
7e7: 8d 1c fd 00 00 00 00 lea 0x0(,%edi,8),%ebx
7ee: 0f 43 f7 cmovae %edi,%esi
7f1: ba 00 80 00 00 mov $0x8000,%edx
7f6: 81 ff ff 0f 00 00 cmp $0xfff,%edi
7fc: 0f 46 da cmovbe %edx,%ebx
7ff: eb 10 jmp 811 <malloc+0x61>
801: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi
808: 8b 02 mov (%edx),%eax
80a: 8b 48 04 mov 0x4(%eax),%ecx
80d: 39 cf cmp %ecx,%edi
80f: 76 3f jbe 850 <malloc+0xa0>
811: 39 05 c0 0b 00 00 cmp %eax,0xbc0
817: 89 c2 mov %eax,%edx
819: 75 ed jne 808 <malloc+0x58>
81b: 83 ec 0c sub $0xc,%esp
81e: 53 push %ebx
81f: e8 26 fc ff ff call 44a <sbrk>
824: 83 c4 10 add $0x10,%esp
827: 83 f8 ff cmp $0xffffffff,%eax
82a: 74 1c je 848 <malloc+0x98>
82c: 89 70 04 mov %esi,0x4(%eax)
82f: 83 ec 0c sub $0xc,%esp
832: 83 c0 08 add $0x8,%eax
835: 50 push %eax
836: e8 e5 fe ff ff call 720 <free>
83b: 8b 15 c0 0b 00 00 mov 0xbc0,%edx
841: 83 c4 10 add $0x10,%esp
844: 85 d2 test %edx,%edx
846: 75 c0 jne 808 <malloc+0x58>
848: 31 c0 xor %eax,%eax
84a: eb 1c jmp 868 <malloc+0xb8>
84c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi
850: 39 cf cmp %ecx,%edi
852: 74 1c je 870 <malloc+0xc0>
854: 29 f9 sub %edi,%ecx
856: 89 48 04 mov %ecx,0x4(%eax)
859: 8d 04 c8 lea (%eax,%ecx,8),%eax
85c: 89 78 04 mov %edi,0x4(%eax)
85f: 89 15 c0 0b 00 00 mov %edx,0xbc0
865: 83 c0 08 add $0x8,%eax
868: 8d 65 f4 lea -0xc(%ebp),%esp
86b: 5b pop %ebx
86c: 5e pop %esi
86d: 5f pop %edi
86e: 5d pop %ebp
86f: c3 ret
870: 8b 08 mov (%eax),%ecx
872: 89 0a mov %ecx,(%edx)
874: eb e9 jmp 85f <malloc+0xaf>
876: c7 05 c0 0b 00 00 c4 movl $0xbc4,0xbc0
87d: 0b 00 00
880: c7 05 c4 0b 00 00 c4 movl $0xbc4,0xbc4
887: 0b 00 00
88a: b8 c4 0b 00 00 mov $0xbc4,%eax
88f: c7 05 c8 0b 00 00 00 movl $0x0,0xbc8
896: 00 00 00
899: e9 3e ff ff ff jmp 7dc <malloc+0x2c>
|
wof/lcs/base/2F2.asm | zengfr/arcade_game_romhacking_sourcecode_top_secret_data | 6 | 84076 | <reponame>zengfr/arcade_game_romhacking_sourcecode_top_secret_data
copyright zengfr site:http://github.com/zengfr/romhack
001430 movea.w (A4)+, A1 [base+2F2]
001436 subq.w #1, ($304,A5) [base+2F2]
001514 move.w A0, -(A4) [base+2F2]
00151A addq.w #1, ($304,A5) [base+2F2]
01A806 move.w A6, ($2f2,A5) [base+304]
01A80A lea ($6bbc,A5), A0 [base+2F2]
copyright zengfr site:http://github.com/zengfr/romhack
|
sharding-core/sharding-core-parse/sharding-core-parse-mysql/src/main/antlr4/imports/mysql/DCLStatement.g4 | rayoo/incubator-shardingsphere | 0 | 2851 | /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
grammar DCLStatement;
import Symbol, Keyword, Literals, BaseRule;
grant
: GRANT (proxyClause_ | privilegeClause_ | roleClause_) TO
;
revoke
: REVOKE (proxyClause_ | privilegeClause_ | allClause_ | roleClause_) FROM
;
proxyClause_
: PROXY ON
;
privilegeClause_
: privileges_ ON onObjectClause_
;
roleClause_
: ignoredIdentifiers_
;
allClause_
: ALL PRIVILEGES? COMMA_ GRANT OPTION
;
privileges_
: privilegeType_ columnNames? (COMMA_ privilegeType_ columnNames?)*
;
privilegeType_
: ALL PRIVILEGES?
| ALTER ROUTINE?
| CREATE
| CREATE ROUTINE
| CREATE TABLESPACE
| CREATE TEMPORARY TABLES
| CREATE USER
| CREATE VIEW
| DELETE
| DROP
| EVENT
| EXECUTE
| FILE
| GRANT OPTION
| INDEX
| INSERT
| LOCK TABLES
| PROCESS
| PROXY
| REFERENCES
| RELOAD
| REPLICATION CLIENT
| REPLICATION SLAVE
| SELECT
| SHOW DATABASES
| SHOW VIEW
| SHUTDOWN
| SUPER
| TRIGGER
| UPDATE
| USAGE
| AUDIT_ADMIN
| BINLOG_ADMIN
| CONNECTION_ADMIN
| ENCRYPTION_KEY_ADMIN
| FIREWALL_ADMIN
| FIREWALL_USER
| GROUP_REPLICATION_ADMIN
| REPLICATION_SLAVE_ADMIN
| ROLE_ADMIN
| SET_USER_ID
| SYSTEM_VARIABLES_ADMIN
| VERSION_TOKEN_ADMIN
;
onObjectClause_
: objectType_? privilegeLevel_
;
objectType_
: TABLE | FUNCTION | PROCEDURE
;
privilegeLevel_
: ASTERISK_ | ASTERISK_ DOT_ASTERISK_ | identifier_ DOT_ASTERISK_ | tableName
;
createUser
: CREATE USER
;
dropUser
: DROP USER
;
alterUser
: ALTER USER
;
renameUser
: RENAME USER
;
createRole
: CREATE ROLE
;
dropRole
: DROP ROLE
;
setRole
: SET DEFAULT? ROLE
;
setPassword
: SET PASSWORD
;
|
Transynther/x86/_processed/AVXALIGN/_zr_/i9-9900K_12_0xca.log_21829_1776.asm | ljhsiun2/medusa | 9 | 177552 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r12
push %r15
push %r8
push %rbp
push %rcx
push %rdi
push %rsi
lea addresses_D_ht+0x155a3, %rcx
nop
nop
nop
xor %r15, %r15
mov $0x6162636465666768, %rsi
movq %rsi, (%rcx)
nop
nop
nop
nop
xor %r12, %r12
lea addresses_normal_ht+0x5279, %rsi
lea addresses_normal_ht+0x2e19, %rdi
cmp $13656, %r8
mov $121, %rcx
rep movsl
nop
nop
nop
nop
inc %r8
lea addresses_D_ht+0x10339, %rsi
lea addresses_WC_ht+0x1d079, %rdi
cmp $42219, %r10
mov $4, %rcx
rep movsq
sub %rdi, %rdi
lea addresses_WC_ht+0x10279, %r12
nop
nop
nop
nop
nop
inc %r8
movb (%r12), %r10b
nop
nop
nop
nop
cmp $25160, %r8
lea addresses_D_ht+0x19763, %r10
nop
nop
nop
nop
nop
dec %r15
movb $0x61, (%r10)
nop
nop
inc %rdi
lea addresses_normal_ht+0x1079, %r10
nop
nop
add $50577, %rdi
movb $0x61, (%r10)
nop
nop
nop
and %r8, %r8
lea addresses_A_ht+0x19879, %r10
nop
nop
nop
nop
cmp %r8, %r8
movl $0x61626364, (%r10)
and %r8, %r8
lea addresses_WT_ht+0x12579, %rdi
nop
nop
add %rsi, %rsi
mov $0x6162636465666768, %r15
movq %r15, %xmm6
and $0xffffffffffffffc0, %rdi
vmovntdq %ymm6, (%rdi)
nop
sub %r10, %r10
lea addresses_WC_ht+0x19879, %rsi
nop
xor %rdi, %rdi
movups (%rsi), %xmm3
vpextrq $0, %xmm3, %r15
nop
inc %r8
lea addresses_WC_ht+0x6d4d, %rsi
lea addresses_UC_ht+0xdf39, %rdi
clflush (%rdi)
nop
nop
nop
nop
xor $24274, %rbp
mov $57, %rcx
rep movsw
nop
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0xcf93, %rsi
lea addresses_normal_ht+0xf357, %rdi
nop
add $39541, %r8
mov $72, %rcx
rep movsl
nop
add %rdi, %rdi
lea addresses_WT_ht+0x8e79, %rcx
nop
nop
add %r8, %r8
mov (%rcx), %r12w
nop
nop
nop
add $47777, %r15
lea addresses_UC_ht+0xf879, %rdi
nop
nop
nop
nop
dec %rcx
movl $0x61626364, (%rdi)
nop
nop
lfence
lea addresses_D_ht+0x1d759, %rsi
lea addresses_D_ht+0x17c79, %rdi
nop
nop
nop
nop
add $3140, %r12
mov $96, %rcx
rep movsb
nop
nop
nop
cmp %rcx, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbp
pop %r8
pop %r15
pop %r12
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r15
push %r8
push %rax
push %rbp
push %rbx
push %rdi
// Store
lea addresses_PSE+0x193b9, %rbp
cmp %r8, %r8
mov $0x5152535455565758, %r15
movq %r15, (%rbp)
nop
nop
nop
nop
cmp %rbx, %rbx
// Load
lea addresses_US+0x1cdda, %rdi
nop
nop
and $29441, %rbp
movntdqa (%rdi), %xmm5
vpextrq $0, %xmm5, %r8
nop
and %r8, %r8
// Faulty Load
lea addresses_A+0x3079, %rdi
dec %r10
mov (%rdi), %r15
lea oracles, %rax
and $0xff, %r15
shlq $12, %r15
mov (%rax,%r15,1), %r15
pop %rdi
pop %rbx
pop %rbp
pop %rax
pop %r8
pop %r15
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_A', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 4}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': True, 'type': 'addresses_US', 'same': False, 'AVXalign': False, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_A', 'same': True, 'AVXalign': True, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_D_ht', 'same': True, 'AVXalign': False, 'congruent': 0}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 9}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 5}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 6}, 'dst': {'same': True, 'type': 'addresses_WC_ht', 'congruent': 10}}
{'OP': 'LOAD', 'src': {'size': 1, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_D_ht', 'same': False, 'AVXalign': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'size': 1, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': True, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_A_ht', 'same': True, 'AVXalign': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'size': 32, 'NT': True, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': False, 'congruent': 5}}
{'OP': 'LOAD', 'src': {'size': 16, 'NT': False, 'type': 'addresses_WC_ht', 'same': False, 'AVXalign': False, 'congruent': 11}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_WC_ht', 'congruent': 0}, 'dst': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 6}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_UC_ht', 'congruent': 1}, 'dst': {'same': False, 'type': 'addresses_normal_ht', 'congruent': 1}}
{'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_WT_ht', 'same': False, 'AVXalign': True, 'congruent': 7}}
{'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_UC_ht', 'same': False, 'AVXalign': False, 'congruent': 10}}
{'OP': 'REPM', 'src': {'same': False, 'type': 'addresses_D_ht', 'congruent': 5}, 'dst': {'same': False, 'type': 'addresses_D_ht', 'congruent': 9}}
{'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/227/A227842.asm | neoneye/loda-programs | 11 | 15280 | ; A227842: First differences of A014817.
; 1,2,3,2,4,5,6,5,5,8,9,6,10,11,12,7,13,12,15,12,14,17,18,13,15,20,19,16,22,21,24,17,21,26,27,18,26,29,28,21,29,28,33,28,30,33,36,27,31,34,35,32,38,39,40,31,37,42,45,32,44,45,46,33,45,44,49,44,46,51,52,37,49,56,49,48,54,53,60,47
mov $3,2
mov $5,$0
lpb $3
mov $0,$5
sub $3,1
add $0,$3
trn $0,1
seq $0,166375 ; a(n) = sum (floor (j^2/n)) taken over 1 <= j <= n-1.
mov $2,$3
mul $2,$0
add $4,$2
lpe
min $5,1
mul $5,$0
mov $0,$4
sub $0,$5
add $0,1
|
engine/printer/printer.asm | genterz/pokecross | 28 | 243168 | <filename>engine/printer/printer.asm<gh_stars>10-100
SendScreenToPrinter:
.loop
call JoyTextDelay
call CheckCancelPrint
jr c, .cancel
ld a, [wJumptableIndex]
bit 7, a
jr nz, .finished
call PrinterJumptableIteration
call CheckPrinterStatus
call PlacePrinterStatusString
call DelayFrame
jr .loop
.finished
and a
ret
.cancel
scf
ret
Printer_CleanUpAfterSend:
xor a
ld [wPrinterConnectionOpen], a
ld [wPrinterOpcode], a
ret
Printer_PrepareTileMapForPrint:
push af
call Printer_StartTransmission
pop af
ld [wPrinterMargins], a
call Printer_CopyTileMapToBuffer
ret
Printer_ExitPrinter:
call ReturnToMapFromSubmenu
call Printer_RestartMapMusic
ret
PrintDexEntry:
ld a, [wPrinterQueueLength]
push af
ld hl, vTiles1
ld de, FontInversed
lb bc, BANK(FontInversed), $80
call Request1bpp
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
call Printer_StartTransmission
ln a, 1, 0
ld [wPrinterMargins], a
farcall PrintPage1
call ClearTileMap
ld a, %11100100
call DmgToCgbBGPals
call DelayFrame
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
ld a, 8 ; 16 rows
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .skip_second_page ; canceled or got an error
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call Printer_StartTransmission
ln a, 0, 3
ld [wPrinterMargins], a
farcall PrintPage2
call Printer_ResetJoypadRegisters
ld a, 4
ld [wPrinterQueueLength], a
call SendScreenToPrinter
.skip_second_page
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
ld c, 8
.low_volume_delay_frames
call LowVolume
call DelayFrame
dec c
jr nz, .low_volume_delay_frames
pop af
ld [wPrinterQueueLength], a
ret
PrintPCBox:
ld a, [wPrinterQueueLength]
push af
ld a, 18 / 2
ld [wPrinterQueueLength], a
ld a, e
ld [wAddrOfBoxToPrint], a
ld a, d
ld [wAddrOfBoxToPrint + 1], a
ld a, b
ld [wBankOfBoxToPrint], a
ld a, c
ld [wWhichBoxToPrint], a
xor a
ldh [hPrinter], a
ld [wFinishedPrintingBox], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], 4
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page1
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page2
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page3
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
call PrintPCBox_Page4
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Printer_ResetRegistersAndStartDataSend
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
Printer_ResetRegistersAndStartDataSend:
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
ret
PrintUnownStamp:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], $4
xor a
ldh [hBGMapMode], a
call LoadTileMapToTempTileMap
farcall PlaceUnownPrinterFrontpic
ln a, 0, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
.loop
call JoyTextDelay
call CheckCancelPrint
jr c, .done
ld a, [wJumptableIndex]
bit 7, a
jr nz, .done
call PrinterJumptableIteration
ld a, [wJumptableIndex]
cp $2
jr nc, .check_status
ld a, 6 / 2
ld [wPrinterRowIndex], a
.check_status
call CheckPrinterStatus
call PlacePrinterStatusString
call DelayFrame
jr .loop
.done
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call Call_LoadTempTileMapToTileMap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
pop af
ld [wPrinterQueueLength], a
ret
PrintMailAndExit:
call PrintMail
call Printer_ExitPrinter
ret
PrintMail:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
ldh [hBGMapMode], a
ln a, 1, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], %0100
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTileMap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
pop af
ld [wPrinterQueueLength], a
ret
PrintPartymon:
ld a, [wPrinterQueueLength]
push af
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
xor a
ldh [hBGMapMode], a
farcall PrintPartyMonPage1
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], %0100
ld a, 16 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
xor a
ldh [hBGMapMode], a
farcall PrintPartyMonPage2
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
ld a, 18 / 2
ld [wPrinterQueueLength], a
call Printer_ResetJoypadRegisters
call SendScreenToPrinter
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
call Printer_CopyBufferToTileMap
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
_PrintDiploma:
ld a, [wPrinterQueueLength]
push af
farcall PlaceDiplomaOnScreen
xor a
ldh [hPrinter], a
call Printer_PlayMusic
ldh a, [rIE]
push af
xor a
ldh [rIF], a
ld a, (1 << SERIAL) | (1 << VBLANK)
ldh [rIE], a
ld hl, hVBlank
ld a, [hl]
push af
ld [hl], %0100
ln a, 1, 0 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
jr c, .cancel
call Printer_CleanUpAfterSend
ld c, 12
call DelayFrames
call LoadTileMapToTempTileMap
xor a
ldh [hBGMapMode], a
farcall PrintDiplomaPage2
ln a, 0, 3 ; to be loaded to wPrinterMargins
call Printer_PrepareTileMapForPrint
call Call_LoadTempTileMapToTileMap
call Printer_ResetJoypadRegisters
ld a, 18 / 2
ld [wPrinterQueueLength], a
call SendScreenToPrinter
.cancel
pop af
ldh [hVBlank], a
call Printer_CleanUpAfterSend
xor a
ldh [rIF], a
pop af
ldh [rIE], a
call Printer_ExitPrinter
pop af
ld [wPrinterQueueLength], a
ret
CheckCancelPrint:
ldh a, [hJoyDown]
and B_BUTTON
jr nz, .pressed_b
and a
ret
.pressed_b
ld a, [wca80]
cp $c
jr nz, .cancel
.loop
ld a, [wPrinterOpcode]
and a
jr nz, .loop
ld a, $16 ; cancel
ld [wPrinterOpcode], a
ld a, $88
ldh [rSB], a
ld a, (0 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
ld a, (1 << rSC_ON) | (1 << rSC_CLOCK)
ldh [rSC], a
.loop2
ld a, [wPrinterOpcode]
and a
jr nz, .loop2
.cancel
ld a, $1
ldh [hPrinter], a
scf
ret
Printer_CopyTileMapToBuffer:
hlcoord 0, 0
ld de, wPrinterTileMapBuffer
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
Printer_CopyBufferToTileMap:
ld hl, wPrinterTileMapBuffer
decoord 0, 0
ld bc, SCREEN_WIDTH * SCREEN_HEIGHT
call CopyBytes
ret
Printer_ResetJoypadRegisters:
xor a
ldh [hJoyReleased], a
ldh [hJoyPressed], a
ldh [hJoyDown], a
ldh [hJoyLast], a
ret
Printer_PlayMusic:
ld de, MUSIC_PRINTER
call PlayMusic2
ret
Printer_RestartMapMusic:
call RestartMapMusic
ret
CheckPrinterStatus:
; Check for printer errors
; If [ca88] == -1, we're disconnected
ld a, [wPrinterHandshake]
cp -1
jr nz, .printer_connected
ld a, [wPrinterStatusFlags]
cp -1
jr z, .error_2
.printer_connected
; ca89 contains printer status flags
ld a, [wPrinterStatusFlags]
and %11100000
ret z ; no error
bit 7, a
jr nz, .error_1
bit 6, a
jr nz, .error_4
; paper error
ld a, PRINTER_ERROR_3
jr .load_text_index
.error_4
; temperature error
ld a, PRINTER_ERROR_4
jr .load_text_index
.error_1
; printer battery low
ld a, PRINTER_ERROR_1
jr .load_text_index
.error_2
; connection error
ld a, PRINTER_ERROR_2
.load_text_index
ld [wPrinterStatus], a
ret
PlacePrinterStatusString:
; Print nonzero printer status
ld a, [wPrinterStatus]
and a
ret z
push af
xor a
ldh [hBGMapMode], a
hlcoord 0, 5
lb bc, 10, 18
call Textbox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 1, 7
ld a, BANK(GBPrinterStrings)
call FarString
hlcoord 2, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ldh [hBGMapMode], a
xor a
ld [wPrinterStatus], a
ret
Unreferenced_Function847bd:
ld a, [wPrinterStatus]
and a
ret z
push af
xor a
ldh [hBGMapMode], a
hlcoord 2, 4
lb bc, 13, 16
call ClearBox
pop af
ld e, a
ld d, 0
ld hl, PrinterStatusStringPointers
add hl, de
add hl, de
ld e, [hl]
inc hl
ld d, [hl]
hlcoord 4, 7
ld a, BANK(GBPrinterStrings)
call FarString
hlcoord 4, 15
ld de, String_PressBToCancel
call PlaceString
ld a, $1
ldh [hBGMapMode], a
xor a
ld [wPrinterStatus], a
ret
String_PressBToCancel:
db "Press B to Cancel@"
PrinterStatusStringPointers:
dw GBPrinterString_Null ; @
dw GBPrinterString_CheckingLink ; CHECKING LINK
dw GBPrinterString_Transmitting ; TRANSMITTING
dw GBPrinterString_Printing ; PRINTING
dw GBPrinterString_PrinterError1 ; error 1
dw GBPrinterString_PrinterError2 ; error 2
dw GBPrinterString_PrinterError3 ; error 3
dw GBPrinterString_PrinterError4 ; error 4
PrintPCBox_Page1:
xor a
ld [wWhichBoxMonToPrint], a
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
hlcoord 0, 0
ld bc, 9 * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceSideBorders
call Printer_PlaceTopBorder
hlcoord 4, 3
ld de, .String_PokemonList
call PlaceString
ld a, [wWhichBoxToPrint]
ld bc, BOX_NAME_LENGTH
ld hl, wBoxNames
call AddNTimes
ld d, h
ld e, l
hlcoord 6, 5
call PlaceString
ld a, 1
call Printer_GetBoxMonSpecies
hlcoord 2, 9
ld c, 3
call Printer_PrintBoxListSegment
ret
.String_PokemonList:
db "#MON LIST@"
PrintPCBox_Page2:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 4
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 6
call Printer_PrintBoxListSegment
ret
PrintPCBox_Page3:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
call Printer_PlaceSideBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 10
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 6
call Printer_PrintBoxListSegment
ret
PrintPCBox_Page4:
hlcoord 0, 0
ld bc, SCREEN_HEIGHT * SCREEN_WIDTH
ld a, " "
call ByteFill
call Printer_PlaceEmptyBoxSlotString
hlcoord 1, 15
lb bc, 2, 18
call ClearBox
call Printer_PlaceSideBorders
call Printer_PlaceBottomBorders
ld a, [wFinishedPrintingBox]
and a
ret nz
ld a, 16
call Printer_GetBoxMonSpecies
hlcoord 2, 0
ld c, 5
call Printer_PrintBoxListSegment
ret
Printer_PrintBoxListSegment:
ld a, [wBankOfBoxToPrint]
call GetSRAMBank
.loop
ld a, c
and a
jp z, .max_length
dec c
ld a, [de]
cp $ff
jp z, .finish
ld [wNamedObjectIndexBuffer], a
ld [wCurPartySpecies], a
push bc
push hl
push de
push hl
ld bc, 16
ld a, " "
call ByteFill
pop hl
push hl
call GetBasePokemonName
pop hl
push hl
call PlaceString
ld a, [wCurPartySpecies]
cp EGG
pop hl
jr z, .ok2
ld bc, MON_NAME_LENGTH
add hl, bc
call Printer_GetMonGender
ld bc, SCREEN_WIDTH - MON_NAME_LENGTH
add hl, bc
ld a, "/"
ld [hli], a
push hl
ld bc, 14
ld a, " "
call ByteFill
pop hl
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, sBoxMonNicknames - sBox
add hl, bc
ld bc, MON_NAME_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld e, l
ld d, h
pop hl
push hl
call PlaceString
pop hl
ld bc, MON_NAME_LENGTH
add hl, bc
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, 2 + MONS_PER_BOX + MON_LEVEL
add hl, bc
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld a, [hl]
pop hl
call PrintLevel_Force3Digits
.ok2
ld hl, wWhichBoxMonToPrint
inc [hl]
pop de
pop hl
ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
inc de
jp .loop
.finish
ld a, $1
ld [wFinishedPrintingBox], a
.max_length
call CloseSRAM
ret
Printer_GetMonGender:
push hl
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
ld bc, 2 + MONS_PER_BOX + MON_DVS
add hl, bc
ld bc, BOXMON_STRUCT_LENGTH
ld a, [wWhichBoxMonToPrint]
call AddNTimes
ld de, wTempMonDVs
ld a, [hli]
ld [de], a
inc de
ld a, [hli]
ld [de], a
ld a, [wWhichBoxMonToPrint]
ld [wCurPartyMon], a
ld a, TEMPMON
ld [wMonType], a
farcall GetGender
ld a, " "
jr c, .got_gender
ld a, "♂"
jr nz, .got_gender
ld a, "♀"
.got_gender
pop hl
ld [hli], a
ret
Printer_GetBoxMonSpecies:
push hl
ld e, a
ld d, $0
ld a, [wAddrOfBoxToPrint]
ld l, a
ld a, [wAddrOfBoxToPrint + 1]
ld h, a
add hl, de
ld e, l
ld d, h
pop hl
ret
Printer_PlaceTopBorder:
hlcoord 0, 0
ld a, "┌"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
.loop
ld [hli], a
dec c
jr nz, .loop
ld a, "┐"
ld [hl], a
ret
Printer_PlaceSideBorders:
hlcoord 0, 0
ld de, SCREEN_WIDTH - 1
ld c, SCREEN_HEIGHT
.loop
ld a, "│"
ld [hl], a
add hl, de
ld a, "│"
ld [hli], a
dec c
jr nz, .loop
ret
Printer_PlaceBottomBorders:
hlcoord 0, 17
ld a, "└"
ld [hli], a
ld a, "─"
ld c, SCREEN_WIDTH - 2
.loop
ld [hli], a
dec c
jr nz, .loop
ld a, "┘"
ld [hl], a
ret
Printer_PlaceEmptyBoxSlotString:
hlcoord 2, 0
ld c, $6
.loop
push bc
push hl
ld de, String84a25
call PlaceString
pop hl
ld bc, 3 * SCREEN_WIDTH
add hl, bc
pop bc
dec c
jr nz, .loop
ret
String84a25:
db " ------@"
|
libsrc/_DEVELOPMENT/math/float/math48/z80/core/mm48_sqr.asm | jpoikela/z88dk | 640 | 1307 |
SECTION code_clib
SECTION code_fp_math48
PUBLIC mm48_sqr
EXTERN am48_derror_edom_zc
EXTERN mm48_equal, mm48_fpdiv, mm48_fpadd, mm48_fpsub, mm48__add10
mm48_sqr:
; square root
; AC' = SQR(AC')
;
; enter : AC'(BCDEHL') = float x
;
; exit : success
;
; AC' = SQR(x)
; carry reset
;
; fail if domain error
;
; AC' = 0
; carry set
;
; uses : af, af', bc', de', hl'
;Kvadratroden beregnes med Newton-Raphson
;iterationsmetoden. Et gaet udregnes ud fra
;det foregaaende gaet efter formelen:
;I(n+1)=(X/I(n)+I(n))/2.
;Som foerste gaet halveres X's exponent.
;Der fortsaettes indtil ABS(I(n+1)-I(n)) er
;mindre end den halve exponent af X minus 20.
exx
; AC = x
ld a,b
inc l
dec l
exx
ret z ; if x == 0
or a
jp m, am48_derror_edom_zc ; if x < 0
push bc ; save AC
push de
push hl
exx
call mm48_equal
ld a,l ;Foerste iteration:
add a,$80 ;halver exponenten
sra a
add a,$80
ld l,a ;Sammenligningsvaerdi
sub 20 ;er den halve exponent
push af ;Gem s.vaerdi
exx
mm48__sqr1:
; AC = x
; AC'= y
push bc ;Gem tallet
push de ;(push x)
push hl
exx
; AC = y
; AC'= x
call mm48_fpdiv ;Divider med og adder
call mm48_fpadd ;forrige gaet
exx
; AC = x
; AC'= y
dec l ;Halver
call mm48_fpsub
exx
ld a,l
; AC'= x
pop hl ;Hent tallet
pop de ;(pop x)
pop bc
ex (sp),hl ;Hent s.vaerdi ind i H
cp h
ex (sp),hl ;Fortsaet indtil forsk.
jr nc, mm48__sqr1 ;er lille nok
; AC'= result
pop af
or a
jp mm48__add10 + 1
|
libsrc/_DEVELOPMENT/target/yaz180/driver/i2c/i2c_interrupt_disable.asm | jpoikela/z88dk | 0 | 28769 | ;==============================================================================
; Contents of this file are copyright <NAME>
;
; You have permission to use this for NON COMMERCIAL USE ONLY
; If you wish to use it elsewhere, please include an acknowledgement to myself.
;
; https://github.com/feilipu/
;
; https://feilipu.me/
;
;
; This work was authored in Marrakech, Morocco during May/June 2017.
INCLUDE "config_private.inc"
SECTION code_driver
PUBLIC __i2c_interrupt_disable
;Disable the I2C interrupt for each PCA9665 device
;Configuring the interrupt is done in the i2c_interrupt_attach function
;input A = device address, __IO_I2C1_PORT_MSB or __IO_I2C2_PORT_MSB
__i2c_interrupt_disable:
push af ;preserve device address
cp __IO_I2C2_PORT_MSB
jr Z, i2c_int_dis2
cp __IO_I2C1_PORT_MSB
jr NZ, i2c_int_exit ;no device address match, so exit
in0 a, (ITC) ;get INT/TRAP Control Register (ITC)
and ~ITC_ITE1 ;mask out INT1
jr i2c_int_dis1
i2c_int_dis2:
in0 a, (ITC) ;get INT/TRAP Control Register (ITC)
and ~ITC_ITE2 ;mask out INT2
i2c_int_dis1:
out0 (ITC), a ;disable external interrupt
i2c_int_exit:
pop af
ret
|
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/c4/c48009h.ada | best08618/asylo | 7 | 2082 | -- C48009H.ADA
-- Grant of Unlimited Rights
--
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- released technical data and computer software in whole or in part, in
-- any manner and for any purpose whatsoever, and to have or permit others
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
-- FOR ALLOCATORS OF THE FORM "NEW T'(X)", CHECK THAT CONSTRAINT_ERROR
-- IS RAISED IF T IS AN (UNCONSTRAINED) ACCESS TYPE, THE DESIGNATED TYPE
-- FOR T'BASE IS CONSTRAINED, AND THE OBJECT DESIGNATED BY X DOES NOT
-- HAVE DISCRIMINANTS OR INDEX BOUNDS THAT EQUAL THE CORRESPONDING
-- VALUES FOR T'S DESIGNATED TYPE.
-- EG 08/30/84
WITH REPORT;
PROCEDURE C48009H IS
USE REPORT;
BEGIN
TEST("C48009H","FOR ALLOCATORS OF THE FORM 'NEW T'(X)', CHECK " &
"THAT CONSTRAINT_ERROR IS RAISED WHEN " &
"APPROPRIATE - UNCONSTRAINED ACCESS TYPE OF A " &
"CONSTRAINED TYPE");
DECLARE
TYPE UR(A : INTEGER) IS
RECORD
NULL;
END RECORD;
TYPE UA IS ARRAY(INTEGER RANGE <>) OF INTEGER;
PACKAGE P IS
TYPE UP(A : INTEGER) IS PRIVATE;
TYPE UL(A : INTEGER) IS LIMITED PRIVATE;
PRIVATE
TYPE UP(A : INTEGER) IS
RECORD
NULL;
END RECORD;
TYPE UL(A : INTEGER) IS
RECORD
NULL;
END RECORD;
END P;
TYPE A_CR IS ACCESS UR(IDENT_INT(2));
TYPE A_CA IS ACCESS UA(2 .. IDENT_INT(4));
TYPE A_CP IS ACCESS P.UP(3);
TYPE A_CL IS ACCESS P.UL(4);
TYPE AA_CR IS ACCESS A_CR;
TYPE AA_CA IS ACCESS A_CA;
TYPE AA_CP IS ACCESS A_CP;
TYPE AA_CL IS ACCESS A_CL;
V_AA_CR : AA_CR;
V_AA_CA : AA_CA;
V_AA_CP : AA_CP;
V_AA_CL : AA_CL;
BEGIN
BEGIN
V_AA_CR := NEW A_CR'(NEW UR(3));
FAILED ("NO EXCEPTION RAISED - CR");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - CR");
END;
BEGIN
V_AA_CA := NEW A_CA'(NEW UA(IDENT_INT(3) .. 5));
FAILED ("NO EXCEPTION RAISED - CA");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - CA");
END;
BEGIN
V_AA_CP := NEW A_CP'(NEW P.UP(IDENT_INT(4)));
FAILED ("NO EXCEPTION RAISED - CP");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - CP");
END;
BEGIN
V_AA_CL := NEW A_CL'(NEW P.UL(5));
FAILED ("NO EXCEPTION RAISED - CL");
EXCEPTION
WHEN CONSTRAINT_ERROR =>
NULL;
WHEN OTHERS =>
FAILED ("WRONG EXCEPTION RAISED - CL");
END;
END;
RESULT;
END C48009H;
|
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2_notsx.log_21829_284.asm | ljhsiun2/medusa | 9 | 84778 | .global s_prepare_buffers
s_prepare_buffers:
push %r11
push %r14
push %r15
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x151ba, %rsi
lea addresses_normal_ht+0x118b3, %rdi
nop
nop
nop
nop
nop
xor %rbx, %rbx
mov $78, %rcx
rep movsq
nop
cmp $17273, %rsi
lea addresses_WT_ht+0x140b9, %rsi
lea addresses_UC_ht+0xb9f3, %rdi
nop
nop
and %rbx, %rbx
mov $120, %rcx
rep movsb
nop
nop
nop
nop
nop
dec %r15
lea addresses_A_ht+0x14ab3, %r14
nop
nop
and $61078, %r11
mov $0x6162636465666768, %rsi
movq %rsi, (%r14)
nop
nop
nop
nop
sub $45355, %r14
lea addresses_normal_ht+0xc193, %r11
nop
nop
nop
and $36325, %rdi
mov (%r11), %r14d
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0x7c5a, %r15
nop
nop
nop
nop
nop
add %rcx, %rcx
movups (%r15), %xmm6
vpextrq $1, %xmm6, %rbx
nop
nop
nop
nop
add %rsi, %rsi
lea addresses_UC_ht+0xdc33, %r11
nop
nop
nop
nop
nop
sub $54061, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm2
movups %xmm2, (%r11)
nop
nop
nop
and %rcx, %rcx
lea addresses_UC_ht+0x67b3, %r15
nop
cmp $46481, %rcx
movl $0x61626364, (%r15)
nop
nop
nop
nop
nop
and %rdi, %rdi
lea addresses_WT_ht+0xcab3, %r15
nop
nop
nop
nop
nop
cmp %r11, %r11
mov (%r15), %rbx
sub %r11, %r11
lea addresses_A_ht+0xb10f, %rdi
nop
nop
inc %rsi
mov (%rdi), %r14
nop
nop
nop
nop
and $37853, %rcx
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %r15
pop %r14
pop %r11
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r15
push %r8
push %r9
push %rcx
push %rdx
// Store
lea addresses_A+0x1a4f3, %rcx
xor $40649, %r8
movl $0x51525354, (%rcx)
nop
inc %rdx
// Faulty Load
lea addresses_PSE+0x64b3, %r15
nop
sub $40476, %r9
movb (%r15), %r12b
lea oracles, %r8
and $0xff, %r12
shlq $12, %r12
mov (%r8,%r12,1), %r12
pop %rdx
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}}
{'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 1, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 2, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}}
{'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}}
{'33': 21829}
33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33 33
*/
|
alloy4fun_models/trashltl/models/4/75h9om7qDeQqKSB2L.als | Kaixi26/org.alloytools.alloy | 0 | 5055 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred id75h9om7qDeQqKSB2L_prop5 {
eventually ( some f:File | f' in Trash')
}
pred __repair { id75h9om7qDeQqKSB2L_prop5 }
check __repair { id75h9om7qDeQqKSB2L_prop5 <=> prop5o } |
source/web/servlet/http/servlet-http_servlets.ads | svn2github/matreshka | 24 | 7541 | ------------------------------------------------------------------------------
-- --
-- Matreshka Project --
-- --
-- Web Framework --
-- --
-- Runtime Library Component --
-- --
------------------------------------------------------------------------------
-- --
-- Copyright © 2014-2016, <NAME> <<EMAIL>> --
-- All rights reserved. --
-- --
-- Redistribution and use in source and binary forms, with or without --
-- modification, are permitted provided that the following conditions --
-- are met: --
-- --
-- * Redistributions of source code must retain the above copyright --
-- notice, this list of conditions and the following disclaimer. --
-- --
-- * Redistributions in binary form must reproduce the above copyright --
-- notice, this list of conditions and the following disclaimer in the --
-- documentation and/or other materials provided with the distribution. --
-- --
-- * Neither the name of the Vadim Godunko, IE nor the names of its --
-- contributors may be used to endorse or promote products derived from --
-- this software without specific prior written permission. --
-- --
-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS --
-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT --
-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR --
-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT --
-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, --
-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED --
-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR --
-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF --
-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING --
-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS --
-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. --
-- --
------------------------------------------------------------------------------
-- $Revision$ $Date$
------------------------------------------------------------------------------
with League.Calendars;
with League.Calendars.ISO_8601;
with League.Strings;
with Servlet.Generic_Servlets;
with Servlet.HTTP_Requests;
with Servlet.HTTP_Responses;
with Servlet.Requests;
with Servlet.Responses;
with Matreshka.RFC2616_Dates;
package Servlet.HTTP_Servlets is
pragma Preelaborate;
type HTTP_Servlet is
abstract new Servlet.Generic_Servlets.Generic_Servlet with private;
not overriding procedure Do_Delete
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a DELETE request. The DELETE operation allows a client to remove
-- a document or Web page from the server.
--
-- This method does not need to be either safe or idempotent. Operations
-- requested through DELETE can have side effects for which users can be
-- held accountable. When using this method, it may be useful to save a
-- copy of the affected URL in temporary storage.
--
-- If the HTTP DELETE request is incorrectly formatted, doDelete returns an
-- HTTP "Bad Request" message.
not overriding procedure Do_Get
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a GET request.
--
-- Overriding this method to support a GET request also automatically
-- supports an HTTP HEAD request. A HEAD request is a GET request that
-- returns no body in the response, only the request header fields.
--
-- When overriding this method, read the request data, write the response
-- headers, get the response's writer or output stream object, and finally,
-- write the response data. It's best to include content type and encoding.
-- When using a PrintWriter object to return the response, set the content
-- type before accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the
-- response, because in HTTP the headers must be sent before the response
-- body.
--
-- Where possible, set the Content-Length header (with the
-- ServletResponse.setContentLength(int) method), to allow the servlet
-- container to use a persistent connection to return its response to the
-- client, improving performance. The content length is automatically set
-- if the entire response fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has
-- a Transfer-Encoding header), do not set the Content-Length header.
--
-- The GET method should be safe, that is, without any side effects for
-- which users are held responsible. For example, most form queries have no
-- side effects. If a client request is intended to change stored data, the
-- request should use some other HTTP method.
--
-- The GET method should also be idempotent, meaning that it can be safely
-- repeated. Sometimes making a method safe also makes it idempotent. For
-- example, repeating queries is both safe and idempotent, but buying a
-- product online or modifying data is neither safe nor idempotent.
--
-- If the request is incorrectly formatted, doGet returns an HTTP "Bad
-- Request" message.
not overriding procedure Do_Head
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Receives an HTTP HEAD request from the protected service method and
-- handles the request. The client sends a HEAD request when it wants to
-- see only the headers of a response, such as Content-Type or
-- Content-Length. The HTTP HEAD method counts the output bytes in the
-- response to set the Content-Length header accurately.
--
-- If you override this method, you can avoid computing the response body
-- and just set the response headers directly to improve performance. Make
-- sure that the doHead method you write is both safe and idempotent (that
-- is, protects itself from being called multiple times for one HTTP HEAD
-- request).
--
-- If the HTTP HEAD request is incorrectly formatted, doHead returns an
-- HTTP "Bad Request" message.
not overriding procedure Do_Options
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a OPTIONS request. The OPTIONS request determines which HTTP
-- methods the server supports and returns an appropriate header.
not overriding procedure Do_Post
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a POST request. The HTTP POST method allows the client to send
-- data of unlimited length to the Web server a single time and is useful
-- when posting information such as credit card numbers.
--
-- When overriding this method, read the request data, write the response
-- headers, get the response's writer or output stream object, and finally,
-- write the response data. It's best to include content type and encoding.
-- When using a PrintWriter object to return the response, set the content
-- type before accessing the PrintWriter object.
--
-- The servlet container must write the headers before committing the
-- response, because in HTTP the headers must be sent before the response
-- body.
--
-- Where possible, set the Content-Length header (with the
-- ServletResponse.setContentLength(int) method), to allow the servlet
-- container to use a persistent connection to return its response to the
-- client, improving performance. The content length is automatically set
-- if the entire response fits inside the response buffer.
--
-- When using HTTP 1.1 chunked encoding (which means that the response has
-- a Transfer-Encoding header), do not set the Content-Length header.
--
-- This method does not need to be either safe or idempotent. Operations
-- requested through POST can have side effects for which the user can be
-- held accountable, for example, updating stored data or buying items
-- online.
--
-- If the HTTP POST request is incorrectly formatted, doPost returns an
-- HTTP "Bad Request" message.
not overriding procedure Do_Put
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a PUT request. The PUT operation allows a client to place a file
-- on the server and is similar to sending a file by FTP.
--
-- When overriding this method, leave intact any content headers sent with
-- the request (including Content-Length, Content-Type,
-- Content-Transfer-Encoding, Content-Encoding, Content-Base,
-- Content-Language, Content-Location, Content-MD5, and Content-Range). If
-- your method cannot handle a content header, it must issue an error
-- message (HTTP 501 - Not Implemented) and discard the request. For more
-- information on HTTP 1.1, see RFC 2616 .
--
-- This method does not need to be either safe or idempotent. Operations
-- that doPut performs can have side effects for which the user can be held
-- accountable. When using this method, it may be useful to save a copy of
-- the affected URL in temporary storage.
--
-- If the HTTP PUT request is incorrectly formatted, doPut returns an HTTP
-- "Bad Request" message.
not overriding procedure Do_Trace
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class;
Response : in out Servlet.HTTP_Responses.HTTP_Servlet_Response'Class);
-- Called by the server (via the service method) to allow a servlet to
-- handle a TRACE request. A TRACE returns the headers sent with the TRACE
-- request to the client, so that they can be used in debugging. There's no
-- need to override this method.
not overriding function Get_Last_Modified
(Self : in out HTTP_Servlet;
Request : Servlet.HTTP_Requests.HTTP_Servlet_Request'Class)
return League.Calendars.Date_Time;
-- Returns the time the Http_Servlet_Request object was last modified.
-- If the time is unknown, the method returns a special value (the default)
--
-- Servlets that support HTTP GET requests and can quickly determine their
-- last modification time should override this method. This makes browser
-- and proxy caches work more effectively, reducing the load on server and
-- network resources.
overriding procedure Service
(Self : in out HTTP_Servlet;
Request : Servlet.Requests.Servlet_Request'Class;
Response : in out Servlet.Responses.Servlet_Response'Class);
private
type HTTP_Servlet is
abstract new Servlet.Generic_Servlets.Generic_Servlet with record
Format : Matreshka.RFC2616_Dates.Format;
Last_Modified_Header : League.Strings.Universal_String :=
League.Strings.To_Universal_String ("Last-Modified");
If_Modified_Since_Header : League.Strings.Universal_String :=
League.Strings.To_Universal_String ("If-Modified-Since");
Unknown_Time : League.Calendars.Date_Time :=
League.Calendars.ISO_8601.Create
(Year => League.Calendars.ISO_8601.Year_Number'First,
Month => 1,
Day => 1,
Hour => 0,
Minute => 0,
Second => 0,
Nanosecond_100 => 0);
end record;
end Servlet.HTTP_Servlets;
|
NPC_Builder.adb | PRMorgan/5eCharacterCreator | 0 | 3903 | -- This is a personal project that was conceived
-- from a lack of really quick Dungeons and
-- Dragons character creation tools.
-- The only content supported in this tool
-- is that which can be found in the
-- Systems Reference Document (SRD)
-- from Wizards of the Coast.
-- Created by <NAME>
-- Start Date: 8 March 2018
-- Major Updates: 24 April 2018
-- 14 January 2019
-- 7 February 2019
--------------- Support from ---------------
-- <NAME> (Beta Tester/Ideas)
-- <NAME> (Beta Tester/Ideas/Problem Solving)
-- <NAME> (Beta Tester)
--------------------------------------------
With Ada.Text_IO; Use Ada.Text_IO;
With Ada.Integer_Text_IO; Use Ada.Integer_Text_IO;
Procedure NPC_Builder is
------------------------------------------------------
-- The purpose of this program is to allow DMs and --
-- players the ability to create NPCs and PCs, --
-- respectively, without having to crunch numbers. --
-- This program will also output the various --
-- character sheet information in easy-to-read --
-- text files for future reference and saving. --
------------------------------------------------------
Type Class_List is (Barbarian, Bard, Cleric, Druid, Fighter, Monk,
Paladin, Ranger, Rogue, Sorcerer, Warlock, Wizard);
Package Class_IO is new Ada.Text_IO.Enumeration_IO (Class_List);
Use Class_IO;
Type Subclass_List is (Berserker, Lore, Life, Land, Champion, OpenHand,
Devotion, Hunter, Thief, Draconic, Fiend, Evocation);
Package Subclass_IO is new Ada.Text_IO.Enumeration_IO (Subclass_List);
Use Subclass_IO;
Type Race_List is (Dragonborn, Dwarf, Elf, Gnome, HalfElf, Halfling, HalfOrc, Human, Tiefling);
Package Race_IO is new Ada.Text_IO.Enumeration_IO (Race_List);
Use Race_IO;
Type Subrace_List is (Hill, High, Lightfoot, Rock, None,
Calishite, Chondathan, Damaran, Illuskan,
Mulan, Rashemi, Shou, Tethyrian, Turami,
Black, Blue, Bronze, Brass, Copper,
Gold, Green, Red, Silver, White);
Package Subrace_IO is new Ada.Text_IO.Enumeration_IO (Subrace_List);
Use Subrace_IO;
Type Skills_List is (Acrobatics, Animal_Handling, Arcana, Athletics, Deception, History,
Insight, Intimidation, Investigation, Medicine, Nature, Perception,
Performance, Persuasion, Religion, Sleight_Of_Hand, Stealth, Survival);
Package Skills_IO is new Ada.Text_IO.Enumeration_IO (Skills_List);
Use Skills_IO;
Type Ability_Scores_List is (STR, DEX, CON, INT, WIS, CHA, NA);
Package Scores_IO is new Ada.Text_IO.Enumeration_IO (Ability_Scores_List);
Use Scores_IO;
Type Weapons_List is (Battleaxe, Blowgun, Club, Dagger, Dart, Flail, Glaive,
Greatclub, Greatsword, Halberd, Handaxe, HandCrossbow,
HeavyCrossbow, Javelin, Lance, LightCrossbow, LightHammer,
Longbow, Longsword, Mace, Maul, Morningstar, Net, Pike,
Quarterstaff, Rapier, Scimitar, Shortbow, Shortsword,
Sickle, Sling, Spear, Trident, Warhammer, Warpick, Whip);
Package Weapons_IO is new Ada.Text_IO.Enumeration_IO (Weapons_List);
Use Weapons_IO;
Type Weapon_Classification_List is (Simple, Martial);
Package Weapon_Classification_IO is new Ada.Text_IO.Enumeration_IO (Weapon_Classification_List);
Use Weapon_Classification_IO;
Type Proficient_Type is record
base : Integer := 0;
proficient : Boolean := false;
End Record;
Type Skills_Type is record
acrobatics : Proficient_Type;
animalHandling : Proficient_Type;
arcana : Proficient_Type;
athletics : Proficient_Type;
deception : Proficient_Type;
history : Proficient_Type;
insight : Proficient_Type;
intimidation : Proficient_Type;
investigation : Proficient_Type;
medicine : Proficient_Type;
nature : Proficient_Type;
perception : Proficient_Type;
performance : Proficient_Type;
persuasion : Proficient_Type;
religion : Proficient_Type;
sleightOfHand : Proficient_Type;
stealth : Proficient_Type;
survival : Proficient_Type;
End Record;
Type Class_Type is record
--features : Features_Array;
hitDice : Integer;
main : Class_List;
subclass : Subclass_List;
level : Integer;
skill : Skills_Type;
skillName : Skills_List;
proficiency : Integer;
End record;
Type Health_Type is record
current : Integer;
total : Integer;
End record;
Type Name_Type is record
name : String (1..25);
length : Integer;
End record;
Type Race_Type is record
main : Race_List;
subrace : Subrace_List;
size : Character;
speed : Integer;
End record;
Type Weapon_Info is record
classification : Weapon_Classification_List;
damageAbility : Ability_Scores_List;
die : Positive;
name : String (1..14);
nameLength : Positive := 5;
toHit : Integer;
proficient : Boolean;
End record;
Type Weapons_Type is array (Weapons_List) of Weapon_Info;
Type Ability_Score_Type is record
base : Integer;
modifier : Integer;
End record;
Type Stats_Type is record
STR : Ability_Score_Type;
DEX : Ability_Score_Type;
CON : Ability_Score_Type;
INT : Ability_Score_Type;
WIS : Ability_Score_Type;
CHA : Ability_Score_Type;
End record;
Type Combat_Type is record
STRbased : Integer;
DEXbased : Integer;
STRproficient : Integer;
DEXproficient : Integer;
unarmedAttack : Integer;
spellDC : Integer;
spellAttack : Integer;
spellStat : Ability_Scores_List;
attack : Weapons_Type;
End record;
Type Character_Type is record
class : Class_Type;
health : Health_Type;
name : Name_Type;
race : Race_Type;
stat : Stats_Type;
combat : Combat_Type;
End record;
THIRTY_THREE_DASHES : CONSTANT String := "---------------------------------";
TABLE_BORDER : CONSTANT String := "|----|---------------------------------";
--Subprograms
Procedure getUserInput(character : out Character_Type) is
choosingScoreImprovement : Boolean := True;
levelFlag : Boolean := True;
profFlag : Boolean := True;
scoresFlag : Boolean := True;
subraceFlag : Boolean := True;
Begin -- getUserInput
-- Name the character
Put ("Enter the character's name: ");
New_Line;
Put (">>> ");
Get_Line(character.name.name, character.name.length);
New_Line;
-- Select the character's race
Put ("Choose your character's race from the following list:");
New_Line;
Put ("Dragonborn, Dwarf, Elf, Gnome, HalfElf, Halfling, HalfOrc, Human, Tiefling: ");
--------Data Validation Loop--------
validRaceLoop:
Loop
raceInputBlock:
begin
New_Line;
Put (">>> ");
Race_IO.Get (character.race.main);
exit validRaceLoop;
exception
When Ada.Text_IO.DATA_ERROR =>
New_Line;
Put ("Dragonborn, Dwarf, Elf, Gnome, HalfElf, Halfling, HalfOrc, Human, Tiefling?");
Skip_Line;
End raceInputBlock;
End loop validRaceLoop;
--------Data Validation Loop--------
New_Line;
-- Select the character's subrace/nationality/ancestry.
Case character.race.main is
-- If the character is a Human, have them choose their nationality.
When Human => Put ("Choose your character's nationality from the following list:");
While subraceFlag Loop
New_Line;
Put ("Calishite, Chondathan, Damaran, Illuskan, Mulan,");
New_Line;
Put ("Rashemi, Shou, Tethyrian, or Turami");
validHumanLoop: -- Only allow valid human subrace
Loop
humanInputBlock:
begin
New_Line;
Put (">>> ");
Subrace_IO.Get (character.race.subrace);
If character.race.subrace = Calishite Then
subraceFlag := False;
Elsif character.race.subrace = Chondathan Then
subraceFlag := False;
Elsif character.race.subrace = Damaran Then
subraceFlag := False;
Elsif character.race.subrace = Illuskan Then
subraceFlag := False;
Elsif character.race.subrace = Mulan Then
subraceFlag := False;
Elsif character.race.subrace = Rashemi Then
subraceFlag := False;
Elsif character.race.subrace = Shou Then
subraceFlag := False;
Elsif character.race.subrace = Tethyrian Then
subraceFlag := False;
Elsif character.race.subrace = Turami Then
subraceFlag := False;
Else
subraceFlag := True;
End If;
exit validHumanLoop;
exception
When Ada.Text_IO.DATA_ERROR =>
New_Line;
Put ("Calishite, Chondathan, Damaran, Illuskan, Mulan,");
New_Line;
Put ("Rashemi, Shou, Tethyrian, or Turami");
Skip_Line;
End humanInputBlock;
End Loop validHumanLoop;
End Loop;
-- If the character is a Dragonborn, have them choose their Draconic Ancestry.
When Dragonborn => Put ("Choose your dragonborn's ancestry from the following list:");
While subraceFlag Loop
New_Line;
Put ("Black (Acid), Blue (Lightning), Brass (Fire), Bronze (Lightning), Copper (Acid),");
New_Line;
Put ("Gold (Fire), Green (Poison), Red (Fire), Silver (Cold), White (Cold)");
New_Line;
Put("Enter only the color.");
validDragonbornLoop: -- Only allow valid dragonborn subrace
Loop
dragonbornInputBlock:
begin
New_Line;
Put (">>> ");
Subrace_IO.Get (character.race.subrace);
If character.race.subrace = Black Then
subraceFlag := False;
Elsif character.race.subrace = Blue Then
subraceFlag := False;
Elsif character.race.subrace = Brass Then
subraceFlag := False;
Elsif character.race.subrace = Bronze Then
subraceFlag := False;
Elsif character.race.subrace = Copper Then
subraceFlag := False;
Elsif character.race.subrace = Gold Then
subraceFlag := False;
Elsif character.race.subrace = Green Then
subraceFlag := False;
Elsif character.race.subrace = Red Then
subraceFlag := False;
Elsif character.race.subrace = Silver Then
subraceFlag := False;
Elsif character.race.subrace = White Then
subraceFlag := False;
Else
subraceFlag := True;
End If;
exit validDragonbornLoop;
exception
When Ada.Text_IO.DATA_ERROR =>
New_Line;
Put ("Black, Blue, Bronze, Brass, Copper,");
New_Line;
Put ("Gold, Green, Red, Silver, White");
Skip_Line;
End dragonbornInputBlock;
End Loop validDragonbornLoop;
End Loop;
When others => null;
End Case;
New_Line;
Put ("Choose your character's class from the following list:");
New_Line;
Put ("Barbarian, Bard, Cleric, Druid, Fighter, Monk,");
New_Line;
Put ("Paladin, Ranger, Rogue, Sorcerer, Warlock, Wizard");
--------Data Validation Loop--------
validClassLoop:
Loop
classInputBlock:
begin
New_Line;
Put (">>> ");
Class_IO.Get (character.class.main);
Exit validClassLoop;
exception
When Ada.Text_IO.DATA_ERROR =>
New_Line;
Put ("Barbarian, Bard, Cleric, Druid, Fighter, Monk,");
New_Line;
Put ("Paladin, Ranger, Rogue, Sorcerer, Warlock, or Wizard?");
Skip_Line;
End classInputBlock;
End Loop validClassLoop;
--------Data Validation Loop--------
-- Set the character's subclass based on their main class
Case character.class.main is
When Barbarian => character.class.subclass := Berserker;
When Bard => character.class.subclass := Lore;
When Cleric => character.class.subclass := Life;
When Druid => character.class.subclass := Land;
When Fighter => character.class.subclass := Champion;
When Monk => character.class.subclass := OpenHand;
When Paladin => character.class.subclass := Devotion;
When Ranger => character.class.subclass := Hunter;
When Rogue => character.class.subclass := Thief;
When Sorcerer => character.class.subclass := Draconic;
When Warlock => character.class.subclass := Fiend;
When Wizard => character.class.subclass := Evocation;
End Case;
New_Line;
-- Have the user input their character's level.
-- Levels lesser than or equal to 0 are not valid.
-- Levels greater than 20 are not valid.
-- D&D 5th Edition does not have official character support for
-- levels outside of the valid range.
While levelFlag Loop
Put ("Note: Valid level range is 1-20.");
New_Line;
Put ("Enter the character's level: ");
New_Line;
Put (">>> ");
Get (character.class.level);
If character.class.level >= 1 and character.class.level <=20 Then
levelFlag := False;
Else
levelFlag := True;
End If;
Skip_Line;
New_Line;
End Loop;
-- Have the user input their raw ability score rolls.
-- This program calculates racial bonuses for the user.
While scoresFlag Loop
Put ("Note: Valid unmodified score range is 3-18.");
New_Line;
Put ("Please enter your unmodified scores, in the following order, and on one line: ");
New_Line;
Put ("STR, DEX, CON, INT, WIS, and CHA");
New_Line;
Put (">>> ");
Ada.Integer_Text_IO.Get (character.stat.STR.base);
Ada.Integer_Text_IO.Get (character.stat.DEX.base);
Ada.Integer_Text_IO.Get (character.stat.CON.base);
Ada.Integer_Text_IO.Get (character.stat.INT.base);
Ada.Integer_Text_IO.Get (character.stat.WIS.base);
Ada.Integer_Text_IO.Get (character.stat.CHA.base);
If character.stat.STR.base >= 3 and character.stat.STR.base <= 18 and
character.stat.DEX.base >= 3 and character.stat.DEX.base <= 18 and
character.stat.CON.base >= 3 and character.stat.CON.base <= 18 and
character.stat.INT.base >= 3 and character.stat.INT.base <= 18 and
character.stat.WIS.base >= 3 and character.stat.WIS.base <= 18 and
character.stat.CHA.base >= 3 and character.stat.CHA.base <= 18 Then
scoresFlag := False;
Else
scoresFlag := True;
End If;
Skip_Line;
New_Line;
End Loop;
-- Have the user input their character's total health.
-- No support for auto-calculating based on modifiers.
Put ("Please enter your character's total health: ");
New_Line;
Put (">>> ");
Get (character.health.total);
Skip_Line;
End getUserInput;
------------------------------------------------------------
Procedure caseClassInfo (character : in out Character_type) is
numSkillProfs : Integer := 2;
temp : Skills_List;
Begin -- caseClassInfo
-- Assign the character's hit dice based on their class.
Case character.class.main is
When Barbarian => character.class.hitDice := 12;
When Bard => character.class.hitDice := 8;
When Cleric => character.class.hitDice := 8;
When Druid => character.class.hitDice := 8;
When Fighter => character.class.hitDice := 10;
When Monk => character.class.hitDice := 8;
When Paladin => character.class.hitDice := 10;
When Ranger => character.class.hitDice := 10;
When Rogue => character.class.hitDice := 8;
When Sorcerer => character.class.hitDice := 6;
When Warlock => character.class.hitDice := 8;
When Wizard => character.class.hitDice := 6;
End Case;
-- Have the user select their proficiencies.
Case character.class.main is
When Barbarian => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Animal_Handling, Athletics, Intimidation, Nature, Perception");
New_Line;
When Bard => Put ("You can choose any 3 skill proficiencies. Your options are:");
New_Line;
Put ("Acrobatics, Animal_Handling, Arcana, Athletics, Deception, History,");
New_Line;
Put ("Insight, Intimidation, Investigation, Medicine, Nature, Perception,");
New_Line;
Put ("Performance, Persuasion, Religion, Sleight_of_Hand, Stealth, Survival");
New_Line;
numSkillProfs := 3;
When Cleric => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("History, Insight, Medicine, Persuasion, Religion");
New_Line;
When Druid => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Arcana, Animal_Handling, Insight, Medicine, Nature, Perception, Religion, Survival");
New_Line;
When Fighter => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Acrobatics, Animal_Handling, Athletics, History,");
New_Line;
Put ("Insight, Intimidation, Perception, Survival");
New_Line;
When Monk => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Acrobatics, Athletics, History, Insight, Religion, Stealth");
New_Line;
When Paladin => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Athletics, Insight, Intimidation, Medicine, Persuasion, Religion");
New_Line;
When Ranger => Put ("You can choose 3 skill proficiencies from the following list:");
New_Line;
Put ("Animal_Handling, Athletics, Deception, Insight, Intimidation,");
New_Line;
Put ("Investigation, Perception, Persuasion, Sleight_of_Hand, Stealth");
New_Line;
numSkillProfs := 3;
When Rogue => Put ("You can choose 4 skill proficiencies from the following list:");
New_Line;
Put ("Acrobatics, Athletics, Deception, Insight, Intimidation,");
New_Line;
Put ("Investigation, Perception, Persuasion, Sleight_of_Hand, Stealth");
New_Line;
numSkillProfs := 4;
When Sorcerer => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Arcana, Deception, Insight, Intimidation, Persuasion, Religion");
New_Line;
When Warlock => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Arcana, Deception, History, Intimidation, Investigation, Nature, Religion");
New_Line;
When Wizard => Put ("You can choose 2 skill proficiencies from the following list:");
New_Line;
Put ("Arcana, History, Insight, Investigation, Medicine, Religion");
New_Line;
End Case;
-- Bards get 3 proficiencies
-- Ranger get 3 proficiencies
-- Rogues get 4 proficiencies
If character.class.main = Bard Then
numSkillProfs := 3;
Elsif character.class.main = Ranger Then
numSkillProfs := 3;
Elsif character.class.main = Rogue Then
numSkillProfs := 4;
Else
numSkillProfs := 2;
End If;
-- Proficiency selection loop
For i in 1..numSkillProfs Loop
Put (i, 1);
Put (". ");
Skills_IO.Get (character.class.skillName);
temp := character.class.skillName;
Case temp is
When Acrobatics => character.class.skill.acrobatics.proficient := True;
When Animal_Handling => character.class.skill.animalhandling.proficient := True;
When Arcana => character.class.skill.arcana.proficient := True;
When Athletics => character.class.skill.athletics.proficient := True;
When Deception => character.class.skill.deception.proficient := True;
When History => character.class.skill.history.proficient := True;
When Insight => character.class.skill.insight.proficient := True;
When Intimidation => character.class.skill.intimidation.proficient := True;
When Investigation => character.class.skill.investigation.proficient := True;
When Medicine => character.class.skill.medicine.proficient := True;
When Nature => character.class.skill.nature.proficient := True;
When Perception => character.class.skill.perception.proficient := True;
When Performance => character.class.skill.performance.proficient := True;
When Persuasion => character.class.skill.persuasion.proficient := True;
When Religion => character.class.skill.religion.proficient := True;
When Sleight_of_Hand => character.class.skill.sleightOfHand.proficient := True;
When Stealth => character.class.skill.stealth.proficient := True;
When Survival => character.class.skill.survival.proficient := True;
End Case;
End Loop;
Skip_Line;
-- Add character's proficiency to skills they selected
----------
If character.class.skill.acrobatics.proficient Then
character.class.skill.acrobatics.base := character.stat.DEX.modifier + character.class.proficiency;
Else
character.class.skill.acrobatics.base := character.stat.DEX.modifier;
End If;
----------
If character.class.skill.animalHandling.proficient Then
character.class.skill.animalHandling.base := character.stat.WIS.modifier + character.class.proficiency;
Else
character.class.skill.animalHandling.base := character.stat.WIS.modifier;
End If;
----------
If character.class.skill.arcana.proficient Then
character.class.skill.arcana.base := character.stat.INT.modifier + character.class.proficiency;
Else
character.class.skill.arcana.base := character.stat.INT.modifier;
End If;
----------
If character.class.skill.athletics.proficient Then
character.class.skill.athletics.base := character.stat.STR.modifier + character.class.proficiency;
Else
character.class.skill.athletics.base := character.stat.STR.modifier;
End If;
----------
If character.class.skill.deception.proficient Then
character.class.skill.deception.base := character.stat.CHA.modifier + character.class.proficiency;
Else
character.class.skill.deception.base := character.stat.CHA.modifier;
End If;
----------
If character.class.skill.history.proficient Then
character.class.skill.history.base := character.stat.INT.modifier + character.class.proficiency;
Else
character.class.skill.history.base := character.stat.INT.modifier;
End If;
----------
If character.class.skill.insight.proficient Then
character.class.skill.insight.base := character.stat.WIS.modifier + character.class.proficiency;
Else
character.class.skill.insight.base := character.stat.WIS.modifier;
End If;
----------
If character.class.skill.intimidation.proficient Then
character.class.skill.intimidation.base := character.stat.CHA.modifier + character.class.proficiency;
Else
character.class.skill.intimidation.base := character.stat.CHA.modifier;
End If;
----------
If character.class.skill.investigation.proficient Then
character.class.skill.investigation.base := character.stat.INT.modifier + character.class.proficiency;
Else
character.class.skill.investigation.base := character.stat.INT.modifier;
End If;
----------
If character.class.skill.medicine.proficient Then
character.class.skill.medicine.base := character.stat.WIS.modifier + character.class.proficiency;
Else
character.class.skill.medicine.base := character.stat.WIS.modifier;
End If;
----------
If character.class.skill.nature.proficient Then
character.class.skill.nature.base := character.stat.INT.modifier + character.class.proficiency;
Else
character.class.skill.nature.base := character.stat.INT.modifier;
End If;
----------
If character.class.skill.perception.proficient Then
character.class.skill.perception.base := character.stat.WIS.modifier + character.class.proficiency;
Else
character.class.skill.perception.base := character.stat.WIS.modifier;
End If;
----------
If character.class.skill.performance.proficient Then
character.class.skill.performance.base := character.stat.CHA.modifier + character.class.proficiency;
Else
character.class.skill.performance.base := character.stat.CHA.modifier;
End If;
----------
If character.class.skill.persuasion.proficient Then
character.class.skill.persuasion.base := character.stat.CHA.modifier + character.class.proficiency;
Else
character.class.skill.persuasion.base := character.stat.CHA.modifier;
End If;
----------
If character.class.skill.religion.proficient Then
character.class.skill.religion.base := character.stat.INT.modifier + character.class.proficiency;
Else
character.class.skill.religion.base := character.stat.INT.modifier;
End If;
----------
If character.class.skill.sleightOfHand.proficient Then
character.class.skill.sleightOfHand.base := character.stat.DEX.modifier + character.class.proficiency;
Else
character.class.skill.sleightOfHand.base := character.stat.DEX.modifier;
End If;
----------
If character.class.skill.stealth.proficient Then
character.class.skill.stealth.base := character.stat.DEX.modifier + character.class.proficiency;
Else
character.class.skill.stealth.base := character.stat.DEX.modifier;
End If;
----------
If character.class.skill.survival.proficient Then
character.class.skill.survival.base := character.stat.WIS.modifier + character.class.proficiency;
Else
character.class.skill.survival.base := character.stat.WIS.modifier;
End If;
----------
End caseClassInfo;
------------------------------------------------------------
Procedure caseAbilityScores (character : in out Character_Type) is
Begin -- caseAbilityScores
-- Assign modifiers to ability scores
Case character.stat.STR.base is
When 1 => character.stat.STR.modifier := -5;
When 2..3 => character.stat.STR.modifier := -4;
When 4..5 => character.stat.STR.modifier := -3;
When 6..7 => character.stat.STR.modifier := -2;
When 8..9 => character.stat.STR.modifier := -1;
When 10..11 => character.stat.STR.modifier := 0;
When 12..13 => character.stat.STR.modifier := 1;
When 14..15 => character.stat.STR.modifier := 2;
When 16..17 => character.stat.STR.modifier := 3;
When 18..19 => character.stat.STR.modifier := 4;
When 20 => character.stat.STR.modifier := 5;
When others => character.stat.STR.modifier := -99;
End Case;
Case character.stat.DEX.base is
When 1 => character.stat.DEX.modifier := -5;
When 2..3 => character.stat.DEX.modifier := -4;
When 4..5 => character.stat.DEX.modifier := -3;
When 6..7 => character.stat.DEX.modifier := -2;
When 8..9 => character.stat.DEX.modifier := -1;
When 10..11 => character.stat.DEX.modifier := 0;
When 12..13 => character.stat.DEX.modifier := 1;
When 14..15 => character.stat.DEX.modifier := 2;
When 16..17 => character.stat.DEX.modifier := 3;
When 18..19 => character.stat.DEX.modifier := 4;
When 20 => character.stat.DEX.modifier := 5;
When others => character.stat.DEX.modifier := -99;
End Case;
Case character.stat.CON.base is
When 1 => character.stat.CON.modifier := -5;
When 2..3 => character.stat.CON.modifier := -4;
When 4..5 => character.stat.CON.modifier := -3;
When 6..7 => character.stat.CON.modifier := -2;
When 8..9 => character.stat.CON.modifier := -1;
When 10..11 => character.stat.CON.modifier := 0;
When 12..13 => character.stat.CON.modifier := 1;
When 14..15 => character.stat.CON.modifier := 2;
When 16..17 => character.stat.CON.modifier := 3;
When 18..19 => character.stat.CON.modifier := 4;
When 20 => character.stat.CON.modifier := 5;
When others => character.stat.CON.modifier := -99;
End Case;
Case character.stat.INT.base is
When 1 => character.stat.INT.modifier := -5;
When 2..3 => character.stat.INT.modifier := -4;
When 4..5 => character.stat.INT.modifier := -3;
When 6..7 => character.stat.INT.modifier := -2;
When 8..9 => character.stat.INT.modifier := -1;
When 10..11 => character.stat.INT.modifier := 0;
When 12..13 => character.stat.INT.modifier := 1;
When 14..15 => character.stat.INT.modifier := 2;
When 16..17 => character.stat.INT.modifier := 3;
When 18..19 => character.stat.INT.modifier := 4;
When 20 => character.stat.INT.modifier := 5;
When others => character.stat.INT.modifier := -99;
End Case;
Case character.stat.WIS.base is
When 1 => character.stat.WIS.modifier := -5;
When 2..3 => character.stat.WIS.modifier := -4;
When 4..5 => character.stat.WIS.modifier := -3;
When 6..7 => character.stat.WIS.modifier := -2;
When 8..9 => character.stat.WIS.modifier := -1;
When 10..11 => character.stat.WIS.modifier := 0;
When 12..13 => character.stat.WIS.modifier := 1;
When 14..15 => character.stat.WIS.modifier := 2;
When 16..17 => character.stat.WIS.modifier := 3;
When 18..19 => character.stat.WIS.modifier := 4;
When 20 => character.stat.WIS.modifier := 5;
When others => character.stat.WIS.modifier := -99;
End Case;
Case character.stat.CHA.base is
When 1 => character.stat.CHA.modifier := -5;
When 2..3 => character.stat.CHA.modifier := -4;
When 4..5 => character.stat.CHA.modifier := -3;
When 6..7 => character.stat.CHA.modifier := -2;
When 8..9 => character.stat.CHA.modifier := -1;
When 10..11 => character.stat.CHA.modifier := 0;
When 12..13 => character.stat.CHA.modifier := 1;
When 14..15 => character.stat.CHA.modifier := 2;
When 16..17 => character.stat.CHA.modifier := 3;
When 18..19 => character.stat.CHA.modifier := 4;
When 20 => character.stat.CHA.modifier := 5;
When others => character.stat.CHA.modifier := -99;
End Case;
-- Assign the character's proficiency based on their level
Case character.class.level is
When 0..4 => character.class.proficiency := 2;
When 5..8 => character.class.proficiency := 3;
When 9..12 => character.class.proficiency := 4;
When 13..16 => character.class.proficiency := 5;
When 17..20 => character.class.proficiency := 6;
When others => character.class.proficiency := 0;
End Case;
End caseAbilityScores;
------------------------------------------------------------
Procedure caseRaceInfo (character : in out Character_Type) is
Begin --caseRaceInfo
-- Assign speed, size, and ability score
-- increases based on the character's race.
Case character.race.main is
When Dragonborn => character.race.speed := 30;
character.race.size := 'M';
character.stat.STR.base := character.stat.STR.base +2;
character.stat.CHA.base := character.stat.CHA.base +1;
When Dwarf => character.race.speed := 25;
character.race.size := 'M';
character.stat.CON.base := character.stat.CON.base +2;
character.race.subrace := Hill;
When Elf => character.race.speed := 30;
If character.race.subrace = High Then
character.race.speed := 35;
End if;
character.race.size := 'M';
character.stat.DEX.base := character.stat.DEX.base +2;
character.race.subrace := High;
When Gnome => character.race.speed := 25;
character.race.size := 'S';
character.stat.INT.base := character.stat.INT.base +2;
character.race.subrace := Rock;
When Halfling => character.race.speed := 25;
character.race.size := 'S';
character.stat.DEX.base := character.stat.DEX.base +2;
character.race.subrace := Lightfoot;
When Human => character.race.speed := 30;
character.race.size := 'M';
character.stat.STR.base := character.stat.STR.base +1;
character.stat.DEX.base := character.stat.DEX.base +1;
character.stat.CON.base := character.stat.CON.base +1;
character.stat.INT.base := character.stat.INT.base +1;
character.stat.WIS.base := character.stat.WIS.base +1;
character.stat.CHA.base := character.stat.CHA.base +1;
When HalfElf => character.race.speed := 30;
character.race.size := 'M';
character.stat.CHA.base := character.stat.CHA.base +2;
character.race.subrace := None;
When HalfOrc => character.race.speed := 30;
character.race.size := 'M';
character.stat.STR.base := character.stat.STR.base +2;
character.stat.CON.base := character.stat.CON.base +1;
character.race.subrace := None;
When Tiefling => character.race.speed := 30;
character.race.size := 'M';
character.stat.CHA.base := character.stat.CHA.base +2;
character.stat.INT.base := character.stat.INT.base +1;
character.race.subrace := None;
When others => null;
End Case;
-- Assign ability score increases based on the character's subrace
Case character.race.subrace is
When Hill => character.stat.WIS.base := character.stat.WIS.base +1;
When High => character.stat.INT.base := character.stat.INT.base +1;
When Lightfoot => character.stat.CHA.base := character.stat.CHA.base +1;
When Rock => character.stat.CON.base := character.stat.CON.base +1;
When others => null;
End Case;
End caseRaceInfo;
------------------------------------------------------------
Procedure halfElfAbilities (character : in out Character_Type) is
--------------------Identifiers--------------------
-- num_modified : An integer to keep track of
-- how many scores have been changed.
-- stat_temp : A variable that represents which
-- stat is being modified.
---------------------------------------------------
num_modified : Integer := 0;
stat_temp : String(1..3);
Begin -- halfElfAbilities
-- If the character is a Half Elf, the user can assign
-- 2 ability score increases and they see fit.
Put ("You have chosen Half-Elf as your race. One of your racial traits");
New_Line;
Put ("allows you to increase your ability scores.");
New_Line;
Put ("You have 2 points to allocate where you desire. Your score cannot");
New_Line;
Put ("exceed 20. Your current stats are:");
New_Line;
-- Output the character's stats to the screen
-- so the user can see what they already have.
Put (THIRTY_THREE_DASHES);
New_Line;
Set_Col(1);
Put ("STR");
Set_Col(7);
Put ("DEX");
Set_Col(13);
Put ("CON");
Set_Col(19);
Put ("INT");
Set_Col(25);
Put ("WIS");
Set_Col(31);
Put ("CHA");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line;
Set_Col(1+1);
Put (character.stat.STR.base, 1);
Set_Col(7+1);
Put (character.stat.DEX.base, 1);
Set_Col(13+1);
Put (character.stat.CON.base, 1);
Set_Col(19+1);
Put (character.stat.INT.base, 1);
Set_Col(25+1);
Put (character.stat.WIS.base, 1);
Set_Col(31+1);
Put (character.stat.CHA.base, 1);
New_Line;
Set_Col(1);
Put("(");
If character.stat.STR.modifier >= 0 Then
Put("+");
Put(character.stat.STR.modifier, 1);
Else
Put(character.stat.STR.modifier, 1);
End If;
Put(")");
Set_Col(7);
Put("(");
If character.stat.DEX.modifier >= 0 Then
Put("+");
Put(character.stat.DEX.modifier, 1);
Else
Put(character.stat.DEX.modifier, 1);
End If;
Put(")");
Set_Col(13);
Put("(");
If character.stat.CON.modifier >= 0 Then
Put("+");
Put(character.stat.CON.modifier, 1);
Else
Put(character.stat.CON.modifier, 1);
End If;
Put(")");
Set_Col(19);
Put("(");
If character.stat.INT.modifier >= 0 Then
Put("+");
Put(character.stat.INT.modifier, 1);
Else
Put(character.stat.INT.modifier, 1);
End If;
Put(")");
Set_Col(25);
Put("(");
If character.stat.WIS.modifier >= 0 Then
Put("+");
Put(character.stat.WIS.modifier, 1);
Else
Put(character.stat.WIS.modifier, 1);
End If;
Put(")");
Set_Col(31);
Put("(");
If character.stat.CHA.modifier >= 0 Then
Put("+");
Put(character.stat.CHA.modifier, 1);
Else
Put(character.stat.CHA.modifier, 1);
End If;
Put(")");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line(2);
-- Have the user select the stat(s) they would like to increase.
Put ("Enter the 3 letter abbreviation that corresponds to the");
New_Line;
Put ("ability score you would like to increase, one at a time:");
New_Line;
While (num_modified < 2) Loop
Put (">>> ");
Get(stat_temp);
If stat_temp = "STR" and character.stat.STR.base < 20 Then
character.stat.STR.base := character.stat.STR.base + 1;
num_modified := num_modified + 1;
Elsif stat_temp = "DEX" and character.stat.DEX.base < 20 Then
character.stat.DEX.base := character.stat.DEX.base + 1;
num_modified := num_modified + 1;
Elsif stat_temp = "CON" and character.stat.CON.base < 20 Then
character.stat.CON.base := character.stat.CON.base + 1;
num_modified := num_modified + 1;
Elsif stat_temp = "INT" and character.stat.INT.base < 20 Then
character.stat.INT.base := character.stat.INT.base + 1;
num_modified := num_modified + 1;
Elsif stat_temp = "WIS" and character.stat.WIS.base < 20 Then
character.stat.WIS.base := character.stat.WIS.base + 1;
num_modified := num_modified + 1;
Elsif stat_temp = "CHA" and character.stat.CHA.base < 20 Then
character.stat.CHA.base := character.stat.CHA.base + 1;
num_modified := num_modified + 1;
Else
Put ("Invalid selection. Please check you've entered a valid stat.");
End If;
New_Line;
Exit When num_modified = 2;
End Loop;
End halfElfAbilities;
------------------------------------------------------------
Procedure combatReference (character : in out Character_Type) is
spellDCBase : Integer;
Begin --combatReference
-- Physical combat information
-- Compute the attack modifer, based on the weapon's ability score
-- and the character's proficiency with that weapon.
character.combat.STRbased := character.stat.STR.modifier;
character.combat.STRproficient :=
character.stat.STR.modifier + character.class.proficiency;
character.combat.DEXbased := character.stat.DEX.modifier;
character.combat.DEXproficient :=
character.stat.DEX.modifier + character.class.proficiency;
character.combat.unarmedAttack :=
character.stat.STR.modifier + character.class.proficiency;
-- Spellcasting Information
-- Calculate the Spell Save DC, Spell Attack Modifier, and
-- set the Spellcasting Ability Score.
spellDCBase := 8 + character.class.proficiency;
Case character.class.main is
When Bard => character.combat.spellDC :=
spellDCBase + character.stat.CHA.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.CHA.modifier;
character.combat.spellStat := CHA;
When Cleric => character.combat.spellDC :=
spellDCBase + character.stat.WIS.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.WIS.modifier;
character.combat.spellStat := WIS;
When Druid => character.combat.spellDC :=
spellDCBase + character.stat.WIS.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.WIS.modifier;
character.combat.spellStat := WIS;
-- Monks are not spellcasters. In this case,
-- spellDC refers to the Monk's Ki Save DC.
When Monk => character.combat.spellDC :=
spellDCBase + character.stat.WIS.modifier;
character.combat.spellAttack := -99;
character.combat.spellStat := NA;
When Paladin => character.combat.spellDC :=
spellDCBase + character.stat.CHA.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.CHA.modifier;
character.combat.spellStat := CHA;
When Ranger => character.combat.spellDC :=
spellDCBase + character.stat.WIS.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.WIS.modifier;
character.combat.spellStat := WIS;
When Sorcerer => character.combat.spellDC :=
spellDCBase + character.stat.CHA.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.CHA.modifier;
character.combat.spellStat := CHA;
When Warlock => character.combat.spellDC :=
spellDCBase + character.stat.CHA.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.CHA.modifier;
character.combat.spellStat := CHA;
When Wizard => character.combat.spellDC :=
spellDCBase + character.stat.INT.modifier;
character.combat.spellAttack :=
character.class.proficiency + character.stat.INT.modifier;
character.combat.spellStat := INT;
-- Non-Spellcasters get their scores set to an arbitrary
-- value because they don't have a Spell Save DC,
-- Spell Attack Modifier, or a Spellcasting Ability Score.
-- These values are set in the rare event that a
-- non-spellcasting class gets classified as spellcasting.
When others => character.combat.spellDC := -99;
character.combat.spellAttack := -99;
character.combat.spellStat := NA;
End Case;
-- Hard Coded:
-- Damage Die
-- Classification (simple/martial)
-- Damage Ability Score
-- Name string
-- Name length integer
character.combat.attack(Battleaxe).die := 8;
character.combat.attack(Battleaxe).classification := Martial;
character.combat.attack(Battleaxe).damageAbility := STR;
character.combat.attack(Battleaxe).name := "Battleaxe ";
character.combat.attack(Battleaxe).nameLength := 9;
---
character.combat.attack(Blowgun).die := 1;
character.combat.attack(Blowgun).classification := Martial;
character.combat.attack(Blowgun).damageAbility := DEX;
character.combat.attack(Blowgun).name := "Blowgun ";
character.combat.attack(Blowgun).nameLength := 7;
---
character.combat.attack(Club).die := 4;
character.combat.attack(Club).classification := Simple;
character.combat.attack(Club).damageAbility := STR;
character.combat.attack(Club).name := "Club ";
character.combat.attack(Club).nameLength := 4;
---
character.combat.attack(Dagger).die := 4;
character.combat.attack(Dagger).classification := Simple;
character.combat.attack(Dagger).damageAbility := STR;
character.combat.attack(Dagger).name := "Dagger ";
character.combat.attack(Dagger).nameLength := 6;
---
character.combat.attack(Dart).die := 4;
character.combat.attack(Dart).classification := Simple;
character.combat.attack(Dart).damageAbility := DEX;
character.combat.attack(Dart).name := "Dart ";
character.combat.attack(Dart).nameLength := 4;
---
character.combat.attack(Flail).die := 8;
character.combat.attack(Flail).classification := Martial;
character.combat.attack(Flail).damageAbility := STR;
character.combat.attack(Flail).name := "Flail ";
character.combat.attack(Flail).nameLength := 5;
---
character.combat.attack(Glaive).die := 10;
character.combat.attack(Glaive).classification := Martial;
character.combat.attack(Glaive).damageAbility := STR;
character.combat.attack(Glaive).name := "Glaive ";
character.combat.attack(Glaive).nameLength := 6;
---
character.combat.attack(Greatclub).die := 8;
character.combat.attack(Greatclub).classification := Simple;
character.combat.attack(Greatclub).damageAbility := STR;
character.combat.attack(Greatclub).name := "Greatclub ";
character.combat.attack(Greatclub).nameLength := 9;
---
character.combat.attack(Greatsword).die := 6;
character.combat.attack(Greatsword).classification := Martial;
character.combat.attack(Greatsword).damageAbility := STR;
character.combat.attack(Greatsword).name := "Greatsword ";
character.combat.attack(Greatsword).nameLength := 10;
---
character.combat.attack(Halberd).die := 10;
character.combat.attack(Halberd).classification := Martial;
character.combat.attack(Halberd).damageAbility := STR;
character.combat.attack(Halberd).name := "Halberd ";
character.combat.attack(Halberd).nameLength := 7;
---
character.combat.attack(Handaxe).die := 6;
character.combat.attack(Handaxe).classification := Simple;
character.combat.attack(Handaxe).damageAbility := STR;
character.combat.attack(Handaxe).name := "Handaxe ";
character.combat.attack(Handaxe).nameLength := 7;
---
character.combat.attack(HandCrossbow).die := 6;
character.combat.attack(HandCrossbow).classification := Martial;
character.combat.attack(HandCrossbow).damageAbility := DEX;
character.combat.attack(HandCrossbow).name := "Hand Crossbow ";
character.combat.attack(HandCrossbow).nameLength := 13;
---
character.combat.attack(HeavyCrossbow).die := 10;
character.combat.attack(HeavyCrossbow).classification := Martial;
character.combat.attack(HeavyCrossbow).damageAbility := DEX;
character.combat.attack(HeavyCrossbow).name := "Heavy Crossbow";
character.combat.attack(HeavyCrossbow).nameLength := 14;
---
character.combat.attack(Javelin).die := 6;
character.combat.attack(Javelin).classification := Simple;
character.combat.attack(Javelin).damageAbility := STR;
character.combat.attack(Javelin).name := "Javelin ";
character.combat.attack(Javelin).nameLength := 7;
---
character.combat.attack(Lance).die := 12;
character.combat.attack(Lance).classification := Martial;
character.combat.attack(Lance).damageAbility := STR;
character.combat.attack(Lance).name := "Lance ";
character.combat.attack(Lance).nameLength := 5;
---
character.combat.attack(LightCrossbow).die := 8;
character.combat.attack(LightCrossbow).classification := Simple;
character.combat.attack(LightCrossbow).damageAbility := DEX;
character.combat.attack(LightCrossbow).name := "Light Crossbow";
character.combat.attack(LightCrossbow).nameLength := 14;
---
character.combat.attack(LightHammer).die := 4;
character.combat.attack(LightHammer).classification := Simple;
character.combat.attack(LightHammer).damageAbility := STR;
character.combat.attack(LightHammer).name := "<NAME> ";
character.combat.attack(LightHammer).nameLength := 12;
---
character.combat.attack(Longbow).die := 8;
character.combat.attack(Longbow).classification := Martial;
character.combat.attack(Longbow).damageAbility := DEX;
character.combat.attack(Longbow).name := "Longbow ";
character.combat.attack(Longbow).nameLength := 7;
---
character.combat.attack(Longsword).die := 8;
character.combat.attack(Longsword).classification := Martial;
character.combat.attack(Longsword).damageAbility := STR;
character.combat.attack(Longsword).name := "Longsword ";
character.combat.attack(Longsword).nameLength := 9;
---
character.combat.attack(Mace).die := 6;
character.combat.attack(Mace).classification := Simple;
character.combat.attack(Mace).damageAbility := STR;
character.combat.attack(Mace).name := "Mace ";
character.combat.attack(Mace).nameLength := 4;
---
character.combat.attack(Maul).die := 6;
character.combat.attack(Maul).classification := Martial;
character.combat.attack(Maul).damageAbility := STR;
character.combat.attack(Maul).name := "Maul ";
character.combat.attack(Maul).nameLength := 4;
---
character.combat.attack(Morningstar).die := 8;
character.combat.attack(Morningstar).classification := Martial;
character.combat.attack(Morningstar).damageAbility := STR;
character.combat.attack(Morningstar).name := "Morningstar ";
character.combat.attack(Morningstar).nameLength := 11;
---
character.combat.attack(Net).die := 99;
character.combat.attack(Net).classification := Martial;
character.combat.attack(Net).damageAbility := DEX;
character.combat.attack(Net).name := "Net ";
character.combat.attack(Net).nameLength := 3;
---
character.combat.attack(Pike).die := 10;
character.combat.attack(Pike).classification := Martial;
character.combat.attack(Pike).damageAbility := STR;
character.combat.attack(Pike).name := "Pike ";
character.combat.attack(Pike).nameLength := 4;
---
character.combat.attack(Quarterstaff).die := 6;
character.combat.attack(Quarterstaff).classification := Simple;
character.combat.attack(Quarterstaff).damageAbility := STR;
character.combat.attack(Quarterstaff).name := "Quarterstaff ";
character.combat.attack(Quarterstaff).nameLength := 12;
---
character.combat.attack(Rapier).die := 8;
character.combat.attack(Rapier).classification := Martial;
character.combat.attack(Rapier).damageAbility := STR;
character.combat.attack(Rapier).name := "Rapier ";
character.combat.attack(Rapier).nameLength := 6;
---
character.combat.attack(Scimitar).die := 6;
character.combat.attack(Scimitar).classification := Martial;
character.combat.attack(Scimitar).damageAbility := STR;
character.combat.attack(Scimitar).name := "Scimitar ";
character.combat.attack(Scimitar).nameLength := 8;
---
character.combat.attack(Shortbow).die := 6;
character.combat.attack(Shortbow).classification := Simple;
character.combat.attack(Shortbow).damageAbility := DEX;
character.combat.attack(Shortbow).name := "Shortbow ";
character.combat.attack(Shortbow).nameLength := 8;
---
character.combat.attack(Shortsword).die := 6;
character.combat.attack(Shortsword).classification := Martial;
character.combat.attack(Shortsword).damageAbility := STR;
character.combat.attack(Shortsword).name := "Shortsword ";
character.combat.attack(Shortsword).nameLength := 10;
---
character.combat.attack(Sickle).die := 4;
character.combat.attack(Sickle).classification := Simple;
character.combat.attack(Sickle).damageAbility := STR;
character.combat.attack(Sickle).name := "Sickle ";
character.combat.attack(Sickle).nameLength := 6;
---
character.combat.attack(Sling).die := 4;
character.combat.attack(Sling).classification := Simple;
character.combat.attack(Sling).damageAbility := DEX;
character.combat.attack(Sling).name := "Sling ";
character.combat.attack(Sling).nameLength := 5;
---
character.combat.attack(Spear).die := 6;
character.combat.attack(Spear).classification := Simple;
character.combat.attack(Spear).damageAbility := STR;
character.combat.attack(Spear).name := "Spear ";
character.combat.attack(Spear).nameLength := 5;
---
character.combat.attack(Trident).die := 6;
character.combat.attack(Trident).classification := Martial;
character.combat.attack(Trident).damageAbility := STR;
character.combat.attack(Trident).name := "Trident ";
character.combat.attack(Trident).nameLength := 7;
---
character.combat.attack(Warhammer).die := 8;
character.combat.attack(Warhammer).classification := Martial;
character.combat.attack(Warhammer).damageAbility := STR;
character.combat.attack(Warhammer).name := "Warhammer ";
character.combat.attack(Warhammer).nameLength := 9;
---
character.combat.attack(Warpick).die := 8;
character.combat.attack(Warpick).classification := Martial;
character.combat.attack(Warpick).damageAbility := STR;
character.combat.attack(Warpick).name := "Warpick ";
character.combat.attack(Warpick).nameLength := 7;
---
character.combat.attack(Whip).die := 4;
character.combat.attack(Whip).classification := Martial;
character.combat.attack(Whip).damageAbility := STR;
character.combat.attack(Whip).name := "Whip ";
character.combat.attack(Whip).nameLength := 4;
--Assign weapon proficiencies based on class
For i in character.combat.attack'range Loop
---
If character.class.main = Barbarian Then
character.combat.attack(i).proficient := True;
--If character.combat.attack(i).classification = Simple Then
-- character.combat.attack(i).proficient := True;
--Else
-- character.combat.attack(i).proficient := True;
--End If;
---
Elsif character.class.main = Bard Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := True;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(HandCrossbow).proficient := True;
character.combat.attack(Longsword).proficient := True;
character.combat.attack(Rapier).proficient := True;
character.combat.attack(Shortsword).proficient := True;
---
Elsif character.class.main = Cleric Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := True;
Else
character.combat.attack(i).proficient := False;
End If;
---
Elsif character.class.main = Druid Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := False;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(Club).proficient := True;
character.combat.attack(Dagger).proficient := True;
character.combat.attack(Dart).proficient := True;
character.combat.attack(Javelin).proficient := True;
character.combat.attack(Mace).proficient := True;
character.combat.attack(Quarterstaff).proficient := True;
character.combat.attack(Scimitar).proficient := True;
character.combat.attack(Sickle).proficient := True;
character.combat.attack(Sling).proficient := True;
character.combat.attack(Spear).proficient := True;
---
Elsif character.class.main = Fighter Then
character.combat.attack(i).proficient := True;
--If character.combat.attack(i).classification = Simple Then
-- character.combat.attack(i).proficient := True;
--Else
-- character.combat.attack(i).proficient := True;
--End If;
---
Elsif character.class.main = Monk Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := True;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(Shortsword).proficient := True;
---
Elsif character.class.main = Paladin Then
character.combat.attack(i).proficient := True;
--If character.combat.attack(i).classification = Simple Then
-- character.combat.attack(i).proficient := True;
--Else
-- character.combat.attack(i).proficient := True;
--End If;
---
Elsif character.class.main = Ranger Then
character.combat.attack(i).proficient := True;
--If character.combat.attack(i).classification = Simple Then
-- character.combat.attack(i).proficient := True;
--Else
-- character.combat.attack(i).proficient := True;
--End If;
---
Elsif character.class.main = Rogue Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := True;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(HandCrossbow).proficient := True;
character.combat.attack(Longsword).proficient := True;
character.combat.attack(Rapier).proficient := True;
character.combat.attack(Shortsword).proficient := True;
---
Elsif character.class.main = Sorcerer Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := False;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(Dagger).proficient := True;
character.combat.attack(Dart).proficient := True;
character.combat.attack(Sling).proficient := True;
character.combat.attack(Quarterstaff).proficient := True;
character.combat.attack(LightCrossbow).proficient := True;
---
Elsif character.class.main = Warlock Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := True;
Else
character.combat.attack(i).proficient := False;
End If;
---
Elsif character.class.main = Wizard Then
If character.combat.attack(i).classification = Simple Then
character.combat.attack(i).proficient := False;
Else
character.combat.attack(i).proficient := False;
End If;
character.combat.attack(Dagger).proficient := True;
character.combat.attack(Dart).proficient := True;
character.combat.attack(Sling).proficient := True;
character.combat.attack(Quarterstaff).proficient := True;
character.combat.attack(LightCrossbow).proficient := True;
End If;
-- Assign to hit and damage modifiers based on class proficiencies
If character.combat.attack(i).proficient Then
If character.combat.attack(i).damageAbility = STR Then
character.combat.attack(i).toHit := character.combat.STRproficient;
Else
character.combat.attack(i).toHit := character.combat.DEXproficient;
End IF;
Elsif character.combat.attack(i).proficient = False Then
If character.combat.attack(i).damageAbility = STR Then
character.combat.attack(i).toHit := character.combat.STRbased;
Else
character.combat.attack(i).toHit := character.combat.DEXbased;
End IF;
Else
character.combat.attack(i).toHit := -99;
End IF;
End Loop;
End combatReference;
------------------------------------------------------------
Procedure outputToConsole (character : in Character_Type) is
Begin -- outputToConsole
Put (THIRTY_THREE_DASHES);
New_Line;
Put (character.name.name (1..character.name.length)); -- Name
New_Line;
If character.race.size = 'S' Then -- Size
Put ("SMALL ");
Elsif character.race.size = 'M' Then
Put ("MEDIUM ");
Elsif character.race.size = 'L' Then
Put ("LARGE ");
End IF;
Put (character.race.subrace); -- Subrace
Put (" ");
Put (character.race.main); -- Main Race
Put (" ");
Put (character.class.main); -- Main Class
Put (" (");
Put (character.class.level, 1); -- Level
Put (")");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line;
Put ("Total Health: ");
Put (character.health.total, 1); -- Health
New_Line;
Put ("Armor Class: ");
Put (10 + character.stat.DEX.modifier, 2); -- Armor Class
Put (" (Unarmored)");
New_Line;
Put ("Hit Dice: ");
Put (character.class.level, 2); -- (number of) Hit Dice
Put ("d");
Put (character.class.hitDice, 1); -- (size of) Hit Dice
New_Line;
Put ("Speed: ");
Put (character.race.speed, 1); -- Movement Speed
Put (" ft.");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line;
Set_Col(1); -- Stat labels
Put ("STR");
Set_Col(7);
Put ("DEX");
Set_Col(13);
Put ("CON");
Set_Col(19);
Put ("INT");
Set_Col(25);
Put ("WIS");
Set_Col(31);
Put ("CHA");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line;
Set_Col(1+1);
Put (character.stat.STR.base, 1); -- Base Stats
Set_Col(7+1);
Put (character.stat.DEX.base, 1);
Set_Col(13+1);
Put (character.stat.CON.base, 1);
Set_Col(19+1);
Put (character.stat.INT.base, 1);
Set_Col(25+1);
Put (character.stat.WIS.base, 1);
Set_Col(31+1);
Put (character.stat.CHA.base, 1);
New_Line;
Set_Col(1);
Put("(");
If character.stat.STR.modifier >= 0 Then -- Modifiers
Put("+");
Put(character.stat.STR.modifier, 1);
Else
Put(character.stat.STR.modifier, 1);
End If;
Put(")");
Set_Col(7);
Put("(");
If character.stat.DEX.modifier >= 0 Then
Put("+");
Put(character.stat.DEX.modifier, 1);
Else
Put(character.stat.DEX.modifier, 1);
End If;
Put(")");
Set_Col(13);
Put("(");
If character.stat.CON.modifier >= 0 Then
Put("+");
Put(character.stat.CON.modifier, 1);
Else
Put(character.stat.CON.modifier, 1);
End If;
Put(")");
Set_Col(19);
Put("(");
If character.stat.INT.modifier >= 0 Then
Put("+");
Put(character.stat.INT.modifier, 1);
Else
Put(character.stat.INT.modifier, 1);
End If;
Put(")");
Set_Col(25);
Put("(");
If character.stat.WIS.modifier >= 0 Then
Put("+");
Put(character.stat.WIS.modifier, 1);
Else
Put(character.stat.WIS.modifier, 1);
End If;
Put(")");
Set_Col(31);
Put("(");
If character.stat.CHA.modifier >= 0 Then
Put("+");
Put(character.stat.CHA.modifier, 1);
Else
Put(character.stat.CHA.modifier, 1);
End If;
Put(")");
New_Line;
Put (THIRTY_THREE_DASHES);
New_Line;
End outputToConsole;
------------------------------------------------------------
Procedure outputCharacterFile (character : in Character_type) is
File : File_Type;
Begin -- outputCharacterFile
-- Output most relevant info to a character file.
Create (File, name => "Character.txt");
Put (File, character.name.name (1..character.name.length)); -- Name
New_Line (File);
If character.race.size = 'S' Then -- Size
Put (File, "SMALL ");
Elsif character.race.size = 'M' Then
Put (File, "MEDIUM ");
Elsif character.race.size = 'L' Then
Put (File, "LARGE ");
End IF;
Put (File, character.race.subrace); -- Subrace
Put (File, " ");
Put (File, character.race.main); -- Main Race
Put (File, " ");
Put (File, character.class.main); -- Main Class
Put (File, " (");
Put (File, character.class.level, 1); -- Level
Put (File, ")");
New_Line (File);
Put (File, THIRTY_THREE_DASHES);
New_Line (File);
Put (File, "Total Health: ");
Put (File, character.health.total, 1); -- Health
New_Line (File);
Put (File, "Armor Class: ");
Put (File, 10 + character.stat.DEX.modifier, 2); -- Armor Class
Put (File, " (Unarmored)");
New_Line (File);
Put (File, "Hit Dice: ");
Put (File, character.class.level, 2); -- Hit Dice
Put (File, "d");
Put (File, character.class.hitDice, 1);
New_Line (File);
Put (File, "Speed: ");
Put (File, character.race.speed, 1); -- Speed
Put (File, " ft.");
New_Line (File);
Put (File, THIRTY_THREE_DASHES);
New_Line (File);
Set_Col (File, 1); -- Stats
Put (File, "STR");
Set_Col (File, 7);
Put (File, "DEX");
Set_Col (File, 13);
Put (File, "CON");
Set_Col (File, 19);
Put (File, "INT");
Set_Col (File, 25);
Put (File, "WIS");
Set_Col (File, 31);
Put (File, "CHA");
New_Line (File);
Put (File, THIRTY_THREE_DASHES);
New_Line (File);
Set_Col (File, 1+1);
Put (File, character.stat.STR.base, 1);
Set_Col (File, 7+1);
Put (File, character.stat.DEX.base, 1);
Set_Col (File, 13+1);
Put (File, character.stat.CON.base, 1);
Set_Col (File, 19+1);
Put (File, character.stat.INT.base, 1);
Set_Col (File, 25+1);
Put (File, character.stat.WIS.base, 1);
Set_Col (File, 31+1);
Put (File, character.stat.CHA.base, 1);
New_Line (File);
Set_Col (File, 1);
Put (File, "(");
If character.stat.STR.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.STR.modifier, 1);
Else
Put (File, character.stat.STR.modifier, 1);
End If;
Put (File, ")");
Set_Col (File, 7);
Put (File, "(");
If character.stat.DEX.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.DEX.modifier, 1);
Else
Put (File, character.stat.DEX.modifier, 1);
End If;
Put (File, ")");
Set_Col (File, 13);
Put (File, "(");
If character.stat.CON.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.CON.modifier, 1);
Else
Put (File, character.stat.CON.modifier, 1);
End If;
Put (File, ")");
Set_Col (File, 19);
Put (File, "(");
If character.stat.INT.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.INT.modifier, 1);
Else
Put (File, character.stat.INT.modifier, 1);
End If;
Put (File, ")");
Set_Col (File, 25);
Put (File, "(");
If character.stat.WIS.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.WIS.modifier, 1);
Else
Put (File, character.stat.WIS.modifier, 1);
End If;
Put (File, ")");
Set_Col (File, 31);
Put (File, "(");
If character.stat.CHA.modifier >= 0 Then
Put (File, "+");
Put (File, character.stat.CHA.modifier, 1);
Else
Put (File, character.stat.CHA.modifier, 1);
End If;
Put (File, ")");
New_Line (File, 2);
-- A warning to the user.
Put (File, "- I would recommend saving this document and all other");
New_Line (File);
Put (File, " documents produced with your character's name.");
New_Line (File, 2);
Put (File, "- Every time the program is executed, it");
New_Line (File);
Put (File, " will write over any pre-existing characters.");
New_Line(File, 2);
Put (File, "Ex) Gundren_Rockseeker.txt | Gundren_Skills.txt");
New_Line(File);
Put (File, " Gundren_Features.Txt | Gundren_Combat.txt");
Close (File);
End OutputCharacterFile;
----------------------------------------------------
Procedure outputSkillsToFile (character : in Character_type) is
skillsFile : File_Type;
Begin --outputSkillsToFile
-- Create a file to display the character's skills,
-- whether they are proficient or not,
-- and what modifiers they get for those skills.
Create (skillsFile, Name => "Skills.txt");
Put (skillsFile, character.name.name (1..character.name.length));
Put (skillsFile, " Skills File");
New_Line (skillsFile);
Put (skillsFile, THIRTY_THREE_DASHES);
New_Line (skillsFile);
Put (skillsFile, "[");
If character.class.skill.acrobatics.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.acrobatics.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.acrobatics.base, 1);
Put (skillsFile, ") Acrobatics (DEX)");
New_Line (skillsFile);
---------------
Put (skillsFile, "[");
If character.class.skill.animalHandling.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.animalhandling.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.animalhandling.base, 1);
Put (skillsFile, ") Animal Handling (WIS)");
New_Line (skillsFile);
---------------
Put (skillsFile, "[");
If character.class.skill.arcana.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.arcana.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.arcana.base, 1);
Put (skillsFile, ") Arcana (INT)");
New_Line (skillsFile);
----------------
Put (skillsFile, "[");
If character.class.skill.athletics.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.athletics.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.athletics.base, 1);
Put (skillsFile, ") Athletics (STR)");
New_Line (skillsFile);
-------------------
Put (skillsFile, "[");
If character.class.skill.deception.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.deception.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.deception.base, 1);
Put (skillsFile, ") Deception (CHA)");
New_Line (skillsFile);
-----------------
Put (skillsFile, "[");
If character.class.skill.history.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.history.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.history.base, 1);
Put (skillsFile, ") History (INT)");
New_Line (skillsFile);
-----------------
Put (skillsFile, "[");
If character.class.skill.insight.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.insight.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.insight.base, 1);
Put (skillsFile, ") Insight (WIS)");
New_Line (skillsFile);
-------------
Put (skillsFile, "[");
If character.class.skill.intimidation.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.intimidation.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.intimidation.base, 1);
Put (skillsFile, ") Intimidation (CHA)");
New_Line (skillsFile);
-----------------
Put (skillsFile, "[");
If character.class.skill.investigation.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.investigation.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.investigation.base, 1);
Put (skillsFile, ") Investigation (INT)");
New_Line (skillsFile);
----------------------
Put (skillsFile, "[");
If character.class.skill.medicine.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.medicine.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.medicine.base, 1);
Put (skillsFile, ") Medicine (WIS)");
New_Line (skillsFile);
--------------------
Put (skillsFile, "[");
If character.class.skill.nature.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.nature.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.nature.base, 1);
Put (skillsFile, ") Nature (INT)");
New_Line (skillsFile);
---------------------
Put (skillsFile, "[");
If character.class.skill.perception.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.perception.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.perception.base, 1);
Put (skillsFile, ") Perception (WIS)");
New_Line (skillsFile);
-------------------
Put (skillsFile, "[");
If character.class.skill.performance.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.performance.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.performance.base, 1);
Put (skillsFile, ") Performance (CHA)");
New_Line (skillsFile);
--------------------
Put (skillsFile, "[");
If character.class.skill.persuasion.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.persuasion.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.persuasion.base, 1);
Put (skillsFile, ") Persuasion (CHA)");
New_Line (skillsFile);
--------------------
Put (skillsFile, "[");
If character.class.skill.religion.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.religion.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.religion.base, 1);
Put (skillsFile, ") Religion (INT)");
New_Line (skillsFile);
---------------------
Put (skillsFile, "[");
If character.class.skill.sleightOfHand.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.sleightOfHand.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.sleightOfHand.base, 1);
Put (skillsFile, ") Sleight of Hand (DEX)");
New_Line (skillsFile);
--------------------
Put (skillsFile, "[");
If character.class.skill.stealth.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.stealth.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.stealth.base, 1);
Put (skillsFile, ") Stealth (DEX)");
New_Line (skillsFile);
---------------------
Put (skillsFile, "[");
If character.class.skill.survival.proficient Then
Put (skillsFile, "x] ");
Else
Put (skillsFile, " ] ");
End If;
Put (skillsFile, "(");
If character.class.skill.survival.base >= 0 Then
Put (skillsFile, "+");
End If;
Put (skillsFile, character.class.skill.survival.base, 1);
Put (skillsFile, ") Survival (WIS)");
New_Line (skillsFile);
Close (skillsFile);
End outputSkillsToFile;
----------------------------------------------------
Procedure outputCombatReference (character : in Character_Type) is
combatFile : File_type;
Begin -- outputCombatReference
-- Create a file that serves as a combat reference.
-- This file shows
-- A] attack roll modifier
-- B] damage modifier
-- for each weapon in the Player's Handbook as well as
-- the base modifiers for weapons in general.
-- This file also shows
-- A] spell save DC
-- B] spell attack modifier
-- C] spellcasting ability score
Create (combatFile, name => "CombatReference.txt");
Put (combatFile, character.name.name (1..character.name.length));
Put (combatFile, " Combat File");
New_Line (combatFile);
Put (combatFile, THIRTY_THREE_DASHES);
New_Line (combatFile, 2);
-----
Put (combatFile, "----- Melee/Ranged -----");
New_Line (combatFile);
Put (combatFile, "STR-Based Weapon Attack (Not Proficient)");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "To hit: ");
If character.combat.STRbased >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.STRbased, 1);
New_Line (combatFile);
-----
Put (combatFile, "STR-Based Weapon Attack (Proficient)");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "To hit: ");
If character.combat.STRproficient >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.STRproficient, 1);
New_Line (combatFile, 2);
-----
Put (combatFile, "DEX-Based Weapon Attack (Not Proficient)");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "To hit: ");
If character.combat.DEXbased >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.DEXbased, 1);
New_Line (combatFile);
-----
Put (combatFile, "DEX-Based Weapon Attack (Proficient)");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "To hit: ");
If character.combat.DEXproficient >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.DEXproficient, 1);
New_Line (combatFile, 2);
-----
Put (combatFile, "Unarmed Strike");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "To hit: ");
If character.combat.unarmedAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.unarmedAttack, 1);
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "Damage: 1");
If character.combat.unarmedAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.STRbased, 1);
Put (combatFile, " Bludgeoning");
New_Line (combatFile, 2);
-- Output the character's Spell Save DC,
-- Spell Attack Modifier, and Spellcasting Ability
-- to CombatReference.txt.
-- Non-Spellcasters don't output aything.
-- Monks output Ki.
-- The spellDC and such is computed with combatReference()
Case character.class.main is
When Bard =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Cleric =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Druid =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Monk =>
-- Monks aren't spellcasters, so I'm using the spellcasting
-- section to output their Ki Save DC. It's not a
-- perfect system but it will work for us.
Put (combatFile, "---------- Ki ----------");
New_Line (combatFile);
Put (combatFile, "Ki Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile, 2);
When Paladin =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Ranger =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Sorcerer =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Warlock =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When Wizard =>
Put (combatFile, "----- SpellCasting -----");
New_Line (combatFile);
Put (combatFile, "Spell Save DC: ");
Put (combatFile, character.combat.spellDC, 1);
New_Line (combatFile);
Put (combatFile, "Spell Attack Modifier: ");
If character.combat.spellAttack >= 0 Then
Put (combatFile, "+");
End If;
Put (combatFile, character.combat.spellAttack, 1);
New_Line (combatFile);
Put (combatFile, "Spellcasting Ability: ");
Put (combatFile, character.combat.spellStat);
New_Line (combatFile, 2);
When others => null;
End Case;
Put (combatFile, "----- Weapon Attacks -----");
New_Line (combatFile);
For i in character.combat.attack'range Loop
Put (combatFile, character.combat.attack(i).name (1..character.combat.attack(i).nameLength));
If character.combat.attack(i).damageAbility = STR Then
If character.combat.attack(i).proficient Then
If character.combat.attack(i).name = "Greatsword " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "2d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRproficient, 1);
Put (combatFile, " damage");
Elsif character.combat.attack(i).name = "Maul " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "2d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRproficient, 1);
Put (combatFile, " damage");
Else
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "1d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRproficient, 1);
Put (combatFile, " damage");
End IF;
Else
If character.combat.attack(i).name = "Greatsword " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "2d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRbased, 1);
Put (combatFile, " damage");
Elsif character.combat.attack(i).name = "Maul " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "2d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRbased, 1);
Put (combatFile, " damage");
Else
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "1d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.STRbased, 1);
Put (combatFile, " damage");
End If;
End If;
Elsif character.combat.attack(i).damageAbility = DEX Then
If character.combat.attack(i).proficient Then
If character.combat.attack(i).name = "Net " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "DC 10 escape");
Else
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "1d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.DEXproficient, 1);
Put (combatFile, " damage");
End If;
Else
IF character.combat.attack(i).name = "Net " Then
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "DC 10 escape");
Else
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "+");
Put (combatFile, character.combat.attack(i).toHit, 1);
Put (combatFile, " to hit");
New_Line (combatFile);
Set_Col (combatFile, 4);
Put (combatFile, "1d");
Put (combatFile, character.combat.attack(i).die, 1);
Put (combatFile, " + ");
Put (combatFile, character.combat.DEXbased, 1);
Put (combatFile, " damage");
End IF;
End If;
End If;
New_Line (combatFile);
End Loop;
close(combatFile);
End outputCombatReference;
----------------------------------------------------
Procedure outputFeatures (character : In Character_Type) is
featuresFile : File_Type;
Procedure printDraconicAncestry is
-- A procedure that will print the Draconic Ancestry
-- table found on page 34 of the Player's Handbook.
Begin
Set_Col(featuresFile, 1);
Put(featuresFile, "Dragon");
Set_Col(featuresFile, 12);
Put(featuresFile, "Damage Type");
Set_Col(featuresFile, 25);
Put(featuresFile, "Breath Weapon");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Black");
Set_Col(featuresFile, 12);
Put(featuresFile, "Acid");
Set_Col(featuresFile, 25);
Put(featuresFile, "5 by 30 ft. line (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Blue");
Set_Col(featuresFile, 12);
Put(featuresFile, "Lightning");
Set_Col(featuresFile, 25);
Put(featuresFile, "5 by 30 ft. line (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Brass");
Set_Col(featuresFile, 12);
Put(featuresFile, "Fire");
Set_Col(featuresFile, 25);
Put(featuresFile, "5 by 30 ft. line (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Bronze");
Set_Col(featuresFile, 12);
Put(featuresFile, "Lightning");
Set_Col(featuresFile, 25);
Put(featuresFile, "5 by 30 ft. line (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Copper");
Set_Col(featuresFile, 12);
Put(featuresFile, "Acid");
Set_Col(featuresFile, 25);
Put(featuresFile, "5 by 30 ft. line (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Gold");
Set_Col(featuresFile, 12);
Put(featuresFile, "Fire");
Set_Col(featuresFile, 25);
Put(featuresFile, "15 ft. cone (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Green");
Set_Col(featuresFile, 12);
Put(featuresFile, "Poison");
Set_Col(featuresFile, 25);
Put(featuresFile, "15 ft. cone (Con. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Red");
Set_Col(featuresFile, 12);
Put(featuresFile, "Fire");
Set_Col(featuresFile, 25);
Put(featuresFile, "15 ft. cone (Dex. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "Silver");
Set_Col(featuresFile, 12);
Put(featuresFile, "Cold");
Set_Col(featuresFile, 25);
Put(featuresFile, "15 ft. cone (Con. save)");
New_Line(featuresFile);
---
Set_Col(featuresFile, 1);
Put(featuresFile, "White");
Set_Col(featuresFile, 12);
Put(featuresFile, "Cold");
Set_Col(featuresFile, 25);
Put(featuresFile, "15 ft. cone (Con. save)");
New_Line(featuresFile);
End printDraconicAncestry;
Begin
create(File => featuresFile, name => "Features.txt");
Put (featuresFile, character.name.name (1..character.name.length));
Put (featuresFile, " Features File");
New_Line (featuresFile);
Put (featuresFile, THIRTY_THREE_DASHES);
New_Line (featuresFile, 2);
Put (featuresFile, "Racial Features:");
New_Line(featuresFile);
Put (featuresFile, "----------------");
New_Line(featuresFile);
-- Print out features based on race and subrace.
Case character.race.main is
When Dragonborn => Put(featuresFile, "Draconic Ancestry: You have Draconic ancestry. Choose one type of dragon from the Draconic Ancestry table. Your breath weapon and ");
Put(featuresFile, "damage Resistance are determined by the dragon type, as shown in the table.");
New_Line(featuresFile);
printDraconicAncestry; -- Calls a nested function that prints the table from the PLayer's Handbook.
New_Line(featuresFile);
Put(featuresFile, "Breath Weapon: You can use your action to exhale destructive energy. Your Draconic ancestry determines the size, shape, and damage type of the exhalation. ");
Put(featuresFile, "When you use your breath weapon, each creature in the area of the exhalation must make a saving throw, the type of which is determined by your Draconic ancestry. ");
Put(featuresFile, "The DC for this saving throw equals 8 + your Constitution modifier + your Proficiency Bonus. A creature takes 2d6 damage on a failed save, ");
Put(featuresFile, "and half as much damage on a successful one. The damage increases to 3d6 at 6th level, 4d6 at 11th level, and 5d6 at 16th level. ");
Put(featuresFile, "After you use your breath weapon, you can’t use it again until you complete a short or Long Rest.");
New_Line(featuresFile);
Put(featuresFile, "Damage Resistance: You have Resistance to the damage type associated with your Draconic ancestry.");
When Dwarf => Put(featuresFile, "Darkvision: Accustomed to life underground, you have superior vision in dark and dim Conditions. You can see in dim light ");
Put(featuresFile, "within 60 feet of you as if it were bright light, and in Darkness as if it were dim light. You can't discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Dwarven Resilience: You have advantage on Saving Throws against poison, and you have Resistance against poison damage.");
New_Line(featuresFile);
Put(featuresFile, "Stonecunning: Whenever you make an Intelligence (History) check related to the Origin of stonework, you are considered proficient ");
Put(featuresFile, "in the History skill and add double your proficiency bonus to the check, instead of your normal proficiency bonus.");
New_Line(featuresFile);
Put(featuresFile, "Dwarven Toughness: Your hit point maximum increases by 1, and it increases by 1 every time you gain a level.");
When Elf => Put(featuresFile, "Darkvision: Accustomed to life underground, you have superior vision in dark and dim Conditions. You can see in dim light within 60 feet ");
Put(featuresFile, "of you as if it were bright light, and in Darkness as if it were dim light. You can't discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Fey Ancestry: You have advantage on Saving Throws against being Charmed, and magic can't put you to sleep.");
New_Line(featuresFile);
Put(featuresFile, "Trance: Elves don't need to sleep. Instead, they meditate deeply, remaining semiconscious, for 4 hours a day. (The Common word for such ");
Put(featuresFile, "meditation is 'trance.') While meditating, you can dream after a fashion; such dreams are actually mental exercises that have become ");
Put(featuresFile, "reflexive through years of practice. After Resting in this way, you gain the same benefit that a human does from 8 hours of sleep.");
New_Line(featuresFile);
Put(featuresFile, "Cantrip: You know one cantrip of your choice from the Wizard spell list. Intelligence is your Spellcasting ability for it.");
New_Line(featuresFile);
Put(featuresFile, "Extra Language: You can speak, read, and write one extra language of your choice.");
When Gnome => Put(featuresFile, "Darkvision: Accustomed to life underground, you have superior vision in dark and dim Conditions. You can see in dim light ");
Put(featuresFile, "within 60 feet of you as if it were bright light, and in Darkness as if it were dim light. You can't discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Gnome Cunning: You have advantage on all Intelligence, Wisdom, and Charisma Saving Throws against magic.");
New_Line(featuresFile);
Put(featuresFile, "Artificer’s Lore: Whenever you make an Intelligence (History) check related to Magic Items, alchemical Objects, or technological devices, ");
Put(featuresFile, "you can add twice your Proficiency Bonus, instead of any Proficiency Bonus you normally apply.");
New_Line(featuresFile);
Put(featuresFile, "Tinker: You have proficiency with artisan’s tools (tinker’s tools). Using those tools, you can spend 1 hour and 10 gp worth of materials to construct a ");
Put(featuresFile, "Tiny clockwork device (AC 5, 1 hp). The device ceases to function after 24 hours (unless you spend 1 hour repairing it to keep the device functioning), ");
Put(featuresFile, "or when you use your action to dismantle it; at that time, you can reclaim the materials used to create it. You can have up to three such devices active at a time. ");
Put(featuresFile, "When you create a device, choose one of the following options:");
New_Line(featuresFile);
Put(featuresFile, " Clockwork Toy: This toy is a clockwork animal, monster, or person, such as a frog, mouse, bird, dragon, or Soldier. When placed on the ground, ");
Put(featuresFile, "the toy moves 5 feet across the ground on each of your turns in a random direction. It makes noises as appropriate to the creature it represents.");
New_Line(featuresFile);
Put(featuresFile, " Fire Starter: The device produces a miniature flame, which you can use to light a Candle, torch, or campfire. Using the device requires your action.");
New_Line(featuresFile);
Put(featuresFile, " Music Box: When opened, this music box plays a single song at a moderate volume. The box stops playing when it reaches the song’s end or when it is closed.");
When HalfElf => Put(featuresFile, "Darkvision: Thanks to your elf blood, you have superior vision in dark and dim Conditions. You can see in dim light within 60 feet of you as if it were ");
Put(featuresFile, "bright light, and in Darkness as if it were dim light. You can’t discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Fey Ancestry: You have advantage on Saving Throws against being Charmed, and magic can’t put you to sleep.");
New_Line(featuresFile);
Put(featuresFile, "Skill Versatility: You gain proficiency in two Skills of your choice.");
When Halfling => Put(featuresFile, "Lucky: When you roll a 1 on The D20 for an Attack roll, ability check, or saving throw, you can reroll the die and must use the new roll.");
New_Line(featuresFile);
Put(featuresFile, "Brave: You have advantage on Saving Throws against being Frightened.");
New_Line(featuresFile);
Put(featuresFile, "Halfling Nimbleness: You can move through the space of any creature that is of a size larger than yours.");
New_Line(featuresFile);
Put(featuresFile, "Naturally Stealthy: You can attempt to hide even when you are obscured only by a creature that is at least one size larger than you.");
When HalfOrc => Put(featuresFile, "Darkvision: Thanks to your orc blood, you have superior vision in dark and dim Conditions. You can see in dim light within 60 feet of ");
Put(featuresFile, "you as if it were bright light, and in Darkness as if it were dim light. You can’t discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Menacing: You gain proficiency in the Intimidation skill.");
New_Line(featuresFile);
Put(featuresFile, "Relentless Endurance: When you are reduced to 0 Hit Points but not killed outright, you can drop to 1 hit point instead. ");
Put(featuresFile, "You can’t use this feature again until you finish a Long Rest.");
New_Line(featuresFile);
Put(featuresFile, "Savage Attacks: When you score a critical hit with a melee weapon Attack, you can roll one of the weapon’s damage dice one ");
Put(featuresFile, "additional time and add it to the extra damage of the critical hit.");
When Tiefling => Put(featuresFile, "Darkvision: Thanks to your Infernal heritage, you have superior vision in dark and dim Conditions. You can see in dim ");
Put(featuresFile, "light within 60 feet of you as if it were bright light, and in Darkness as if it were dim light. You can’t discern color in Darkness, only shades of gray.");
New_Line(featuresFile);
Put(featuresFile, "Hellish Resistance: You have Resistance to fire damage.");
New_Line(featuresFile);
Put(featuresFile, "Infernal Legacy. You know the Thaumaturgy cantrip. When you reach 3rd level, you can cast the Hellish Rebuke spell ");
Put(featuresFile, "as a 2nd-level spell once with this trait and regain the ability to do so when you finish a Long Rest. When you reach 5th level, ");
Put(featuresFile, "you can cast the Darkness spell once with this trait and regain the ability to do so when you finish a Long Rest. Charisma is your Spellcasting ability for these Spells.");
When Others => null;
End Case;
New_Line(featuresFile, 2);
Put(featuresFile, "Class Features:");
New_Line(featuresFile);
Put(featuresFile, "---------------");
New_Line(featuresFile);
-- Print out features based on class, subclass, and level
Case character.class.main is
When Barbarian =>
If character.class.subclass = Berserker Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - PATH OF THE ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Rage");
New_Line(featuresFile);
Put (featuresFile, "| | Unarmored Defense");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Reckless Attack");
New_Line(featuresFile);
Put (featuresFile, "| | Danger Sense");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Primal Path");
New_Line(featuresFile);
Put (featuresFile, "| | Frenzy");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Extra Attack");
New_Line(featuresFile);
Put (featuresFile, "| | Fast Movement");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Mindless Rage");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | Feral Instinct");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | Brutal Critical (+1 die)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Intimidating Presense");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | Relentless");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | Brutal Critical (+2 dice)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Retaliation");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Persistent Rage");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | Brutal Critical (+3 dice)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Indomitable Might");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Primal Champion");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Bard =>
If character.class.subclass = Lore Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - COLLEGE OF ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Spellcasting");
New_Line(featuresFile);
Put (featuresFile, "| | Bardic Inspiration (d6)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Jack of all Trades");
New_Line(featuresFile);
Put (featuresFile, "| | Song of Rest (1d6)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Bard College");
New_Line(featuresFile);
Put (featuresFile, "| | Expertise");
New_Line(featuresFile);
Put (featuresFile, "| | Bonus Proficiencies (+3)");
New_Line(featuresFile);
Put (featuresFile, "| | Cutting Words");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Bardic Inspiration (d8)");
New_Line(featuresFile);
Put (featuresFile, "| | Font of Inspiration");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Countercharm");
New_Line(featuresFile);
Put (featuresFile, "| | Additional Magical Secrets (+2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | Song of Rest (1d8)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Bardic Inspiration (d10)");
New_Line(featuresFile);
Put (featuresFile, "| | Expertise");
New_Line(featuresFile);
Put (featuresFile, "| | Magical Secrets (+2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | Song of Rest (1d10)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Magical Secrets (+2)");
New_Line(featuresFile);
Put (featuresFile, "| | Peerless Skill");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Bardic Inspiration (d12)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | Song of Rest (1d12)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Magical Secrets (+2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Superior Inspiration");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Cleric =>
If character.class.subclass = life Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - ");
Put (featuresFile, character.class.subclass);
Put (featuresFile, " DOMAIN");
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line (featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
-- print out 1st lev class features
Ada.Text_IO.Put(featuresFile, "| 1 | Spellcasting");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Divine Domain");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Bonus Proficiency");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Disciple of Life");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
-- print out 1st and 2nd lev class features
Ada.Text_IO.Put(featuresFile, "| 2 | Channel Divinity (1/rest)");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Channel Divinity: Preserve Life");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
-- print out 1st, 2nd, and 3rd lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 3 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
-- print out 1st thru 4th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
-- print out 1st thru 5th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 5 | Destroy Undead (CR < 1/2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
-- print out 1st thru 6th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 6 | Channel Divinity (2/rest)");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Blessed Healer");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
-- print out 1st thru 7th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 7 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
-- print out 1st thru 8th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Destroy Undead (CR < 1)");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Divine Strike");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
-- print out 1st thru 9th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
-- print out 1st thru 10th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 10 | Divine Intervention");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
-- print out 1st thru 11th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 11 | Destroy Undead (CR < 2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
-- print out 1st thru 12th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
-- print out 1st thru 13th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
-- print out 1st thru 14th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 14 | Destroy Undead (CR < 3)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
-- print out 1st thru 15th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 15 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
-- print out 1st thru 16th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
-- print out 1st thru 17th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 17 | Destroy Undead (CR < 4)");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Supreme Healing");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
-- print out 1st thru 18th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 18 | Channel Divinity (3/rest)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
-- print out 1st thru 19th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
-- print out 1st thru 20th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 20 | Divine Intervention Improvement");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Druid =>
If character.class.subclass = Land Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - CIRCLE OF THE ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Druidic");
New_Line(featuresFile);
Put (featuresFile, "| | Spellcasting");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Wild Shape");
New_Line(featuresFile);
Put (featuresFile, "| | Druid Circle");
New_Line(featuresFile);
Put (featuresFile, "| | Bonus Cantrip");
New_Line(featuresFile);
Put (featuresFile, "| | Natural Recovery");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Circle Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Wild Shape Improvement");
New_Line(featuresFile);
Put (featuresFile, "| | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Circle Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Land's Stride");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | Circle Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Wild Shape Improvement");
New_Line(featuresFile);
Put (featuresFile, "| | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | Circle Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Nature's Ward");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Nature's Sanctuary");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Timeless Body");
New_Line(featuresFile);
Put (featuresFile, "| | Beast Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Archdruid");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Fighter =>
If character.class.subclass = champion Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - ");
Put (featuresFile, character.class.subclass);
Put (featuresFile, " ARCHETYPE");
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line (featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
-- print out 1st lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 1 | Fighting Style");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Second Wind");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
-- print out 1st and 2nd lev class features
Ada.Text_IO.Put(featuresFile, "| 2 | Action Surge (1 Use)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
-- print out 1st, 2nd, and 3rd lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 3 | Martial Archetype");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Improved Critical");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
-- print out 1st thru 4th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
-- print out 1st thru 5th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 5 | Extra Attack (1)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
-- print out 1st thru 6th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 6 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
-- print out 1st thru 7th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 7 | Remarkable Athlete");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
-- print out 1st thru 8th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
-- print out 1st thru 9th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 9 | Indomitable (1 Use)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
-- print out 1st thru 10th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 10 | Additional Fighting Style");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
-- print out 1st thru 11th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 11 | Extra Attack (2)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
-- print out 1st thru 12th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
-- print out 1st thru 13th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 13 | Indomitable (2 Uses)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
-- print out 1st thru 14th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 14 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
-- print out 1st thru 15th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 15 | Superior Critical");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
-- print out 1st thru 16th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
-- print out 1st thru 17th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 17 | Action Surge (2 Uses)");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Indomitable (3 Uses)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
-- print out 1st thru 18th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 18 | Survivor");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
-- print out 1st thru 19th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
-- print out 1st thru 20th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 20 | Extra Attack (3)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Monk =>
If character.class.subclass = OpenHand Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - WAY OF THE OPEN HAND");
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Unarmored Defense");
New_Line(featuresFile);
Put (featuresFile, "| | Martial Arts");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Ki");
New_Line(featuresFile);
Put (featuresFile, "| | Unarmored Movement");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Monastic Tradition");
New_Line(featuresFile);
Put (featuresFile, "| | Deflect Missiles");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, "| | Slow Fall");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Extra Attack");
New_Line(featuresFile);
Put (featuresFile, "| | Stunning Strike");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Ki-Empowered Strikes");
New_Line(featuresFile);
Put (featuresFile, "| | Wholeness of Body");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | Evasion");
New_Line(featuresFile);
Put (featuresFile, "| | Stillness of Mind");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | Unarmored Movement Improvement");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Purity of Body");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | Tranquility");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | Tongue of the Sun and Moon");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Diamond Soul");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Timeless Body");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | Quivering Palm");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Empty Body");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Perfect Self");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Paladin =>
If character.class.subclass = Devotion Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - OATH OF ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Divine Sense");
New_Line(featuresFile);
Put (featuresFile, "| | Lay on Hands");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Fighting Style");
New_Line(featuresFile);
Put (featuresFile, "| | Spellcasting");
New_Line(featuresFile);
Put (featuresFile, "| | Divine Smite");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Divine Helath");
New_Line(featuresFile);
Put (featuresFile, "| | Sacred Oath");
New_Line(featuresFile);
Put (featuresFile, "| | Oath Spells");
New_Line(featuresFile);
Put (featuresFile, "| | Channel Divinity");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Extra Attack");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Aura of Protection (10 ft)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | Aura of Devotion (10 ft)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Aura of Courage (10 ft)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | Improved Divine Smite");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Cleansing Touch");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Purity of Spirit");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Aura Improvements (30 ft)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Holy Nimbus");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Ranger =>
If character.class.subclass = Hunter Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Favored Enemy");
New_Line(featuresFile);
Put (featuresFile, "| | Natural Explorer");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Fighting Style");
New_Line(featuresFile);
Put (featuresFile, "| | Spellcasting");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Ranger Archetype");
New_Line(featuresFile);
Put (featuresFile, "| | Primeval Awareness");
New_Line(featuresFile);
Put (featuresFile, "| | Hunter's Prey");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | Extra Attack");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Favored Enemy Improvement");
New_Line(featuresFile);
Put (featuresFile, "| | Natural Explorer Improvement");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | Defensive Tactics");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, "| | Land's Stride");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Natural explorer Improvement");
New_Line(featuresFile);
Put (featuresFile, "| | Hide in Plain Sight");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | Multiattack");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Favored Enemy Improvement");
New_Line(featuresFile);
Put (featuresFile, "| | Vanish");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Superior Hunter's Defense");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Feral Senses");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Foe Slayer");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Rogue =>
If character.class.subclass = thief Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - ");
Put (featuresFile, character.class.subclass);
Put (featuresFile, " ARCHETYPE");
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line (featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
-- print out 1st lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 1 | Expertise");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Sneak Attack");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Thieves' Cant");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
-- print out 1st and 2nd lev class features
Ada.Text_IO.Put(featuresFile, "| 2 | Cunning Action");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
-- print out 1st, 2nd, and 3rd lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 3 | Roguish Archetype");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Fast Hands");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Second-Story Work");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
-- print out 1st thru 4th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
-- print out 1st thru 5th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 5 | Uncanny Dodge");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
-- print out 1st thru 6th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 6 | Expertise");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
-- print out 1st thru 7th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 7 | Evasion");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
-- print out 1st thru 8th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
-- print out 1st thru 9th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 9 | Supreme Sneak");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
-- print out 1st thru 10th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 10 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
-- print out 1st thru 11th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 11 | Reliable Talent");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
-- print out 1st thru 12th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
-- print out 1st thru 13th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 13 | Use Magic Device");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
-- print out 1st thru 14th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 14 | Blindsense");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
-- print out 1st thru 15th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 15 | Slippery Mind");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
-- print out 1st thru 16th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
-- print out 1st thru 17th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 17 | Thief's Reflexes");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
-- print out 1st thru 18th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 18 | Elusive");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
-- print out 1st thru 19th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
-- print out 1st thru 20th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 20 | Stroke of Luck");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Sorcerer =>
If character.class.subclass = Draconic Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - ");
Put (featuresFile, character.class.subclass);
Put (featuresFile, " BLOODLINES");
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Spellcasting");
New_Line(featuresFile);
Put (featuresFile, "| | Sorcerous Origins");
New_Line(featuresFile);
Put (featuresFile, "| | Dragon Ancestor");
New_Line(featuresFile);
Put (featuresFile, "| | Draconic Resilience");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Font of Magic");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Metamagic");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Elemental affinity");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Metamagic");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Dragon Wings");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | Metamagic");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | Draconic Presence");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Sorcerous Restoration");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Warlock =>
If character.class.subclass = Fiend Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - PACT OF THE ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line(featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
Put (featuresFile, "| 1 | Otherworldly Patron");
New_Line(featuresFile);
Put (featuresFile, "| | Pact magic");
New_Line(featuresFile);
Put (featuresFile, "| | Dark One's Own Blessing");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
Put (featuresFile, "| 2 | Eldritch Invocations");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
Put (featuresFile, "| 3 | Pact Boon");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
Put (featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
Put (featuresFile, "| 5 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
Put (featuresFile, "| 6 | Dark One's Own Luck");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
Put (featuresFile, "| 7 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
Put (featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
Put (featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
Put (featuresFile, "| 10 | Fiendish Resilience");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
Put (featuresFile, "| 11 | Mystic Arcaneum (6th level)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
Put (featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
Put (featuresFile, "| 13 | Mystic Arcaneum (7th level)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
Put (featuresFile, "| 14 | Hurl through Hell");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
Put (featuresFile, "| 15 | Mystic Arcaneum (8th level)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
Put (featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
Put (featuresFile, "| 17 | Mystic Arcaneum (9th level)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
Put (featuresFile, "| 18 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
Put (featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
Put (featuresFile, "| 20 | Eldritch Master");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When Wizard =>
If character.class.subclass = Evocation Then
Put (featuresFile, character.class.main);
Put (featuresFile, " - SCHOOL OF ");
Put (featuresFile, character.class.subclass);
New_Line(featuresFile);
Put (featuresFile, "---------------------------------------");
New_Line (featuresFile);
Put (featuresFile, "| Lv | Feature(s)");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
If character.class.level >= 1 Then
-- print out 1st lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 1 | Spellcasting");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Arcane Recovery");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 2 Then
-- print out 1st and 2nd lev class features
Ada.Text_IO.Put(featuresFile, "| 2 | Arcane Tradition");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Evocation Savant");
New_Line(featuresFile);
Ada.Text_IO.Put(featuresFile, "| | Sculpt Spells");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 3 Then
-- print out 1st, 2nd, and 3rd lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 3 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 4 Then
-- print out 1st thru 4th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 4 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 5 Then
-- print out 1st thru 5th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 5 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 6 Then
-- print out 1st thru 6th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 6 | Potent Cantrip");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 7 Then
-- print out 1st thru 7th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 7 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 8 Then
-- print out 1st thru 8th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 8 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 9 Then
-- print out 1st thru 9th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 9 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 10 Then
-- print out 1st thru 10th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 10 | Empowered Evocation");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 11 Then
-- print out 1st thru 11th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 11 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 12 Then
-- print out 1st thru 12th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 12 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 13 Then
-- print out 1st thru 13th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 13 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 14 Then
-- print out 1st thru 14th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 14 | Overchannel");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 15 Then
-- print out 1st thru 15th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 15 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 16 Then
-- print out 1st thru 16th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 16 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 17 Then
-- print out 1st thru 17th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 17 | ---");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 18 Then
-- print out 1st thru 18th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 18 | Spell Mastery");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 19 Then
-- print out 1st thru 19th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 19 | Ability Score Improvement*");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
If character.class.level >= 20 Then
-- print out 1st thru 20th lev class and sub features
Ada.Text_IO.Put(featuresFile, "| 20 | Signature Spell");
New_Line(featuresFile);
Put (featuresFile, TABLE_BORDER);
New_Line(featuresFile);
End If;
End If;
When others => null;
End Case;
Put(featuresFile, "* You must manually modify ability scores.");
New_Line(featuresFile);
Put(featuresFile, " You have 2 points to allocate and scores cannot exceed 20.");
New_Line(featuresFile);
close(featuresFile);
End outputFeatures;
----------------------------------------------------
--------Declaration Section of the main body--------
----------------------------------------------------
escape : Character;
character : Character_Type;
Begin -- NPC_Builder
getUserInput (character);
New_Line;
caseRaceInfo(character);
caseAbilityScores(character);
If character.race.main = HalfElf Then
halfElfAbilities(character);
caseAbilityScores(character);
End If;
caseClassInfo(character);
combatReference(character);
New_Line;
outputToConsole(character);
outputCharacterFile(character);
outputSkillsToFile(character);
outputCombatReference(character);
outputFeatures(character);
New_Line;
Put ("Check out the area you saved this program");
New_Line;
Put ("to find text file versions of the output.");
New_Line;
Put ("The files will be named:");
New_Line;
Put ("1.) 'Character.txt.'");
New_Line;
Put ("2.) 'Skills.txt'");
New_Line;
Put ("3.) 'CombatReference.txt'");
New_Line;
Put ("4.) 'Features.txt'");
New_Line(2);
Put("Press any key to terminate the program. ");
Ada.Text_IO.Get_Immediate(escape);
End NPC_Builder;
|
src/GBA.Display.Backgrounds.Refs.ads | 98devin/ada-gba-dev | 7 | 30417 | <reponame>98devin/ada-gba-dev<gh_stars>1-10
-- Copyright (c) 2021 <NAME>
-- zlib License -- see LICENSE for details.
limited with GBA.Refs;
package GBA.Display.Backgrounds.Refs is
type BG_Ref (<>) is abstract tagged limited private;
function ID (This : BG_Ref'Class) return BG_ID
with Inline;
function Priority (This : BG_Ref'Class) return Display_Priority
with Inline;
function Mosaic_Enabled (This : BG_Ref'Class) return Boolean
with Inline;
procedure Set_Priority
(This : in out BG_Ref'Class; Priority : Display_Priority);
procedure Enable_Mosaic
(This : in out BG_Ref'Class; Enable : Boolean := True);
generic
with procedure Update (Control : in out BG_Control_Info);
procedure Update_Control_Info (This : in out BG_Ref'Class);
type Reg_BG_Ref (<>) is new BG_Ref with private;
function Offset (This : Reg_BG_Ref'Class) return BG_Offset_Info
with Inline;
procedure Set_Offset
(This : in out Reg_BG_Ref'Class; Offset : BG_Offset_Info);
procedure Set_Offset
(This : in out Reg_BG_Ref'Class; X, Y : BG_Scroll_Offset)
with Inline_Always;
procedure Set_Offset_X
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset);
procedure Set_Offset_Y
(This : in out Reg_BG_Ref'Class; Value : BG_Scroll_Offset);
procedure Move_Offset
(This : in out Reg_BG_Ref'Class; DX, DY : BG_Scroll_Offset := 0);
generic
with procedure Update (Offset : in out BG_Offset_Info);
procedure Update_Offset (This : in out Reg_BG_Ref'Class);
type Aff_BG_Ref (<>) is new BG_Ref with private;
function Transform (This : Aff_BG_Ref'Class)
return Affine_Transform_Matrix with Inline;
function Reference_Point (This : Aff_BG_Ref'Class)
return BG_Reference_Point with Inline;
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class;
Reference_Point : BG_Reference_Point);
procedure Set_Reference_Point
(This : in out Aff_BG_Ref'Class; X, Y : BG_Reference_Point_Coordinate);
procedure Set_Reference_X
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate);
procedure Set_Reference_Y
(This : in out Aff_BG_Ref'Class; Value : BG_Reference_Point_Coordinate);
procedure Move_Reference_Point
(This : in out Aff_BG_Ref'Class; DX, DY : BG_Reference_Point_Coordinate := 0.0);
generic
with procedure Update (Transform : in out BG_Transform_Info);
procedure Update_Transform (This : in out Aff_BG_Ref'Class);
private
type Volatile_BG_Control_Info is
new BG_Control_Info with Volatile;
type BG_Ref (Control : access Volatile_BG_Control_Info) is
tagged limited record
ID : BG_ID;
end record;
type Reg_BG_Ref is new BG_Ref with
record
Offset : BG_Offset_Info;
end record;
type Aff_BG_Ref is new BG_Ref with
record
Transform_Info : BG_Transform_Info;
end record;
end GBA.Display.Backgrounds.Refs; |
models/tests/test42.als | transclosure/Amalgam | 4 | 2257 | <reponame>transclosure/Amalgam
module tests/test --- bug post submitted by <NAME>
sig Heap {
roots : set Obj
}
sig Obj {
linked : set Obj
}
fact {
all h : Heap | univ.(^linked) in univ
}
pred show () {
some h : Heap | ((some o : h.roots.^linked | o in o.^linked) and
(all o : h.roots.^linked | not o in o.linked ))
}
run show but 1 Heap
|
sql-python3/sql.g4 | mretolaza/dmbsDataProject | 0 | 147 | /*
* Gramática simplificada basada en SQLite para propósitos del curso de bases de
* datos UVG CC3057.
*
* Retreived from: https://raw.githubusercontent.com/antlr/grammars-v4/master/sqlite/SQLite.g4
*/
grammar sql;
/**
* Parser rules
*/
parse
: ( sql_stmt_list | error )* EOF
;
error
: UNEXPECTED_CHAR
{raise Exception("UNEXPECTED_CHAR=" + $UNEXPECTED_CHAR.text)}
;
sql_stmt_list
: ';'* sql_stmt ( ';'+ sql_stmt )* ';'*
;
sql_stmt
: ( create_database_stmt
| alter_database_stmt
| drop_database_stmt
| show_databases_stmt
| show_tables_stmt
| use_database_stmt
| create_table_stmt
| alter_table_stmt
| show_columns_stmt
| begin_stmt
| commit_stmt
| create_index_stmt
| delete_stmt
| drop_index_stmt
| drop_table_stmt
| factored_select_stmt
| insert_stmt
| rollback_stmt
| simple_select_stmt
| update_stmt )
;
create_database_stmt
: K_CREATE K_DATABASE database_name
;
alter_database_stmt
: K_ALTER K_DATABASE database_name K_RENAME K_TO new_database_name
;
drop_database_stmt
: K_DROP K_DATABASE database_name
;
show_databases_stmt
: K_SHOW K_DATABASES
;
show_tables_stmt
: K_SHOW K_TABLES
;
use_database_stmt
: K_USE K_DATABASE database_name
;
alter_table_stmt
: K_ALTER K_TABLE table_name
( K_RENAME K_TO new_table_name
| K_ADD K_COLUMN column_def
| K_ADD table_constraint
| K_DROP K_COLUMN column_name
| K_DROP K_CONSTRAINT name
)
;
show_columns_stmt
: K_SHOW K_COLUMNS K_FROM table_name
;
begin_stmt
: K_BEGIN ( K_TRANSACTION transaction_name? )?
;
commit_stmt
: K_COMMIT ( K_TRANSACTION transaction_name? )?
;
/**
* Esto agrupa posibles SELECT statements unidos por operaciones de conjuntos:
* UNION, INTERSECT, EXCEPT
*/
factored_select_stmt
: select_core ( compound_operator select_core )*
( K_ORDER K_BY ordering_term ( ',' ordering_term )* )?
( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )?
;
create_index_stmt
: K_CREATE K_INDEX
index_name K_ON table_name '(' column_name ( ',' column_name )* ')'
;
create_table_stmt
: K_CREATE K_TABLE
table_name
'(' column_def ( ',' column_def )* ( ',' table_constraint )* ')'
;
delete_stmt
: K_DELETE K_FROM table_name
( K_WHERE expr )?
;
drop_index_stmt
: K_DROP K_INDEX index_name
;
drop_table_stmt
: K_DROP K_TABLE table_name
;
insert_stmt
: K_INSERT K_INTO
table_name ( '(' column_name ( ',' column_name )* ')' )?
K_VALUES '(' expr ( ',' expr )* ')'
;
rollback_stmt
: K_ROLLBACK
;
simple_select_stmt
: select_core ( K_ORDER K_BY ordering_term ( ',' ordering_term )* )?
( K_LIMIT expr ( ( K_OFFSET | ',' ) expr )? )?
;
update_stmt
: K_UPDATE table_name
K_SET column_name '=' expr ( ',' column_name '=' expr )* ( K_WHERE expr )?
;
column_def
: column_name type_name column_constraint*
;
type_name
: name+ ( '(' signed_number ')'
| '(' signed_number ',' signed_number ')' )?
;
column_constraint
: K_DEFAULT (signed_number | literal_value | '(' expr ')')
;
/*
SQLite understands the following binary operators, in order from highest to
lowest precedence:
* / %
+ -
<< >> & |
< <= > >=
= == != <> IS IS NOT IN LIKE GLOB MATCH
AND
OR
NOT
*/
expr
: literal_value # exprLiteralValue
| ( table_name '.' )? column_name # exprTableColumn
| unary_operator expr # exprUnaryExpr
| expr ( '*' | '/' | '%' ) expr # exprMul
| expr ( '+' | '-' ) expr # exprAdd
| expr ( '<' | '<=' | '>' | '>=' ) expr # exprComparisonFirst
| expr ( '=' | '==' | '!=' | '<>' | K_IS | K_IS K_NOT | K_IN | K_LIKE | K_MATCH ) expr # exprComparisonSecond
| expr K_AND expr # exprAnd
| expr K_OR expr # exprOr
| function_name '(' ( K_DISTINCT? expr ( ',' expr )* | '*' )? ')' # exprFunction
| K_NOT expr # exprNot
| '(' expr ')' # exprParenthesis
| expr K_NOT? ( K_LIKE ) expr # exprLike
| expr ( K_NOT K_NULL ) # exprNotNull
| expr K_IS K_NOT? expr # exprIsNot
| expr K_NOT? K_IN ( '(' ( select_core | expr ( ',' expr )* )? ')' | table_name ) # exprNotIn
| ( ( K_NOT )? K_EXISTS )? '(' select_core ')' # exprNotExists
;
foreign_key_clause
: K_REFERENCES foreign_table ( '(' column_name ( ',' column_name )* ')' )?
;
table_constraint
: K_CONSTRAINT name
( ( K_PRIMARY K_KEY | K_UNIQUE ) '(' column_name ( ',' column_name )* ')'
| K_CHECK '(' expr ')'
| K_FOREIGN K_KEY '(' column_name ( ',' column_name )* ')' foreign_key_clause
)
;
ordering_term
: expr ( K_ASC | K_DESC )?
;
common_table_expression
: table_name ( '(' column_name ( ',' column_name )* ')' )? K_AS '(' select_core ')'
;
result_column
: '*' # resultColumnAsterisk
| table_name '.' '*' # resultColumnTableAsterisk
| expr ( K_AS? column_alias )? # resultColumnExpr
;
table_or_subquery
: table_name ( K_AS? table_alias )?
| '(' ( table_or_subquery ( ',' table_or_subquery )*
| join_clause )
')' ( K_AS? table_alias )?
| '(' select_core ')' ( K_AS? table_alias )?
;
join_clause
: table_or_subquery ( join_operator table_or_subquery join_constraint )*
;
join_operator
: ','
| ( K_LEFT | K_INNER ) K_JOIN
;
join_constraint
: ( K_ON expr )?
;
select_core
: K_SELECT ( K_DISTINCT )? result_column ( ',' result_column )*
( K_FROM ( table_or_subquery ( ',' table_or_subquery )* | join_clause ) )?
( K_WHERE expr )?
( K_GROUP K_BY expr ( ',' expr )* ( K_HAVING expr )? )?
;
compound_operator
: K_UNION
| K_INTERSECT
| K_EXCEPT
;
cte_table_name
: table_name ( '(' column_name ( ',' column_name )* ')' )?
;
signed_number
: ( '+' | '-' )? NUMERIC_LITERAL
;
literal_value
: NUMERIC_LITERAL
| STRING_LITERAL
| BLOB_LITERAL
| K_NULL
;
unary_operator
: '-'
| '+'
| '~'
| K_NOT
;
error_message
: STRING_LITERAL
;
module_argument // TODO check what exactly is permitted here
: expr
| column_def
;
column_alias
: IDENTIFIER
| STRING_LITERAL
;
keyword
: K_ADD
| K_ALTER
| K_AND
| K_AS
| K_ASC
| K_BEGIN
| K_BY
| K_CHECK
| K_COLUMN
| K_COMMIT
| K_CONSTRAINT
| K_CREATE
| K_DATABASE
| K_DATABASES
| K_DEFAULT
| K_DELETE
| K_DESC
| K_DISTINCT
| K_DROP
| K_EXCEPT
| K_EXISTS
| K_FOR
| K_FOREIGN
| K_FROM
| K_FULL
| K_GROUP
| K_HAVING
| K_IGNORE
| K_IN
| K_INDEX
| K_INNER
| K_INSERT
| K_INTERSECT
| K_INTO
| K_IS
| K_JOIN
| K_KEY
| K_LEFT
| K_LIKE
| K_LIMIT
| K_NOT
| K_NULL
| K_OF
| K_OFFSET
| K_ON
| K_OR
| K_ORDER
| K_PRIMARY
| K_REFERENCES
| K_RENAME
| K_ROLLBACK
| K_SELECT
| K_SET
| K_SHOW
| K_TABLE
| K_TABLES
| K_THEN
| K_TO
| K_TRANSACTION
| K_USE
| K_UNION
| K_UNIQUE
| K_UPDATE
| K_VALUES
| K_WHERE
;
// TODO check all names below
name
: any_name
;
function_name
: any_name
;
database_name
: any_name
;
table_name
: any_name
;
table_or_index_name
: any_name
;
new_table_name
: any_name
;
new_database_name
: any_name
;
column_name
: any_name
;
collation_name
: any_name
;
foreign_table
: any_name
;
index_name
: any_name
;
trigger_name
: any_name
;
view_name
: any_name
;
module_name
: any_name
;
table_alias
: any_name
;
transaction_name
: any_name
;
any_name
: IDENTIFIER
| keyword
| STRING_LITERAL
| '(' any_name ')'
;
/**
* Lexer rules
*
* http://www.sqlite.org/lang_keywords.html
*/
K_ADD : A D D;
K_ALTER : A L T E R;
K_AND : A N D;
K_AS : A S;
K_ASC : A S C;
K_BEGIN : B E G I N;
K_BY : B Y;
K_CHECK : C H E C K;
K_COLUMN : C O L U M N;
K_COLUMNS : C O L U M N S;
K_COMMIT : C O M M I T;
K_CONSTRAINT : C O N S T R A I N T;
K_CREATE : C R E A T E;
K_DATABASE : D A T A B A S E;
K_DATABASES : D A T A B A S E S;
K_DEFAULT: D E F A U L T;
K_DELETE : D E L E T E;
K_DESC : D E S C;
K_DISTINCT : D I S T I N C T;
K_DROP : D R O P;
K_EXCEPT : E X C E P T;
K_EXISTS : E X I S T S;
K_FOR : F O R;
K_FOREIGN : F O R E I G N;
K_FROM : F R O M;
K_FULL : F U L L;
K_GROUP : G R O U P;
K_HAVING : H A V I N G;
K_IGNORE : I G N O R E;
K_IN : I N;
K_INDEX : I N D E X;
K_INNER : I N N E R;
K_INSERT : I N S E R T;
K_INTERSECT : I N T E R S E C T;
K_INTO : I N T O;
K_IS : I S;
K_JOIN : J O I N;
K_KEY : K E Y;
K_LEFT : L E F T;
K_LIKE : L I K E;
K_LIMIT : L I M I T;
K_MATCH : M A T C H;
K_NATURAL : N A T U R A L;
K_NO : N O;
K_NOT : N O T;
K_NULL : N U L L;
K_OF : O F;
K_OFFSET : O F F S E T;
K_ON : O N;
K_OR : O R;
K_ORDER : O R D E R;
K_PRIMARY : P R I M A R Y;
K_REFERENCES : R E F E R E N C E S;
K_RENAME : R E N A M E;
K_ROLLBACK : R O L L B A C K;
K_SELECT : S E L E C T;
K_SET : S E T;
K_SHOW : S H O W;
K_TABLE : T A B L E;
K_TABLES : T A B L E S;
K_THEN : T H E N;
K_TO : T O;
K_TRANSACTION : T R A N S A C T I O N;
K_UNION : U N I O N;
K_UNIQUE : U N I Q U E;
K_UPDATE : U P D A T E;
K_USE : U S E;
K_VALUES : V A L U E S;
K_WHERE : W H E R E;
IDENTIFIER
: '"' (~'"' | '""')* '"'
| '`' (~'`' | '``')* '`'
| '[' ~']'* ']'
| [a-zA-Z_] [a-zA-Z_0-9]* // TODO check: needs more chars in set
;
NUMERIC_LITERAL
: DIGIT+ ( '.' DIGIT* )? ( E [-+]? DIGIT+ )?
| '.' DIGIT+ ( E [-+]? DIGIT+ )?
;
STRING_LITERAL
: '\'' ( ~'\'' | '\'\'' )* '\''
;
BLOB_LITERAL
: X STRING_LITERAL
;
SINGLE_LINE_COMMENT
: '--' ~[\r\n]* -> channel(HIDDEN)
;
MULTILINE_COMMENT
: '/*' .*? ( '*/' | EOF ) -> channel(HIDDEN)
;
SPACES
: [ \u000B\t\r\n] -> channel(HIDDEN)
;
UNEXPECTED_CHAR
: .
;
fragment DIGIT : [0-9];
fragment A : [aA];
fragment B : [bB];
fragment C : [cC];
fragment D : [dD];
fragment E : [eE];
fragment F : [fF];
fragment G : [gG];
fragment H : [hH];
fragment I : [iI];
fragment J : [jJ];
fragment K : [kK];
fragment L : [lL];
fragment M : [mM];
fragment N : [nN];
fragment O : [oO];
fragment P : [pP];
fragment Q : [qQ];
fragment R : [rR];
fragment S : [sS];
fragment T : [tT];
fragment U : [uU];
fragment V : [vV];
fragment W : [wW];
fragment X : [xX];
fragment Y : [yY];
fragment Z : [zZ];
|
src/main/fragment/mos6502-common/vdum1=vdum1_minus_vdum2.asm | jbrandwood/kickc | 2 | 242828 | <filename>src/main/fragment/mos6502-common/vdum1=vdum1_minus_vdum2.asm<gh_stars>1-10
lda {m1}
sec
sbc {m2}
sta {m1}
lda {m1}+1
sbc {m2}+1
sta {m1}+1
lda {m1}+2
sbc {m2}+2
sta {m1}+2
lda {m1}+3
sbc {m2}+3
sta {m1}+3
|
examples/or1k/crt0.asm | rakati/ppci-mirror | 161 | 3932 | <filename>examples/or1k/crt0.asm
section reset
l.j start
l.nop 0
section code
global __data_load_start
global __data_start
global __data_end
global main_main
global bsp_exit
start:
; Initialize ram!
l.movhi r3, hi(__data_load_start)
l.ori r3, r3, lo(__data_load_start)
l.movhi r4, hi(__data_start)
l.ori r4, r4, lo(__data_start)
l.movhi r5, hi(__data_end)
l.ori r5, r5, lo(__data_end)
l.sflts r4, r5
l.bnf _load_done
l.nop 0
_load_loop:
l.lbz r9, 0(r3)
l.addi r3, r3, 1
l.sb 0(r4), r9
l.addi r4, r4, 1
l.sflts r4, r5
l.bf _load_loop
l.nop 0
_load_done:
; Setup stack and enter main!
l.movhi r1, 0x3 ; Setup stack pointer to 0x30000
l.jal main_main ; Enter main
l.nop 0 ; fill delay slot
l.jal bsp_exit ; Call exit cleaning
l.nop 0 ; fill delay slot
end_inf_loop:
l.j end_inf_loop
l.nop 0 ; fill delay slot
|
tests/expr_asm_value/2.asm | NullMember/customasm | 414 | 165682 | <reponame>NullMember/customasm
; concat
#ruledef
{
emit {x: i8} => x
test {x} => asm { emit x } @ asm { emit 0xff }
}
emit 0x12 ; = 0x12
test 0x12 ; = 0x12ff
test 0x10 + 2 ; = 0x12ff |
Transynther/x86/_processed/NONE/_xt_sm_/i7-7700_9_0xca.log_21829_926.asm | ljhsiun2/medusa | 9 | 80223 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %r11
push %r13
push %r9
push %rcx
push %rdi
push %rsi
lea addresses_normal_ht+0x1770b, %r11
clflush (%r11)
nop
nop
nop
add %r13, %r13
mov $0x6162636465666768, %r9
movq %r9, %xmm0
vmovups %ymm0, (%r11)
nop
nop
dec %r13
lea addresses_D_ht+0x1ef1b, %rsi
lea addresses_normal_ht+0x15a5b, %rdi
nop
nop
nop
dec %r10
mov $27, %rcx
rep movsl
nop
and $1373, %rsi
lea addresses_WT_ht+0x509b, %rsi
cmp $27186, %r11
mov (%rsi), %r13
nop
nop
nop
nop
nop
inc %rsi
lea addresses_normal_ht+0xf63f, %r13
nop
nop
cmp %rcx, %rcx
movw $0x6162, (%r13)
nop
sub $64019, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r9
pop %r13
pop %r11
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r11
push %r13
push %r14
push %rbx
push %rdx
push %rsi
// Store
lea addresses_WT+0x7f1b, %r11
nop
nop
sub $10941, %rbx
movb $0x51, (%r11)
xor %r10, %r10
// Store
lea addresses_D+0x18f1b, %r11
and %r14, %r14
movl $0x51525354, (%r11)
nop
inc %rdx
// Store
lea addresses_A+0x8329, %r13
clflush (%r13)
nop
nop
nop
cmp $33921, %rbx
mov $0x5152535455565758, %rdx
movq %rdx, %xmm1
movups %xmm1, (%r13)
nop
nop
nop
nop
cmp $6396, %r10
// Store
lea addresses_D+0x1471b, %rsi
nop
and %rbx, %rbx
mov $0x5152535455565758, %r10
movq %r10, %xmm6
movaps %xmm6, (%rsi)
nop
add %rdx, %rdx
// Load
lea addresses_RW+0x135b, %rsi
add %r10, %r10
vmovups (%rsi), %ymm5
vextracti128 $1, %ymm5, %xmm5
vpextrq $0, %xmm5, %r11
nop
nop
nop
sub %r14, %r14
// Store
lea addresses_A+0xa358, %rdx
nop
nop
nop
nop
cmp %r10, %r10
mov $0x5152535455565758, %rbx
movq %rbx, %xmm5
vmovups %ymm5, (%rdx)
nop
nop
nop
nop
and %rbx, %rbx
// Store
lea addresses_A+0x7277, %rbx
nop
nop
and $58914, %rdx
movw $0x5152, (%rbx)
nop
nop
xor $39672, %r10
// Faulty Load
lea addresses_D+0x18f1b, %rdx
nop
nop
cmp $5492, %rsi
mov (%rdx), %r11d
lea oracles, %r13
and $0xff, %r11
shlq $12, %r11
mov (%r13,%r11,1), %r11
pop %rsi
pop %rdx
pop %rbx
pop %r14
pop %r13
pop %r11
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'src': {'congruent': 0, 'AVXalign': True, 'same': False, 'size': 16, 'NT': True, 'type': 'addresses_D'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 11, 'AVXalign': True, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_D'}}
{'OP': 'STOR', 'dst': {'congruent': 1, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': True, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_D'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_A'}}
{'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_A'}}
[Faulty Load]
{'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 4, 'NT': False, 'type': 'addresses_D'}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'OP': 'STOR', 'dst': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 11, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 5, 'same': False, 'type': 'addresses_normal_ht'}}
{'src': {'congruent': 5, 'AVXalign': False, 'same': True, 'size': 8, 'NT': False, 'type': 'addresses_WT_ht'}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'congruent': 2, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}}
{'54': 21829}
54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54 54
*/
|
programs/oeis/122/A122124.asm | neoneye/loda | 22 | 83514 | <filename>programs/oeis/122/A122124.asm
; A122124: Numbers n such that 25 divides Sum[ Prime[k]^n, {k,1,n}].
; 3,5,7,11,15,19,23,25,27,31,35,39,43,45,47,51,55,59,63,65,67,71,75,79,83,85,87,91,95,99,103,105,107,111,115,119,123,125,127,131,135,139,143,145,147,151,155,159,163,165,167,171,175,179,183,185,187,191,195,199
add $0,1
mov $1,1
add $1,$0
seq $0,323735 ; a(n) is the largest minimal distance of a binary LCD [n,2] code.
add $1,$0
sub $1,4
mul $1,2
add $1,3
mov $0,$1
|
test/Succeed/Issue4049.agda | shlevy/agda | 2 | 5039 | -- Andreas, 2019-10-21, issue #4049
-- reported and test case by andy-morris
open import Agda.Builtin.Size
data A : Size → Set
B = A
data A where
a : ∀ i → B i
-- WAS (2.6.0): internal error in Polarity.hs
-- Should succeed.
|
metadsl.g4 | saas-plat/metadsl | 0 | 5765 | <filename>metadsl.g4
// 一组业务设计模型,以便 **快速**、**易懂**、**专业** 的进行业务元数据建模
// 2021-01-18
// MIT License
grammar metadsl;
metadsl
: value? EOF
;
obj
: '{' pair (',' pair)* ','? '}'
| '{' '}'
;
pair
: key ':' value
;
key
: STRING
| IDENTIFIER
| LITERAL
| NUMERIC_LITERAL
;
value
: STRING
| number
| obj
| arr
| LITERAL
;
arr
: '[' value (',' value)* ','? ']'
| '[' ']'
;
number
: SYMBOL?
( NUMERIC_LITERAL
| NUMBER
)
;
// Lexer
SINGLE_LINE_COMMENT
: '//' .*? (NEWLINE | EOF) -> skip
;
MULTI_LINE_COMMENT
: '/*' .*? '*/' -> skip
;
LITERAL
: 'true'
| 'false'
| 'null'
;
STRING
: '"' DOUBLE_QUOTE_CHAR* '"'
| '\'' SINGLE_QUOTE_CHAR* '\''
;
fragment DOUBLE_QUOTE_CHAR
: ~["\\\r\n]
| ESCAPE_SEQUENCE
;
fragment SINGLE_QUOTE_CHAR
: ~['\\\r\n]
| ESCAPE_SEQUENCE
;
fragment ESCAPE_SEQUENCE
: '\\'
( NEWLINE
| UNICODE_SEQUENCE // \u1234
| ['"\\/bfnrtv] // single escape char
| ~['"\\bfnrtv0-9xu\r\n] // non escape char
| '0' // \0
| 'x' HEX HEX // \x3a
)
;
NUMBER
: INT ('.' [0-9]*)? EXP? // +1.e2, 1234, 1234.5
| '.' [0-9]+ EXP? // -.2e3
| '0' [xX] HEX+ // 0x12345678
;
NUMERIC_LITERAL
: 'Infinity'
| 'NaN'
;
SYMBOL
: '+' | '-'
;
fragment HEX
: [0-9a-fA-F]
;
fragment INT
: '0' | [1-9] [0-9]*
;
fragment EXP
: [Ee] SYMBOL? [0-9]*
;
IDENTIFIER
: IDENTIFIER_START IDENTIFIER_PART*
;
fragment IDENTIFIER_START
: [\p{L}]
| '$'
| '_'
| '\\' UNICODE_SEQUENCE
;
fragment IDENTIFIER_PART
: IDENTIFIER_START
| [\p{M}]
| [\p{N}]
| [\p{Pc}]
| '\u200C'
| '\u200D'
;
fragment UNICODE_SEQUENCE
: 'u' HEX HEX HEX HEX
;
fragment NEWLINE
: '\r\n'
| [\r\n\u2028\u2029]
;
WS
: [ \t\n\r\u00A0\uFEFF\u2003] + -> skip
;
|
source/bbedit/BBEdit.applescript | andyguzman/PopClippins | 12 | 1728 | <reponame>andyguzman/PopClippins
tell application "BBEdit"
activate
set txt to contents of "{popclip text}"
set doc to make new document with properties {contents:txt}
end tell |
1571/64tass/rel1.asm | silverdr/assembly | 23 | 13974 | <reponame>silverdr/assembly<gh_stars>10-100
;***********************************
;*
;* routine: nxtrec
;*
;*
;*
;*
;*
;***********************************
nxtrec
lda #ovrflo
jsr clrflg
lda #lrf
jsr tstflg
bne nxtr40
ldx lindx
inc recl,x ; goto next record #
bne nxtr15
inc rech,x
nxtr15
ldx lindx
lda nr,x
beq nxtr45 ; there is a nr
jsr getpnt ; get pointer
ldx lindx ; test if same buffer
cmp nr,x
bcc nxtr20 ; yes, bt<nr
jsr nrbuf ; no,next buffer
nxtr20 ldx lindx
lda nr,x
jsr setpnt ; advance to next rec
lda (buftab,x) ; read 1st dat byte
sta data ; save for read channel
lda #ovrflo
jsr clrflg ; clear
; the overflow flag
jsr addnr ; advance nr
nxout
pha
bcc nxtr30 ; no block boundary
lda #0
jsr drdbyt ; check track link
bne nxtr30 ; not last block
pla
cmp #2
beq nxtr50
nxtr45
lda #lrf
jsr setflg
nxtr40
jsr getpre
lda buftab,x
sta lstchr,y
lda #cr
sta data
rts
nxtr50
jsr nxtr35
ldx lindx
lda #0
sta nr,x
rts
nxtr30
pla
nxtr35
ldx lindx
;*
sta nr,x
jmp setlst
;*
;*
;**********************************
;*
;*
;* nrbuf
;*
;*
;********************************
;*
;*
nrbuf ; read trk,sec link
jsr setdrn
jsr rdlnk
jsr gaflgs ; test if dirty
bvc nrbu50 ; clean, dont write out
jsr wrtout ; dirty, write out
jsr dblbuf ; toggle active buffer
lda #2
jsr setpnt
jsr tstwrt ; test if lstjob is wrt
bne nrbu20 ; not a write,buffer ok
jsr rdab ; read in needed buffer
jmp watjob ; wait around till done
nrbu50 jsr dblbuf ; toggle act buf
jsr tstwrt ; was lstjob a wrt?
bne nrbu70 ; not a write
jsr rdab ; read in needed buffer
jsr watjob ; wait till done
nrbu70 ; read trk,sec link
jsr rdlnk ; to do a read ahead
lda track ; test if last buffer
beq nrbu20 ; yes,no dbl buff todo
jsr dblbuf ; start read job on the
jsr rdab ; inactive buffer
jsr dblbuf
nrbu20 rts
|
oeis/122/A122884.asm | neoneye/loda-programs | 11 | 9658 | <reponame>neoneye/loda-programs<gh_stars>10-100
; A122884: The (2,3)-entry in the n-th power of the 3 X 3 matrix M = [1,1,1; 4,2,1; 9,3,1].
; Submitted by <NAME>
; 1,7,39,231,1339,7819,45543,265503,1547347,9018835,52565151,306373095,1785671371,10407659227,60660275799,353554011951,2060663763139,12010428632419,70001907900303,408001019031543,2378004205764667
mov $2,1
mov $4,1
lpb $0
sub $0,1
mov $1,$2
mul $2,2
add $3,$4
mul $3,2
add $3,$4
add $4,$2
add $4,$1
mov $2,$4
add $2,$3
mov $3,$1
lpe
mov $0,$2
|
programs/oeis/328/A328082.asm | karttu/loda | 1 | 164897 | <gh_stars>1-10
; A328082: Triangle read by rows: columns are Fibonacci numbers F_{2i+1} shifted downwards.
; 1,2,1,5,2,1,13,5,2,1,34,13,5,2,1,89,34,13,5,2,1,233,89,34,13,5,2,1,610,233,89,34,13,5,2,1,1597,610,233,89,34,13,5,2,1,4181,1597,610,233,89,34,13,5,2,1,10946,4181,1597,610,233,89,34,13,5,2,1,28657,10946,4181,1597,610,233,89,34,13,5,2,1,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,9227465,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,24157817,9227465,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,63245986,24157817,9227465,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,165580141,63245986,24157817,9227465,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13,5,2,1,433494437,165580141,63245986,24157817,9227465,3524578,1346269,514229,196418,75025,28657,10946,4181,1597,610,233,89,34,13
cal $0,212012 ; Triangle read by rows in which row n lists the number of states of the subshells of the n-th shell of the nuclear shell model ordered by energy level in increasing order.
sub $0,1
cal $0,22351 ; Fibonacci sequence beginning 0, 17.
mov $1,$0
sub $1,17
div $1,17
add $1,1
|
alloy4fun_models/trashltl/models/4/YX8BNCknitRiv7H2b.als | Kaixi26/org.alloytools.alloy | 0 | 3169 | <reponame>Kaixi26/org.alloytools.alloy
open main
pred idYX8BNCknitRiv7H2b_prop5 {
some f: File | no Trash and eventually f in Trash
}
pred __repair { idYX8BNCknitRiv7H2b_prop5 }
check __repair { idYX8BNCknitRiv7H2b_prop5 <=> prop5o } |
Transynther/x86/_processed/AVXALIGN/_st_/i9-9900K_12_0xca_notsx.log_21829_1973.asm | ljhsiun2/medusa | 9 | 243874 | .global s_prepare_buffers
s_prepare_buffers:
push %r10
push %rcx
push %rdi
push %rsi
lea addresses_WC_ht+0x1dd13, %rsi
lea addresses_A_ht+0x10a51, %rdi
and $19597, %r10
mov $34, %rcx
rep movsl
nop
sub $64470, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %r10
ret
.global s_faulty_load
s_faulty_load:
push %r10
push %r14
push %r15
push %rdi
push %rdx
push %rsi
// Faulty Load
lea addresses_RW+0x7b13, %rsi
clflush (%rsi)
nop
nop
nop
nop
nop
and %r10, %r10
movb (%rsi), %r14b
lea oracles, %r15
and $0xff, %r14
shlq $12, %r14
mov (%r15,%r14,1), %r14
pop %rsi
pop %rdx
pop %rdi
pop %r15
pop %r14
pop %r10
ret
/*
<gen_faulty_load>
[REF]
{'OP': 'LOAD', 'src': {'same': False, 'type': 'addresses_RW', 'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0}}
[Faulty Load]
{'OP': 'LOAD', 'src': {'same': True, 'type': 'addresses_RW', 'NT': True, 'AVXalign': False, 'size': 1, 'congruent': 0}}
<gen_prepare_buffer>
{'OP': 'REPM', 'src': {'same': False, 'congruent': 9, 'type': 'addresses_WC_ht'}, 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_A_ht'}}
{'32': 21829}
32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
*/
|
oeis/014/A014688.asm | neoneye/loda-programs | 11 | 23832 | <filename>oeis/014/A014688.asm
; A014688: a(n) = n-th prime + n.
; Submitted by <NAME>
; 3,5,8,11,16,19,24,27,32,39,42,49,54,57,62,69,76,79,86,91,94,101,106,113,122,127,130,135,138,143,158,163,170,173,184,187,194,201,206,213,220,223,234,237,242,245,258,271,276,279,284,291,294,305,312,319,326,329,336,341,344,355,370,375,378,383,398,405,416,419,424,431,440,447,454,459,466,475,480,489,500,503,514,517,524,529,536,545,550,553,558,571,580,585,594,599,606,619,622,641
mov $2,$0
seq $0,40 ; The prime numbers.
add $0,$2
add $0,1
|
main.asm | OleksiyTokarchuk/AVR-ATtiny12-Time-Relay-Assembly-Code | 0 | 242047 | <gh_stars>0
;Author: <NAME>
;<EMAIL>
.def data = r16 ;Software shift register
.def i = r17 ;Register that stores cycle iterator
.def p = r18 ;Pointer to data in table for 7-segment indicators
.def dataout = r19 ;Register that outputs data from shift into IO space
.def tableaddr = r20 ;Register that stores first byte point in table
.def temp = r21
.def time = r22
.def setpoint = r23
.def buttonstate = r24
.equ clock = 0 ;clock pin
.equ cs = 2 ;chip selsct pin
.equ mosi = 1 ;sdout pin
.equ mask = 0b00000010 ;mask where 1 corresponds mosi pin position in PORTx register
.equ plus = 3
.equ minus = 4
.equ relay = 5
.eseg
.db 0x01
.cseg
.org 0x00 rjmp RESET
; the best place to access table by single relative address LOW register
table: .db 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, \
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, \
0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, \
0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, \
0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, \
0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, \
0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, \
0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, \
0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, \
0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99
RESET:
ldi tableaddr, LOW(table * 2)
sbi DDRB, mosi ;data
sbi DDRB, clock ;clock
sbi DDRB, cs ;latch
ldi temp, (1 << plus)|(1 << minus)
out PORTB, temp ;pull-up for buttons
rcall EEPROMRead
in setpoint, EEDR
mov p, setpoint
rcall print
clr temp
ldi time, 0
loop:
in buttonstate, PINB
andi buttonstate, 0b00011000
cpi buttonstate, (0 << plus)|(1 << minus)
breq increment
cpi buttonstate, (1 << plus)|(0 << minus)
breq decrement
cpi buttonstate, 0x00
breq start
rjmp loop
start:
cpi setpoint, 0
breq error ;setpoint can't be zero
rcall EEPROMRead
in temp, EEDR
cp temp, setpoint
brne notequal
NewSetpointSaved:
mov time, setpoint
sbi DDRB, relay
softtimer:
rcall delay1s
dec time
mov p, time
rcall print
cpi time, 0
brne softtimer
cbi DDRB, relay
rcall delay1s
mov p, setpoint
rcall print
rjmp loop
error:
rjmp loop
notequal:
out EEDR, setpoint
rcall EEPROMWrite
rjmp NewSetpointSaved
increment:
rcall delay
sbrc buttonstate, plus
rjmp loop
inc setpoint
cpi setpoint, 99
brsh setpoint_maximum
maximum:
mov p, setpoint
rcall print
rcall delay
rjmp loop
setpoint_maximum:
ldi setpoint, 99
rjmp maximum
decrement:
rcall delay
sbrc buttonstate, minus
rjmp loop
dec setpoint
cpi setpoint, 1
brlo setpoint_minimum
minimum:
mov p, setpoint
rcall print
rcall delay
rjmp loop
setpoint_minimum:
ldi setpoint, 1
rjmp minimum
send: ;Software defined shift register
in temp, PORTB
andi temp, 0b00011000
clr i
cbi PORTB, cs
byte:
cbi PORTB, clock
bst data, 7
bld dataout, mosi
andi dataout, mask
or dataout, temp
out PORTB, dataout
sbi PORTB, clock
lsl data
inc i
cpi i, 8
brne byte
sbi PORTB, cs
ret
print: ;subroutine that prints data on 7-segmet indicators
add tableaddr, p
mov ZL, tableaddr
lpm
mov data, R0
rcall send
sub tableaddr, p
ret
delay:
ldi r27, 195
ldi r28, 205
Level1:
dec r28
brne Level1
dec r27
brne Level1
rjmp PC+1
ret
delay1s:
ldi r27, 6
ldi r28, 19
ldi r29, 174
Level2:
dec r29
brne Level2
dec r28
brne Level2
dec r27
brne Level2
rjmp PC+1
ret
EEPROMRead:
ldi temp, 0x00
out EEAR, temp
sbi EECR, EERE
WaitRead:
sbic EECR, EERE
rjmp WaitRead
ret
EEPROMWrite:
ldi temp, 0x00
out EEAR, temp
sbi EECR, EEMWE
sbi EECR, EEWE
WaitWrite:
sbic EECR, EEWE
rjmp WaitWrite
ret
|
oeis/031/A031371.asm | neoneye/loda-programs | 11 | 240940 | ; A031371: a(n) = prime(5n-1).
; Submitted by <NAME>
; 7,23,43,67,89,109,139,167,193,227,251,277,311,347,373,401,433,461,491,523,569,599,619,653,683,727,757,797,827,859,887,937,971,1009,1033,1063,1097,1129,1181,1217,1249,1289,1307,1367,1423,1447,1481,1499,1549,1579,1609,1637,1693,1723,1759,1801,1861,1879,1931,1979,2003,2039,2083,2113,2143,2207,2243,2281,2311,2351,2383,2417,2459,2521,2551,2609,2657,2683,2707,2731,2777,2803,2851,2897,2939,2971,3023,3067,3119,3169,3209,3253,3301,3329,3361,3407,3461,3499,3533,3559
mul $0,5
add $0,1
seq $0,173064 ; a(n) = prime(n) - 5.
add $0,5
|
dmg_resources/GeoMapApp-dmg-setup.scpt | iedadata/geomapapp | 0 | 3566 | <filename>dmg_resources/GeoMapApp-dmg-setup.scpt
tell application "Finder"
set theDisk to a reference to (disks whose URL = "file:///Users/Neville/eclipse-workspace/GeoMapApp/dmg_temp/images/GeoMapApp/")
open theDisk
set theWindow to a reference to (container window of disks whose URL = "file:///Users/Neville/eclipse-workspace/GeoMapApp/dmg_temp/images/GeoMapApp/")
set current view of theWindow to icon view
set toolbar visible of theWindow to false
set statusbar visible of theWindow to false
-- size of window should fit the size of background
set the bounds of theWindow to {400, 90, 1005, 440}
set theViewOptions to a reference to the icon view options of theWindow
set arrangement of theViewOptions to not arranged
set icon size of theViewOptions to 120
set background picture of theViewOptions to POSIX file "/Users/Neville/eclipse-workspace/GeoMapApp/dmg_temp/images/GeoMapApp/.background/background.tiff"
-- Create alias for install location
make new alias file at POSIX file "/Users/Neville/eclipse-workspace/GeoMapApp/dmg_temp/images/GeoMapApp" to POSIX file "/Applications" with properties {name:"/Applications"}
set allTheFiles to the name of every item of theWindow
repeat with theFile in allTheFiles
set theFilePath to POSIX path of theFile
if theFilePath is "/Applications" then
-- Position install location
set position of item theFile of theWindow to {510, 60}
else
-- Position application or runtime
set position of item theFile of theWindow to {100, 60}
end if
end repeat
update theDisk without registering applications
delay 5
close (get window of theDisk)
end tell
|
oeis/183/A183611.asm | neoneye/loda-programs | 11 | 11498 | ; A183611: E.g.f. satisfies: A'(x) = A(x)^2 + x*A(x)^3, with A(0) = 1.
; Submitted by <NAME>
; 1,1,3,14,91,756,7657,91504,1260441,19663280,342669691,6597811584,139094618467,3186675803584,78834061767825,2094418664339456,59474007876381553,1797637447068293376,57623116235327599411,1952522252421465088000,69732194206453592100651,2617993693566127814153216,103078950702268802744752633,4247166968532648566239002624,182767889749152471458663775625,8199478326799069722748535320576,382856123585597337673242346936107,18577224520950388453943489977647104,935414469256377693732889055295372211
mov $1,1
mov $2,1
mov $4,1
lpb $0
sub $0,1
add $1,1
mul $2,$0
add $3,$4
mov $4,$2
add $2,$3
mul $4,$1
lpe
mov $0,$2
|
Transynther/x86/_processed/US/_zr_/i9-9900K_12_0xa0_notsx.log_21829_834.asm | ljhsiun2/medusa | 9 | 24393 | <reponame>ljhsiun2/medusa
.global s_prepare_buffers
s_prepare_buffers:
push %r14
push %r15
push %rax
push %rbp
push %rbx
push %rcx
push %rdi
push %rsi
lea addresses_WT_ht+0x76f3, %rsi
lea addresses_D_ht+0x16824, %rdi
nop
nop
nop
xor %rbp, %rbp
mov $39, %rcx
rep movsw
nop
and $11074, %rbx
lea addresses_normal_ht+0x18024, %rbx
nop
nop
sub %r15, %r15
movups (%rbx), %xmm1
vpextrq $1, %xmm1, %rbp
nop
nop
nop
nop
nop
sub $34180, %rbx
lea addresses_D_ht+0x8424, %rsi
lea addresses_normal_ht+0x1eca4, %rdi
nop
add $26334, %rax
mov $118, %rcx
rep movsw
xor %r15, %r15
lea addresses_D_ht+0x19f24, %rsi
lfence
mov $0x6162636465666768, %rbp
movq %rbp, %xmm5
movups %xmm5, (%rsi)
nop
nop
nop
cmp $35590, %rax
lea addresses_WT_ht+0x8adb, %rsi
nop
nop
nop
nop
nop
cmp %rax, %rax
mov $0x6162636465666768, %rdi
movq %rdi, %xmm3
movups %xmm3, (%rsi)
nop
nop
nop
add %rax, %rax
lea addresses_D_ht+0x2724, %rsi
nop
nop
nop
nop
nop
cmp $51172, %rax
movb (%rsi), %r15b
nop
nop
nop
nop
nop
add %rdi, %rdi
lea addresses_normal_ht+0x14e4, %r15
clflush (%r15)
cmp %rsi, %rsi
mov $0x6162636465666768, %rax
movq %rax, %xmm3
vmovups %ymm3, (%r15)
dec %rbp
lea addresses_UC_ht+0x163a4, %rcx
nop
nop
cmp $4437, %rdi
mov (%rcx), %r15d
nop
nop
cmp %rcx, %rcx
lea addresses_normal_ht+0x9e22, %rbx
nop
nop
nop
nop
xor %rcx, %rcx
mov $0x6162636465666768, %rsi
movq %rsi, %xmm7
and $0xffffffffffffffc0, %rbx
movntdq %xmm7, (%rbx)
nop
nop
sub $51237, %r15
lea addresses_WC_ht+0x16824, %rdi
add $9696, %r15
mov (%rdi), %eax
nop
nop
nop
nop
cmp %rsi, %rsi
lea addresses_normal_ht+0x5a24, %rsi
lea addresses_normal_ht+0x2424, %rdi
clflush (%rdi)
nop
nop
nop
nop
nop
sub $54630, %r14
mov $92, %rcx
rep movsl
nop
nop
nop
nop
add %rbx, %rbx
lea addresses_UC_ht+0x15624, %rsi
lea addresses_normal_ht+0x7d24, %rdi
and $62382, %rbx
mov $25, %rcx
rep movsq
add %rsi, %rsi
pop %rsi
pop %rdi
pop %rcx
pop %rbx
pop %rbp
pop %rax
pop %r15
pop %r14
ret
.global s_faulty_load
s_faulty_load:
push %r11
push %r12
push %r14
push %r15
push %r8
push %r9
push %rcx
// Store
lea addresses_UC+0xc600, %r15
nop
nop
nop
add %r11, %r11
mov $0x5152535455565758, %rcx
movq %rcx, (%r15)
nop
cmp %r15, %r15
// Load
lea addresses_WC+0xa2c4, %r12
clflush (%r12)
cmp $31772, %r14
mov (%r12), %r8
nop
nop
nop
nop
nop
sub $41436, %rcx
// Store
lea addresses_RW+0x18024, %r11
nop
dec %r15
mov $0x5152535455565758, %r9
movq %r9, (%r11)
nop
nop
nop
nop
dec %r15
// Store
lea addresses_D+0x7324, %r12
nop
xor $45485, %r15
mov $0x5152535455565758, %r14
movq %r14, %xmm5
movntdq %xmm5, (%r12)
nop
nop
nop
and $14508, %rcx
// Load
lea addresses_D+0x19b24, %r14
nop
nop
nop
nop
nop
cmp $21777, %r11
mov (%r14), %r8w
nop
nop
add %rcx, %rcx
// Store
lea addresses_normal+0x16a24, %r11
nop
nop
add $4731, %rcx
mov $0x5152535455565758, %r15
movq %r15, (%r11)
nop
add %r14, %r14
// Store
lea addresses_WC+0x19b2b, %r8
nop
nop
nop
nop
cmp %r12, %r12
mov $0x5152535455565758, %rcx
movq %rcx, %xmm7
movups %xmm7, (%r8)
nop
nop
nop
nop
xor %r15, %r15
// Store
lea addresses_PSE+0x11c50, %rcx
nop
nop
xor %r8, %r8
movw $0x5152, (%rcx)
inc %r14
// Load
lea addresses_WC+0x12997, %r12
nop
nop
cmp %r11, %r11
movups (%r12), %xmm6
vpextrq $1, %xmm6, %r14
nop
nop
add $65463, %r11
// Faulty Load
lea addresses_US+0xc424, %r15
cmp %r14, %r14
mov (%r15), %r12
lea oracles, %r9
and $0xff, %r12
shlq $12, %r12
mov (%r9,%r12,1), %r12
pop %rcx
pop %r9
pop %r8
pop %r15
pop %r14
pop %r12
pop %r11
ret
/*
<gen_faulty_load>
[REF]
{'src': {'type': 'addresses_US', 'AVXalign': True, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 2}}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 5}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 10}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 6}}
{'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
{'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 1}}
{'src': {'type': 'addresses_WC', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'}
[Faulty Load]
{'src': {'type': 'addresses_US', 'AVXalign': False, 'size': 8, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'}
<gen_prepare_buffer>
{'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}}
{'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_D_ht', 'congruent': 10, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 3, 'same': False}}
{'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}}
{'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 1, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 3}}
{'src': {'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 4, 'NT': True, 'same': False, 'congruent': 7}, 'OP': 'LOAD'}
{'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': True, 'same': False, 'congruent': 0}}
{'src': {'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 4, 'NT': False, 'same': False, 'congruent': 4}, 'OP': 'LOAD'}
{'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 11, 'same': True}}
{'src': {'type': 'addresses_UC_ht', 'congruent': 9, 'same': False}, 'OP': 'REPM', 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}}
{'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
*/
|
target/cos_117/disasm/iop_overlay1/COMM08.asm | jrrk2/cray-sim | 49 | 168395 | 0x0000 (0x000000) 0x7005- f:00070 d: 5 | P = P + 5 (0x0005)
0x0001 (0x000002) 0x0017- f:00000 d: 23 | PASS | **** non-standard encoding with D:0x0017 ****
0x0002 (0x000004) 0x003F- f:00000 d: 63 | PASS | **** non-standard encoding with D:0x003F ****
0x0003 (0x000006) 0x00C7- f:00000 d: 199 | PASS | **** non-standard encoding with D:0x00C7 ****
0x0004 (0x000008) 0x00DE- f:00000 d: 222 | PASS | **** non-standard encoding with D:0x00DE ****
0x0005 (0x00000A) 0x1003- f:00010 d: 3 | A = 3 (0x0003)
0x0006 (0x00000C) 0x2718- f:00023 d: 280 | A = A - OR[280]
0x0007 (0x00000E) 0x800A- f:00100 d: 10 | P = P + 10 (0x0011), C = 0
0x0008 (0x000010) 0x2118- f:00020 d: 280 | A = OR[280]
0x0009 (0x000012) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x000A (0x000014) 0x1C00-0x0007 f:00016 d: 0 | A = A + 7 (0x0007)
0x000C (0x000018) 0x290D- f:00024 d: 269 | OR[269] = A
0x000D (0x00001A) 0x310D- f:00030 d: 269 | A = (OR[269])
0x000E (0x00001C) 0x2403- f:00022 d: 3 | A = A + OR[3]
0x000F (0x00001E) 0x290D- f:00024 d: 269 | OR[269] = A
0x0010 (0x000020) 0x790D- f:00074 d: 269 | P = OR[269]
0x0011 (0x000022) 0x1800-0x0114 f:00014 d: 0 | A = 276 (0x0114)
0x0013 (0x000026) 0x291F- f:00024 d: 287 | OR[287] = A
0x0014 (0x000028) 0x7586- f:00072 d: 390 | R = P + 390 (0x019A)
0x0015 (0x00002A) 0x2120- f:00020 d: 288 | A = OR[288]
0x0016 (0x00002C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0017 (0x00002E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0018 (0x000030) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0019 (0x000032) 0x2924- f:00024 d: 292 | OR[292] = A
0x001A (0x000034) 0x2120- f:00020 d: 288 | A = OR[288]
0x001B (0x000036) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x001C (0x000038) 0x2908- f:00024 d: 264 | OR[264] = A
0x001D (0x00003A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x001E (0x00003C) 0x2925- f:00024 d: 293 | OR[293] = A
0x001F (0x00003E) 0x75B6- f:00072 d: 438 | R = P + 438 (0x01D5)
0x0020 (0x000040) 0x2120- f:00020 d: 288 | A = OR[288]
0x0021 (0x000042) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0022 (0x000044) 0x2908- f:00024 d: 264 | OR[264] = A
0x0023 (0x000046) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0024 (0x000048) 0x2923- f:00024 d: 291 | OR[291] = A
0x0025 (0x00004A) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x0027 (0x00004E) 0x2123- f:00020 d: 291 | A = OR[291]
0x0028 (0x000050) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0029 (0x000052) 0x2923- f:00024 d: 291 | OR[291] = A
0x002A (0x000054) 0x2121- f:00020 d: 289 | A = OR[289]
0x002B (0x000056) 0x140F- f:00012 d: 15 | A = A + 15 (0x000F)
0x002C (0x000058) 0x2908- f:00024 d: 264 | OR[264] = A
0x002D (0x00005A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x002E (0x00005C) 0x1A00-0xFFFE f:00015 d: 0 | A = A & 65534 (0xFFFE)
0x0030 (0x000060) 0x2523- f:00022 d: 291 | A = A + OR[291]
0x0031 (0x000062) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0032 (0x000064) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x0033 (0x000066) 0x2913- f:00024 d: 275 | OR[275] = A
0x0034 (0x000068) 0x75A8- f:00072 d: 424 | R = P + 424 (0x01DC)
0x0035 (0x00006A) 0x1800-0x434C f:00014 d: 0 | A = 17228 (0x434C)
0x0037 (0x00006E) 0x291E- f:00024 d: 286 | OR[286] = A
0x0038 (0x000070) 0x7115- f:00070 d: 277 | P = P + 277 (0x014D)
0x0039 (0x000072) 0x1800-0x0228 f:00014 d: 0 | A = 552 (0x0228)
0x003B (0x000076) 0x291F- f:00024 d: 287 | OR[287] = A
0x003C (0x000078) 0x755E- f:00072 d: 350 | R = P + 350 (0x019A)
0x003D (0x00007A) 0x2120- f:00020 d: 288 | A = OR[288]
0x003E (0x00007C) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x003F (0x00007E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0040 (0x000080) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0041 (0x000082) 0x2923- f:00024 d: 291 | OR[291] = A
0x0042 (0x000084) 0x7593- f:00072 d: 403 | R = P + 403 (0x01D5)
0x0043 (0x000086) 0x2120- f:00020 d: 288 | A = OR[288]
0x0044 (0x000088) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0045 (0x00008A) 0x2908- f:00024 d: 264 | OR[264] = A
0x0046 (0x00008C) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0047 (0x00008E) 0x291E- f:00024 d: 286 | OR[286] = A
0x0048 (0x000090) 0x758D- f:00072 d: 397 | R = P + 397 (0x01D5)
0x0049 (0x000092) 0x211E- f:00020 d: 286 | A = OR[286]
0x004A (0x000094) 0x1E00-0x4A43 f:00017 d: 0 | A = A - 19011 (0x4A43)
0x004C (0x000098) 0x8402- f:00102 d: 2 | P = P + 2 (0x004E), A = 0
0x004D (0x00009A) 0x7011- f:00070 d: 17 | P = P + 17 (0x005E)
0x004E (0x00009C) 0x2120- f:00020 d: 288 | A = OR[288]
0x004F (0x00009E) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0050 (0x0000A0) 0x2908- f:00024 d: 264 | OR[264] = A
0x0051 (0x0000A2) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0052 (0x0000A4) 0x2924- f:00024 d: 292 | OR[292] = A
0x0053 (0x0000A6) 0x2120- f:00020 d: 288 | A = OR[288]
0x0054 (0x0000A8) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0055 (0x0000AA) 0x2908- f:00024 d: 264 | OR[264] = A
0x0056 (0x0000AC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0057 (0x0000AE) 0x2925- f:00024 d: 293 | OR[293] = A
0x0058 (0x0000B0) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x005A (0x0000B4) 0x1018- f:00010 d: 24 | A = 24 (0x0018)
0x005B (0x0000B6) 0x2913- f:00024 d: 275 | OR[275] = A
0x005C (0x0000B8) 0x7580- f:00072 d: 384 | R = P + 384 (0x01DC)
0x005D (0x0000BA) 0x705E- f:00070 d: 94 | P = P + 94 (0x00BB)
0x005E (0x0000BC) 0x211E- f:00020 d: 286 | A = OR[286]
0x005F (0x0000BE) 0x1E00-0x4349 f:00017 d: 0 | A = A - 17225 (0x4349)
0x0061 (0x0000C2) 0x8402- f:00102 d: 2 | P = P + 2 (0x0063), A = 0
0x0062 (0x0000C4) 0x7025- f:00070 d: 37 | P = P + 37 (0x0087)
0x0063 (0x0000C6) 0x2120- f:00020 d: 288 | A = OR[288]
0x0064 (0x0000C8) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0065 (0x0000CA) 0x2908- f:00024 d: 264 | OR[264] = A
0x0066 (0x0000CC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0067 (0x0000CE) 0x2926- f:00024 d: 294 | OR[294] = A
0x0068 (0x0000D0) 0x756D- f:00072 d: 365 | R = P + 365 (0x01D5)
0x0069 (0x0000D2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x006A (0x0000D4) 0x2925- f:00024 d: 293 | OR[293] = A
0x006B (0x0000D6) 0x3120- f:00030 d: 288 | A = (OR[288])
0x006C (0x0000D8) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x006D (0x0000DA) 0x2913- f:00024 d: 275 | OR[275] = A
0x006E (0x0000DC) 0x2113- f:00020 d: 275 | A = OR[275]
0x006F (0x0000DE) 0x160C- f:00013 d: 12 | A = A - 12 (0x000C)
0x0070 (0x0000E0) 0x8602- f:00103 d: 2 | P = P + 2 (0x0072), A # 0
0x0071 (0x0000E2) 0x700B- f:00070 d: 11 | P = P + 11 (0x007C)
0x0072 (0x0000E4) 0x2120- f:00020 d: 288 | A = OR[288]
0x0073 (0x0000E6) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0074 (0x0000E8) 0x2908- f:00024 d: 264 | OR[264] = A
0x0075 (0x0000EA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0076 (0x0000EC) 0x2924- f:00024 d: 292 | OR[292] = A
0x0077 (0x0000EE) 0x2120- f:00020 d: 288 | A = OR[288]
0x0078 (0x0000F0) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0079 (0x0000F2) 0x2908- f:00024 d: 264 | OR[264] = A
0x007A (0x0000F4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x007B (0x0000F6) 0x2925- f:00024 d: 293 | OR[293] = A
0x007C (0x0000F8) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x007E (0x0000FC) 0x2121- f:00020 d: 289 | A = OR[289]
0x007F (0x0000FE) 0x141B- f:00012 d: 27 | A = A + 27 (0x001B)
0x0080 (0x000100) 0x2908- f:00024 d: 264 | OR[264] = A
0x0081 (0x000102) 0x2126- f:00020 d: 294 | A = OR[294]
0x0082 (0x000104) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0083 (0x000106) 0x1038- f:00010 d: 56 | A = 56 (0x0038)
0x0084 (0x000108) 0x2913- f:00024 d: 275 | OR[275] = A
0x0085 (0x00010A) 0x7557- f:00072 d: 343 | R = P + 343 (0x01DC)
0x0086 (0x00010C) 0x7035- f:00070 d: 53 | P = P + 53 (0x00BB)
0x0087 (0x00010E) 0x211E- f:00020 d: 286 | A = OR[286]
0x0088 (0x000110) 0x1E00-0x4350 f:00017 d: 0 | A = A - 17232 (0x4350)
0x008A (0x000114) 0x8402- f:00102 d: 2 | P = P + 2 (0x008C), A = 0
0x008B (0x000116) 0x7014- f:00070 d: 20 | P = P + 20 (0x009F)
0x008C (0x000118) 0x2120- f:00020 d: 288 | A = OR[288]
0x008D (0x00011A) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x008E (0x00011C) 0x2908- f:00024 d: 264 | OR[264] = A
0x008F (0x00011E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0090 (0x000120) 0x2924- f:00024 d: 292 | OR[292] = A
0x0091 (0x000122) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x0093 (0x000126) 0x2124- f:00020 d: 292 | A = OR[292]
0x0094 (0x000128) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x0095 (0x00012A) 0x2924- f:00024 d: 292 | OR[292] = A
0x0096 (0x00012C) 0x2121- f:00020 d: 289 | A = OR[289]
0x0097 (0x00012E) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x0098 (0x000130) 0x2908- f:00024 d: 264 | OR[264] = A
0x0099 (0x000132) 0x3108- f:00030 d: 264 | A = (OR[264])
0x009A (0x000134) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x009B (0x000136) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x009C (0x000138) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x009D (0x00013A) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x009E (0x00013C) 0x701D- f:00070 d: 29 | P = P + 29 (0x00BB)
0x009F (0x00013E) 0x2120- f:00020 d: 288 | A = OR[288]
0x00A0 (0x000140) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00A1 (0x000142) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A2 (0x000144) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00A3 (0x000146) 0x2924- f:00024 d: 292 | OR[292] = A
0x00A4 (0x000148) 0x2120- f:00020 d: 288 | A = OR[288]
0x00A5 (0x00014A) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x00A6 (0x00014C) 0x2908- f:00024 d: 264 | OR[264] = A
0x00A7 (0x00014E) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00A8 (0x000150) 0x2925- f:00024 d: 293 | OR[293] = A
0x00A9 (0x000152) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x00AB (0x000156) 0x2124- f:00020 d: 292 | A = OR[292]
0x00AC (0x000158) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x00AD (0x00015A) 0x2924- f:00024 d: 292 | OR[292] = A
0x00AE (0x00015C) 0x2121- f:00020 d: 289 | A = OR[289]
0x00AF (0x00015E) 0x140A- f:00012 d: 10 | A = A + 10 (0x000A)
0x00B0 (0x000160) 0x2908- f:00024 d: 264 | OR[264] = A
0x00B1 (0x000162) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00B2 (0x000164) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x00B4 (0x000168) 0x2524- f:00022 d: 292 | A = A + OR[292]
0x00B5 (0x00016A) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00B6 (0x00016C) 0x2121- f:00020 d: 289 | A = OR[289]
0x00B7 (0x00016E) 0x140B- f:00012 d: 11 | A = A + 11 (0x000B)
0x00B8 (0x000170) 0x2908- f:00024 d: 264 | OR[264] = A
0x00B9 (0x000172) 0x2125- f:00020 d: 293 | A = OR[293]
0x00BA (0x000174) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00BB (0x000176) 0x2121- f:00020 d: 289 | A = OR[289]
0x00BC (0x000178) 0x1407- f:00012 d: 7 | A = A + 7 (0x0007)
0x00BD (0x00017A) 0x2908- f:00024 d: 264 | OR[264] = A
0x00BE (0x00017C) 0x2123- f:00020 d: 291 | A = OR[291]
0x00BF (0x00017E) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x00C0 (0x000180) 0x708D- f:00070 d: 141 | P = P + 141 (0x014D)
0x00C1 (0x000182) 0x1800-0x02BC f:00014 d: 0 | A = 700 (0x02BC)
0x00C3 (0x000186) 0x291F- f:00024 d: 287 | OR[287] = A
0x00C4 (0x000188) 0x74D6- f:00072 d: 214 | R = P + 214 (0x019A)
0x00C5 (0x00018A) 0x2120- f:00020 d: 288 | A = OR[288]
0x00C6 (0x00018C) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00C7 (0x00018E) 0x2908- f:00024 d: 264 | OR[264] = A
0x00C8 (0x000190) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00C9 (0x000192) 0x2924- f:00024 d: 292 | OR[292] = A
0x00CA (0x000194) 0x2120- f:00020 d: 288 | A = OR[288]
0x00CB (0x000196) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x00CC (0x000198) 0x2908- f:00024 d: 264 | OR[264] = A
0x00CD (0x00019A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00CE (0x00019C) 0x2925- f:00024 d: 293 | OR[293] = A
0x00CF (0x00019E) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x00D1 (0x0001A2) 0x1048- f:00010 d: 72 | A = 72 (0x0048)
0x00D2 (0x0001A4) 0x2913- f:00024 d: 275 | OR[275] = A
0x00D3 (0x0001A6) 0x7509- f:00072 d: 265 | R = P + 265 (0x01DC)
0x00D4 (0x0001A8) 0x1800-0x464C f:00014 d: 0 | A = 17996 (0x464C)
0x00D6 (0x0001AC) 0x291E- f:00024 d: 286 | OR[286] = A
0x00D7 (0x0001AE) 0x7076- f:00070 d: 118 | P = P + 118 (0x014D)
0x00D8 (0x0001B0) 0x1800-0x03E8 f:00014 d: 0 | A = 1000 (0x03E8)
0x00DA (0x0001B4) 0x291F- f:00024 d: 287 | OR[287] = A
0x00DB (0x0001B6) 0x74BF- f:00072 d: 191 | R = P + 191 (0x019A)
0x00DC (0x0001B8) 0x3120- f:00030 d: 288 | A = (OR[288])
0x00DD (0x0001BA) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x00DE (0x0001BC) 0x2913- f:00024 d: 275 | OR[275] = A
0x00DF (0x0001BE) 0x2113- f:00020 d: 275 | A = OR[275]
0x00E0 (0x0001C0) 0x160C- f:00013 d: 12 | A = A - 12 (0x000C)
0x00E1 (0x0001C2) 0x8402- f:00102 d: 2 | P = P + 2 (0x00E3), A = 0
0x00E2 (0x0001C4) 0x7007- f:00070 d: 7 | P = P + 7 (0x00E9)
0x00E3 (0x0001C6) 0x2100- f:00020 d: 256 | A = OR[256]
0x00E4 (0x0001C8) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x00E5 (0x0001CA) 0x2908- f:00024 d: 264 | OR[264] = A
0x00E6 (0x0001CC) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00E7 (0x0001CE) 0x2922- f:00024 d: 290 | OR[290] = A
0x00E8 (0x0001D0) 0x7006- f:00070 d: 6 | P = P + 6 (0x00EE)
0x00E9 (0x0001D2) 0x2120- f:00020 d: 288 | A = OR[288]
0x00EA (0x0001D4) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00EB (0x0001D6) 0x2908- f:00024 d: 264 | OR[264] = A
0x00EC (0x0001D8) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00ED (0x0001DA) 0x2922- f:00024 d: 290 | OR[290] = A
0x00EE (0x0001DC) 0x74E7- f:00072 d: 231 | R = P + 231 (0x01D5)
0x00EF (0x0001DE) 0x3120- f:00030 d: 288 | A = (OR[288])
0x00F0 (0x0001E0) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x00F1 (0x0001E2) 0x2917- f:00024 d: 279 | OR[279] = A
0x00F2 (0x0001E4) 0x2120- f:00020 d: 288 | A = OR[288]
0x00F3 (0x0001E6) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00F4 (0x0001E8) 0x2908- f:00024 d: 264 | OR[264] = A
0x00F5 (0x0001EA) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00F6 (0x0001EC) 0x2924- f:00024 d: 292 | OR[292] = A
0x00F7 (0x0001EE) 0x2120- f:00020 d: 288 | A = OR[288]
0x00F8 (0x0001F0) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x00F9 (0x0001F2) 0x2908- f:00024 d: 264 | OR[264] = A
0x00FA (0x0001F4) 0x3108- f:00030 d: 264 | A = (OR[264])
0x00FB (0x0001F6) 0x2925- f:00024 d: 293 | OR[293] = A
0x00FC (0x0001F8) 0x74D9- f:00072 d: 217 | R = P + 217 (0x01D5)
0x00FD (0x0001FA) 0x2120- f:00020 d: 288 | A = OR[288]
0x00FE (0x0001FC) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x00FF (0x0001FE) 0x2908- f:00024 d: 264 | OR[264] = A
0x0100 (0x000200) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0101 (0x000202) 0x2926- f:00024 d: 294 | OR[294] = A
0x0102 (0x000204) 0x2120- f:00020 d: 288 | A = OR[288]
0x0103 (0x000206) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0104 (0x000208) 0x2908- f:00024 d: 264 | OR[264] = A
0x0105 (0x00020A) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0106 (0x00020C) 0x2927- f:00024 d: 295 | OR[295] = A
0x0107 (0x00020E) 0x74CE- f:00072 d: 206 | R = P + 206 (0x01D5)
0x0108 (0x000210) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0109 (0x000212) 0x2929- f:00024 d: 297 | OR[297] = A
0x010A (0x000214) 0x3120- f:00030 d: 288 | A = (OR[288])
0x010B (0x000216) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x010C (0x000218) 0x2913- f:00024 d: 275 | OR[275] = A
0x010D (0x00021A) 0x2113- f:00020 d: 275 | A = OR[275]
0x010E (0x00021C) 0x160C- f:00013 d: 12 | A = A - 12 (0x000C)
0x010F (0x00021E) 0x8602- f:00103 d: 2 | P = P + 2 (0x0111), A # 0
0x0110 (0x000220) 0x700B- f:00070 d: 11 | P = P + 11 (0x011B)
0x0111 (0x000222) 0x2120- f:00020 d: 288 | A = OR[288]
0x0112 (0x000224) 0x1401- f:00012 d: 1 | A = A + 1 (0x0001)
0x0113 (0x000226) 0x2908- f:00024 d: 264 | OR[264] = A
0x0114 (0x000228) 0x3108- f:00030 d: 264 | A = (OR[264])
0x0115 (0x00022A) 0x2928- f:00024 d: 296 | OR[296] = A
0x0116 (0x00022C) 0x2120- f:00020 d: 288 | A = OR[288]
0x0117 (0x00022E) 0x1402- f:00012 d: 2 | A = A + 2 (0x0002)
0x0118 (0x000230) 0x2908- f:00024 d: 264 | OR[264] = A
0x0119 (0x000232) 0x3108- f:00030 d: 264 | A = (OR[264])
0x011A (0x000234) 0x2929- f:00024 d: 297 | OR[297] = A
0x011B (0x000236) 0x7E03-0x021B f:00077 d: 3 | R = OR[3]+539 (0x021B)
0x011D (0x00023A) 0x2121- f:00020 d: 289 | A = OR[289]
0x011E (0x00023C) 0x141B- f:00012 d: 27 | A = A + 27 (0x001B)
0x011F (0x00023E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0120 (0x000240) 0x2122- f:00020 d: 290 | A = OR[290]
0x0121 (0x000242) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0122 (0x000244) 0x2117- f:00020 d: 279 | A = OR[279]
0x0123 (0x000246) 0x160C- f:00013 d: 12 | A = A - 12 (0x000C)
0x0124 (0x000248) 0x8402- f:00102 d: 2 | P = P + 2 (0x0126), A = 0
0x0125 (0x00024A) 0x7013- f:00070 d: 19 | P = P + 19 (0x0138)
0x0126 (0x00024C) 0x2100- f:00020 d: 256 | A = OR[256]
0x0127 (0x00024E) 0x1405- f:00012 d: 5 | A = A + 5 (0x0005)
0x0128 (0x000250) 0x290D- f:00024 d: 269 | OR[269] = A
0x0129 (0x000252) 0x1038- f:00010 d: 56 | A = 56 (0x0038)
0x012A (0x000254) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x012B (0x000256) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x012C (0x000258) 0x290E- f:00024 d: 270 | OR[270] = A
0x012D (0x00025A) 0x1004- f:00010 d: 4 | A = 4 (0x0004)
0x012E (0x00025C) 0x290F- f:00024 d: 271 | OR[271] = A
0x012F (0x00025E) 0x7006- f:00070 d: 6 | P = P + 6 (0x0135)
0x0130 (0x000260) 0x310D- f:00030 d: 269 | A = (OR[269])
0x0131 (0x000262) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0132 (0x000264) 0x2D0D- f:00026 d: 269 | OR[269] = OR[269] + 1
0x0133 (0x000266) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x0134 (0x000268) 0x2F0F- f:00027 d: 271 | OR[271] = OR[271] - 1
0x0135 (0x00026A) 0x210F- f:00020 d: 271 | A = OR[271]
0x0136 (0x00026C) 0x8E06- f:00107 d: 6 | P = P - 6 (0x0130), A # 0
0x0137 (0x00026E) 0x7004- f:00070 d: 4 | P = P + 4 (0x013B)
0x0138 (0x000270) 0x1038- f:00010 d: 56 | A = 56 (0x0038)
0x0139 (0x000272) 0x2913- f:00024 d: 275 | OR[275] = A
0x013A (0x000274) 0x74A2- f:00072 d: 162 | R = P + 162 (0x01DC)
0x013B (0x000276) 0x2126- f:00020 d: 294 | A = OR[294]
0x013C (0x000278) 0x2924- f:00024 d: 292 | OR[292] = A
0x013D (0x00027A) 0x2127- f:00020 d: 295 | A = OR[295]
0x013E (0x00027C) 0x2925- f:00024 d: 293 | OR[293] = A
0x013F (0x00027E) 0x1050- f:00010 d: 80 | A = 80 (0x0050)
0x0140 (0x000280) 0x2913- f:00024 d: 275 | OR[275] = A
0x0141 (0x000282) 0x749B- f:00072 d: 155 | R = P + 155 (0x01DC)
0x0142 (0x000284) 0x2128- f:00020 d: 296 | A = OR[296]
0x0143 (0x000286) 0x2924- f:00024 d: 292 | OR[292] = A
0x0144 (0x000288) 0x2129- f:00020 d: 297 | A = OR[297]
0x0145 (0x00028A) 0x2925- f:00024 d: 293 | OR[293] = A
0x0146 (0x00028C) 0x1058- f:00010 d: 88 | A = 88 (0x0058)
0x0147 (0x00028E) 0x2913- f:00024 d: 275 | OR[275] = A
0x0148 (0x000290) 0x7494- f:00072 d: 148 | R = P + 148 (0x01DC)
0x0149 (0x000292) 0x1800-0x4F50 f:00014 d: 0 | A = 20304 (0x4F50)
0x014B (0x000296) 0x291E- f:00024 d: 286 | OR[286] = A
0x014C (0x000298) 0x7001- f:00070 d: 1 | P = P + 1 (0x014D)
0x014D (0x00029A) 0x2121- f:00020 d: 289 | A = OR[289]
0x014E (0x00029C) 0x1404- f:00012 d: 4 | A = A + 4 (0x0004)
0x014F (0x00029E) 0x2908- f:00024 d: 264 | OR[264] = A
0x0150 (0x0002A0) 0x211E- f:00020 d: 286 | A = OR[286]
0x0151 (0x0002A2) 0x3908- f:00034 d: 264 | (OR[264]) = A
0x0152 (0x0002A4) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0153 (0x0002A6) 0x292A- f:00024 d: 298 | OR[298] = A
0x0154 (0x0002A8) 0x1800-0x015A f:00014 d: 0 | A = 346 (0x015A)
0x0156 (0x0002AC) 0x292B- f:00024 d: 299 | OR[299] = A
0x0157 (0x0002AE) 0x1800-0x01C5 f:00014 d: 0 | A = 453 (0x01C5)
0x0159 (0x0002B2) 0x292C- f:00024 d: 300 | OR[300] = A
0x015A (0x0002B4) 0x2121- f:00020 d: 289 | A = OR[289]
0x015B (0x0002B6) 0x292D- f:00024 d: 301 | OR[301] = A
0x015C (0x0002B8) 0x1800-0x0340 f:00014 d: 0 | A = 832 (0x0340)
0x015E (0x0002BC) 0x292E- f:00024 d: 302 | OR[302] = A
0x015F (0x0002BE) 0x1800-0x0242 f:00014 d: 0 | A = 578 (0x0242)
0x0161 (0x0002C2) 0x292F- f:00024 d: 303 | OR[303] = A
0x0162 (0x0002C4) 0x1800-0x0001 f:00014 d: 0 | A = 1 (0x0001)
0x0164 (0x0002C8) 0x2930- f:00024 d: 304 | OR[304] = A
0x0165 (0x0002CA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0166 (0x0002CC) 0x2931- f:00024 d: 305 | OR[305] = A
0x0167 (0x0002CE) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0168 (0x0002D0) 0x2932- f:00024 d: 306 | OR[306] = A
0x0169 (0x0002D2) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x016A (0x0002D4) 0x2933- f:00024 d: 307 | OR[307] = A
0x016B (0x0002D6) 0x112A- f:00010 d: 298 | A = 298 (0x012A)
0x016C (0x0002D8) 0x5800- f:00054 d: 0 | B = A
0x016D (0x0002DA) 0x1800-0x2518 f:00014 d: 0 | A = 9496 (0x2518)
0x016F (0x0002DE) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0170 (0x0002E0) 0x2913- f:00024 d: 275 | OR[275] = A
0x0171 (0x0002E2) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1
0x0172 (0x0002E4) 0x3104- f:00030 d: 260 | A = (OR[260])
0x0173 (0x0002E6) 0x2904- f:00024 d: 260 | OR[260] = A
0x0174 (0x0002E8) 0x2104- f:00020 d: 260 | A = OR[260]
0x0175 (0x0002EA) 0x2706- f:00023 d: 262 | A = A - OR[262]
0x0176 (0x0002EC) 0x8007- f:00100 d: 7 | P = P + 7 (0x017D), C = 0
0x0177 (0x0002EE) 0x2104- f:00020 d: 260 | A = OR[260]
0x0178 (0x0002F0) 0x2705- f:00023 d: 261 | A = A - OR[261]
0x0179 (0x0002F2) 0x8003- f:00100 d: 3 | P = P + 3 (0x017C), C = 0
0x017A (0x0002F4) 0x8402- f:00102 d: 2 | P = P + 2 (0x017C), A = 0
0x017B (0x0002F6) 0x7002- f:00070 d: 2 | P = P + 2 (0x017D)
0x017C (0x0002F8) 0x7003- f:00070 d: 3 | P = P + 3 (0x017F)
0x017D (0x0002FA) 0x7C34- f:00076 d: 52 | R = OR[52]
0x017E (0x0002FC) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B ****
0x017F (0x0002FE) 0x2113- f:00020 d: 275 | A = OR[275]
0x0180 (0x000300) 0x8602- f:00103 d: 2 | P = P + 2 (0x0182), A # 0
0x0181 (0x000302) 0x7013- f:00070 d: 19 | P = P + 19 (0x0194)
0x0182 (0x000304) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x0183 (0x000306) 0x292A- f:00024 d: 298 | OR[298] = A
0x0184 (0x000308) 0x1800-0x0137 f:00014 d: 0 | A = 311 (0x0137)
0x0186 (0x00030C) 0x292B- f:00024 d: 299 | OR[299] = A
0x0187 (0x00030E) 0x2113- f:00020 d: 275 | A = OR[275]
0x0188 (0x000310) 0x292C- f:00024 d: 300 | OR[300] = A
0x0189 (0x000312) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x018A (0x000314) 0x292D- f:00024 d: 301 | OR[301] = A
0x018B (0x000316) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x018C (0x000318) 0x292E- f:00024 d: 302 | OR[302] = A
0x018D (0x00031A) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x018E (0x00031C) 0x292F- f:00024 d: 303 | OR[303] = A
0x018F (0x00031E) 0x112A- f:00010 d: 298 | A = 298 (0x012A)
0x0190 (0x000320) 0x5800- f:00054 d: 0 | B = A
0x0191 (0x000322) 0x1800-0x2518 f:00014 d: 0 | A = 9496 (0x2518)
0x0193 (0x000326) 0x7C09- f:00076 d: 9 | R = OR[9]
0x0194 (0x000328) 0x102A- f:00010 d: 42 | A = 42 (0x002A)
0x0195 (0x00032A) 0x292A- f:00024 d: 298 | OR[298] = A
0x0196 (0x00032C) 0x112A- f:00010 d: 298 | A = 298 (0x012A)
0x0197 (0x00032E) 0x5800- f:00054 d: 0 | B = A
0x0198 (0x000330) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0199 (0x000332) 0x7C09- f:00076 d: 9 | R = OR[9]
0x019A (0x000334) 0x2104- f:00020 d: 260 | A = OR[260]
0x019B (0x000336) 0x290D- f:00024 d: 269 | OR[269] = A
0x019C (0x000338) 0x2104- f:00020 d: 260 | A = OR[260]
0x019D (0x00033A) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x019E (0x00033C) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC)
0x01A0 (0x000340) 0x2904- f:00024 d: 260 | OR[260] = A
0x01A1 (0x000342) 0x2104- f:00020 d: 260 | A = OR[260]
0x01A2 (0x000344) 0x2920- f:00024 d: 288 | OR[288] = A
0x01A3 (0x000346) 0x1014- f:00010 d: 20 | A = 20 (0x0014)
0x01A4 (0x000348) 0x2B04- f:00025 d: 260 | OR[260] = A + OR[260]
0x01A5 (0x00034A) 0x2104- f:00020 d: 260 | A = OR[260]
0x01A6 (0x00034C) 0x2705- f:00023 d: 261 | A = A - OR[261]
0x01A7 (0x00034E) 0xB234- f:00131 d: 52 | R = OR[52], C = 1
0x01A8 (0x000350) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B ****
0x01A9 (0x000352) 0x210D- f:00020 d: 269 | A = OR[269]
0x01AA (0x000354) 0x3904- f:00034 d: 260 | (OR[260]) = A
0x01AB (0x000356) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1
0x01AC (0x000358) 0x1028- f:00010 d: 40 | A = 40 (0x0028)
0x01AD (0x00035A) 0x292A- f:00024 d: 298 | OR[298] = A
0x01AE (0x00035C) 0x1800-0x012A f:00014 d: 0 | A = 298 (0x012A)
0x01B0 (0x000360) 0x292B- f:00024 d: 299 | OR[299] = A
0x01B1 (0x000362) 0x2119- f:00020 d: 281 | A = OR[281]
0x01B2 (0x000364) 0x292C- f:00024 d: 300 | OR[300] = A
0x01B3 (0x000366) 0x211C- f:00020 d: 284 | A = OR[284]
0x01B4 (0x000368) 0x292D- f:00024 d: 301 | OR[301] = A
0x01B5 (0x00036A) 0x211D- f:00020 d: 285 | A = OR[285]
0x01B6 (0x00036C) 0x292E- f:00024 d: 302 | OR[302] = A
0x01B7 (0x00036E) 0x211F- f:00020 d: 287 | A = OR[287]
0x01B8 (0x000370) 0x292F- f:00024 d: 303 | OR[303] = A
0x01B9 (0x000372) 0x2120- f:00020 d: 288 | A = OR[288]
0x01BA (0x000374) 0x2930- f:00024 d: 304 | OR[304] = A
0x01BB (0x000376) 0x1010- f:00010 d: 16 | A = 16 (0x0010)
0x01BC (0x000378) 0x2931- f:00024 d: 305 | OR[305] = A
0x01BD (0x00037A) 0x1011- f:00010 d: 17 | A = 17 (0x0011)
0x01BE (0x00037C) 0x2932- f:00024 d: 306 | OR[306] = A
0x01BF (0x00037E) 0x112A- f:00010 d: 298 | A = 298 (0x012A)
0x01C0 (0x000380) 0x5800- f:00054 d: 0 | B = A
0x01C1 (0x000382) 0x1800-0x2518 f:00014 d: 0 | A = 9496 (0x2518)
0x01C3 (0x000386) 0x7C09- f:00076 d: 9 | R = OR[9]
0x01C4 (0x000388) 0x8602- f:00103 d: 2 | P = P + 2 (0x01C6), A # 0
0x01C5 (0x00038A) 0x0200- f:00001 d: 0 | EXIT
0x01C6 (0x00038C) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1
0x01C7 (0x00038E) 0x3104- f:00030 d: 260 | A = (OR[260])
0x01C8 (0x000390) 0x2904- f:00024 d: 260 | OR[260] = A
0x01C9 (0x000392) 0x2104- f:00020 d: 260 | A = OR[260]
0x01CA (0x000394) 0x2706- f:00023 d: 262 | A = A - OR[262]
0x01CB (0x000396) 0x8007- f:00100 d: 7 | P = P + 7 (0x01D2), C = 0
0x01CC (0x000398) 0x2104- f:00020 d: 260 | A = OR[260]
0x01CD (0x00039A) 0x2705- f:00023 d: 261 | A = A - OR[261]
0x01CE (0x00039C) 0x8003- f:00100 d: 3 | P = P + 3 (0x01D1), C = 0
0x01CF (0x00039E) 0x8402- f:00102 d: 2 | P = P + 2 (0x01D1), A = 0
0x01D0 (0x0003A0) 0x7002- f:00070 d: 2 | P = P + 2 (0x01D2)
0x01D1 (0x0003A2) 0x7003- f:00070 d: 3 | P = P + 3 (0x01D4)
0x01D2 (0x0003A4) 0x7C34- f:00076 d: 52 | R = OR[52]
0x01D3 (0x0003A6) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B ****
0x01D4 (0x0003A8) 0x7240- f:00071 d: 64 | P = P - 64 (0x0194)
0x01D5 (0x0003AA) 0x3120- f:00030 d: 288 | A = (OR[288])
0x01D6 (0x0003AC) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01D7 (0x0003AE) 0x2913- f:00024 d: 275 | OR[275] = A
0x01D8 (0x0003B0) 0x2120- f:00020 d: 288 | A = OR[288]
0x01D9 (0x0003B2) 0x2513- f:00022 d: 275 | A = A + OR[275]
0x01DA (0x0003B4) 0x2920- f:00024 d: 288 | OR[288] = A
0x01DB (0x0003B6) 0x0200- f:00001 d: 0 | EXIT
0x01DC (0x0003B8) 0x2124- f:00020 d: 292 | A = OR[292]
0x01DD (0x0003BA) 0x290F- f:00024 d: 271 | OR[271] = A
0x01DE (0x0003BC) 0x2113- f:00020 d: 275 | A = OR[275]
0x01DF (0x0003BE) 0x2910- f:00024 d: 272 | OR[272] = A
0x01E0 (0x0003C0) 0x2125- f:00020 d: 293 | A = OR[293]
0x01E1 (0x0003C2) 0x2911- f:00024 d: 273 | OR[273] = A
0x01E2 (0x0003C4) 0x7A03-0x0218 f:00075 d: 3 | P = OR[3]+536 (0x0218)
0x01E4 (0x0003C8) 0x210F- f:00020 d: 271 | A = OR[271]
0x01E5 (0x0003CA) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x01E6 (0x0003CC) 0x2519- f:00022 d: 281 | A = A + OR[281]
0x01E7 (0x0003CE) 0x290D- f:00024 d: 269 | OR[269] = A
0x01E8 (0x0003D0) 0x310D- f:00030 d: 269 | A = (OR[269])
0x01E9 (0x0003D2) 0x290D- f:00024 d: 269 | OR[269] = A
0x01EA (0x0003D4) 0x210F- f:00020 d: 271 | A = OR[271]
0x01EB (0x0003D6) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x01EC (0x0003D8) 0x2908- f:00024 d: 264 | OR[264] = A
0x01ED (0x0003DA) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x01EE (0x0003DC) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x01EF (0x0003DE) 0x8604- f:00103 d: 4 | P = P + 4 (0x01F3), A # 0
0x01F0 (0x0003E0) 0x210D- f:00020 d: 269 | A = OR[269]
0x01F1 (0x0003E2) 0x0808- f:00004 d: 8 | A = A > 8 (0x0008)
0x01F2 (0x0003E4) 0x290D- f:00024 d: 269 | OR[269] = A
0x01F3 (0x0003E6) 0x210D- f:00020 d: 269 | A = OR[269]
0x01F4 (0x0003E8) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01F5 (0x0003EA) 0x2912- f:00024 d: 274 | OR[274] = A
0x01F6 (0x0003EC) 0x2D0F- f:00026 d: 271 | OR[271] = OR[271] + 1
0x01F7 (0x0003EE) 0x2112- f:00020 d: 274 | A = OR[274]
0x01F8 (0x0003F0) 0x12FF- f:00011 d: 255 | A = A & 255 (0x00FF)
0x01F9 (0x0003F2) 0x290D- f:00024 d: 269 | OR[269] = A
0x01FA (0x0003F4) 0x2110- f:00020 d: 272 | A = OR[272]
0x01FB (0x0003F6) 0x0801- f:00004 d: 1 | A = A > 1 (0x0001)
0x01FC (0x0003F8) 0x2521- f:00022 d: 289 | A = A + OR[289]
0x01FD (0x0003FA) 0x290E- f:00024 d: 270 | OR[270] = A
0x01FE (0x0003FC) 0x2110- f:00020 d: 272 | A = OR[272]
0x01FF (0x0003FE) 0x1201- f:00011 d: 1 | A = A & 1 (0x0001)
0x0200 (0x000400) 0x2908- f:00024 d: 264 | OR[264] = A
0x0201 (0x000402) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x0202 (0x000404) 0x2708- f:00023 d: 264 | A = A - OR[264]
0x0203 (0x000406) 0xAE03-0x0211 f:00127 d: 3 | P = OR[3]+529 (0x0211), A # 0
0x0205 (0x00040A) 0x310E- f:00030 d: 270 | A = (OR[270])
0x0206 (0x00040C) 0x0A09- f:00005 d: 9 | A = A < 9 (0x0009)
0x0207 (0x00040E) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x0208 (0x000410) 0x0C09- f:00006 d: 9 | A = A >> 9 (0x0009)
0x0209 (0x000412) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x020A (0x000414) 0x7006- f:00070 d: 6 | P = P + 6 (0x0210)
0x020B (0x000416) 0x310E- f:00030 d: 270 | A = (OR[270])
0x020C (0x000418) 0x1A00-0xFF00 f:00015 d: 0 | A = A & 65280 (0xFF00)
0x020E (0x00041C) 0x250D- f:00022 d: 269 | A = A + OR[269]
0x020F (0x00041E) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x0210 (0x000420) 0x2D10- f:00026 d: 272 | OR[272] = OR[272] + 1
0x0211 (0x000422) 0x2F11- f:00027 d: 273 | OR[273] = OR[273] - 1
0x0212 (0x000424) 0x2111- f:00020 d: 273 | A = OR[273]
0x0213 (0x000426) 0x8E2F- f:00107 d: 47 | P = P - 47 (0x01E4), A # 0
0x0214 (0x000428) 0x0200- f:00001 d: 0 | EXIT
0x0215 (0x00042A) 0x2F04- f:00027 d: 260 | OR[260] = OR[260] - 1
0x0216 (0x00042C) 0x3104- f:00030 d: 260 | A = (OR[260])
0x0217 (0x00042E) 0x2904- f:00024 d: 260 | OR[260] = A
0x0218 (0x000430) 0x2104- f:00020 d: 260 | A = OR[260]
0x0219 (0x000432) 0x2706- f:00023 d: 262 | A = A - OR[262]
0x021A (0x000434) 0x8007- f:00100 d: 7 | P = P + 7 (0x0221), C = 0
0x021B (0x000436) 0x2104- f:00020 d: 260 | A = OR[260]
0x021C (0x000438) 0x2705- f:00023 d: 261 | A = A - OR[261]
0x021D (0x00043A) 0x8003- f:00100 d: 3 | P = P + 3 (0x0220), C = 0
0x021E (0x00043C) 0x8402- f:00102 d: 2 | P = P + 2 (0x0220), A = 0
0x021F (0x00043E) 0x7002- f:00070 d: 2 | P = P + 2 (0x0221)
0x0220 (0x000440) 0x7003- f:00070 d: 3 | P = P + 3 (0x0223)
0x0221 (0x000442) 0x7C34- f:00076 d: 52 | R = OR[52]
0x0222 (0x000444) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B ****
0x0223 (0x000446) 0x2104- f:00020 d: 260 | A = OR[260]
0x0224 (0x000448) 0x290D- f:00024 d: 269 | OR[269] = A
0x0225 (0x00044A) 0x2104- f:00020 d: 260 | A = OR[260]
0x0226 (0x00044C) 0x1403- f:00012 d: 3 | A = A + 3 (0x0003)
0x0227 (0x00044E) 0x1A00-0xFFFC f:00015 d: 0 | A = A & 65532 (0xFFFC)
0x0229 (0x000452) 0x2904- f:00024 d: 260 | OR[260] = A
0x022A (0x000454) 0x2104- f:00020 d: 260 | A = OR[260]
0x022B (0x000456) 0x2921- f:00024 d: 289 | OR[289] = A
0x022C (0x000458) 0x1034- f:00010 d: 52 | A = 52 (0x0034)
0x022D (0x00045A) 0x2B04- f:00025 d: 260 | OR[260] = A + OR[260]
0x022E (0x00045C) 0x2104- f:00020 d: 260 | A = OR[260]
0x022F (0x00045E) 0x2705- f:00023 d: 261 | A = A - OR[261]
0x0230 (0x000460) 0xB234- f:00131 d: 52 | R = OR[52], C = 1
0x0231 (0x000462) 0x000B- f:00000 d: 11 | PASS | **** non-standard encoding with D:0x000B ****
0x0232 (0x000464) 0x210D- f:00020 d: 269 | A = OR[269]
0x0233 (0x000466) 0x3904- f:00034 d: 260 | (OR[260]) = A
0x0234 (0x000468) 0x2D04- f:00026 d: 260 | OR[260] = OR[260] + 1
0x0235 (0x00046A) 0x2121- f:00020 d: 289 | A = OR[289]
0x0236 (0x00046C) 0x290E- f:00024 d: 270 | OR[270] = A
0x0237 (0x00046E) 0x1034- f:00010 d: 52 | A = 52 (0x0034)
0x0238 (0x000470) 0x290D- f:00024 d: 269 | OR[269] = A
0x0239 (0x000472) 0x210D- f:00020 d: 269 | A = OR[269]
0x023A (0x000474) 0x8406- f:00102 d: 6 | P = P + 6 (0x0240), A = 0
0x023B (0x000476) 0x1000- f:00010 d: 0 | A = 0 (0x0000)
0x023C (0x000478) 0x390E- f:00034 d: 270 | (OR[270]) = A
0x023D (0x00047A) 0x2F0D- f:00027 d: 269 | OR[269] = OR[269] - 1
0x023E (0x00047C) 0x2D0E- f:00026 d: 270 | OR[270] = OR[270] + 1
0x023F (0x00047E) 0x7206- f:00071 d: 6 | P = P - 6 (0x0239)
0x0240 (0x000480) 0x0200- f:00001 d: 0 | EXIT
0x0241 (0x000482) 0x0000- f:00000 d: 0 | PASS
0x0242 (0x000484) 0x0000- f:00000 d: 0 | PASS
0x0243 (0x000486) 0x0000- f:00000 d: 0 | PASS
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/a-rbtgbo.adb | orb-zhuchen/Orb | 0 | 7750 | <reponame>orb-zhuchen/Orb<gh_stars>0
------------------------------------------------------------------------------
-- --
-- GNAT LIBRARY COMPONENTS --
-- --
-- ADA.CONTAINERS.RED_BLACK_TREES.GENERIC_BOUNDED_OPERATIONS --
-- --
-- B o d y --
-- --
-- Copyright (C) 2004-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- This unit was originally developed by <NAME>. --
------------------------------------------------------------------------------
-- The references in this file to "CLR" refer to the following book, from
-- which several of the algorithms here were adapted:
-- Introduction to Algorithms
-- by <NAME>, <NAME>, <NAME>
-- Publisher: The MIT Press (June 18, 1990)
-- ISBN: 0262031418
with System; use type System.Address;
package body Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations is
pragma Warnings (Off, "variable ""Busy*"" is not referenced");
pragma Warnings (Off, "variable ""Lock*"" is not referenced");
-- See comment in Ada.Containers.Helpers
-----------------------
-- Local Subprograms --
-----------------------
procedure Delete_Fixup (Tree : in out Tree_Type'Class; Node : Count_Type);
procedure Delete_Swap (Tree : in out Tree_Type'Class; Z, Y : Count_Type);
procedure Left_Rotate (Tree : in out Tree_Type'Class; X : Count_Type);
procedure Right_Rotate (Tree : in out Tree_Type'Class; Y : Count_Type);
----------------
-- Clear_Tree --
----------------
procedure Clear_Tree (Tree : in out Tree_Type'Class) is
begin
TC_Check (Tree.TC);
Tree.First := 0;
Tree.Last := 0;
Tree.Root := 0;
Tree.Length := 0;
Tree.Free := -1;
end Clear_Tree;
------------------
-- Delete_Fixup --
------------------
procedure Delete_Fixup
(Tree : in out Tree_Type'Class;
Node : Count_Type)
is
-- CLR p. 274
X : Count_Type;
W : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
X := Node;
while X /= Tree.Root and then Color (N (X)) = Black loop
if X = Left (N (Parent (N (X)))) then
W := Right (N (Parent (N (X))));
if Color (N (W)) = Red then
Set_Color (N (W), Black);
Set_Color (N (Parent (N (X))), Red);
Left_Rotate (Tree, Parent (N (X)));
W := Right (N (Parent (N (X))));
end if;
if (Left (N (W)) = 0 or else Color (N (Left (N (W)))) = Black)
and then
(Right (N (W)) = 0 or else Color (N (Right (N (W)))) = Black)
then
Set_Color (N (W), Red);
X := Parent (N (X));
else
if Right (N (W)) = 0
or else Color (N (Right (N (W)))) = Black
then
-- As a condition for setting the color of the left child to
-- black, the left child access value must be non-null. A
-- truth table analysis shows that if we arrive here, that
-- condition holds, so there's no need for an explicit test.
-- The assertion is here to document what we know is true.
pragma Assert (Left (N (W)) /= 0);
Set_Color (N (Left (N (W))), Black);
Set_Color (N (W), Red);
Right_Rotate (Tree, W);
W := Right (N (Parent (N (X))));
end if;
Set_Color (N (W), Color (N (Parent (N (X)))));
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Right (N (W))), Black);
Left_Rotate (Tree, Parent (N (X)));
X := Tree.Root;
end if;
else
pragma Assert (X = Right (N (Parent (N (X)))));
W := Left (N (Parent (N (X))));
if Color (N (W)) = Red then
Set_Color (N (W), Black);
Set_Color (N (Parent (N (X))), Red);
Right_Rotate (Tree, Parent (N (X)));
W := Left (N (Parent (N (X))));
end if;
if (Left (N (W)) = 0 or else Color (N (Left (N (W)))) = Black)
and then
(Right (N (W)) = 0 or else Color (N (Right (N (W)))) = Black)
then
Set_Color (N (W), Red);
X := Parent (N (X));
else
if Left (N (W)) = 0
or else Color (N (Left (N (W)))) = Black
then
-- As a condition for setting the color of the right child
-- to black, the right child access value must be non-null.
-- A truth table analysis shows that if we arrive here, that
-- condition holds, so there's no need for an explicit test.
-- The assertion is here to document what we know is true.
pragma Assert (Right (N (W)) /= 0);
Set_Color (N (Right (N (W))), Black);
Set_Color (N (W), Red);
Left_Rotate (Tree, W);
W := Left (N (Parent (N (X))));
end if;
Set_Color (N (W), Color (N (Parent (N (X)))));
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Left (N (W))), Black);
Right_Rotate (Tree, Parent (N (X)));
X := Tree.Root;
end if;
end if;
end loop;
Set_Color (N (X), Black);
end Delete_Fixup;
---------------------------
-- Delete_Node_Sans_Free --
---------------------------
procedure Delete_Node_Sans_Free
(Tree : in out Tree_Type'Class;
Node : Count_Type)
is
-- CLR p. 273
X, Y : Count_Type;
Z : constant Count_Type := Node;
N : Nodes_Type renames Tree.Nodes;
begin
TC_Check (Tree.TC);
-- If node is not present, return (exception will be raised in caller)
if Z = 0 then
return;
end if;
pragma Assert (Tree.Length > 0);
pragma Assert (Tree.Root /= 0);
pragma Assert (Tree.First /= 0);
pragma Assert (Tree.Last /= 0);
pragma Assert (Parent (N (Tree.Root)) = 0);
pragma Assert ((Tree.Length > 1)
or else (Tree.First = Tree.Last
and then Tree.First = Tree.Root));
pragma Assert ((Left (N (Node)) = 0)
or else (Parent (N (Left (N (Node)))) = Node));
pragma Assert ((Right (N (Node)) = 0)
or else (Parent (N (Right (N (Node)))) = Node));
pragma Assert (((Parent (N (Node)) = 0) and then (Tree.Root = Node))
or else ((Parent (N (Node)) /= 0) and then
((Left (N (Parent (N (Node)))) = Node)
or else
(Right (N (Parent (N (Node)))) = Node))));
if Left (N (Z)) = 0 then
if Right (N (Z)) = 0 then
if Z = Tree.First then
Tree.First := Parent (N (Z));
end if;
if Z = Tree.Last then
Tree.Last := Parent (N (Z));
end if;
if Color (N (Z)) = Black then
Delete_Fixup (Tree, Z);
end if;
pragma Assert (Left (N (Z)) = 0);
pragma Assert (Right (N (Z)) = 0);
if Z = Tree.Root then
pragma Assert (Tree.Length = 1);
pragma Assert (Parent (N (Z)) = 0);
Tree.Root := 0;
elsif Z = Left (N (Parent (N (Z)))) then
Set_Left (N (Parent (N (Z))), 0);
else
pragma Assert (Z = Right (N (Parent (N (Z)))));
Set_Right (N (Parent (N (Z))), 0);
end if;
else
pragma Assert (Z /= Tree.Last);
X := Right (N (Z));
if Z = Tree.First then
Tree.First := Min (Tree, X);
end if;
if Z = Tree.Root then
Tree.Root := X;
elsif Z = Left (N (Parent (N (Z)))) then
Set_Left (N (Parent (N (Z))), X);
else
pragma Assert (Z = Right (N (Parent (N (Z)))));
Set_Right (N (Parent (N (Z))), X);
end if;
Set_Parent (N (X), Parent (N (Z)));
if Color (N (Z)) = Black then
Delete_Fixup (Tree, X);
end if;
end if;
elsif Right (N (Z)) = 0 then
pragma Assert (Z /= Tree.First);
X := Left (N (Z));
if Z = Tree.Last then
Tree.Last := Max (Tree, X);
end if;
if Z = Tree.Root then
Tree.Root := X;
elsif Z = Left (N (Parent (N (Z)))) then
Set_Left (N (Parent (N (Z))), X);
else
pragma Assert (Z = Right (N (Parent (N (Z)))));
Set_Right (N (Parent (N (Z))), X);
end if;
Set_Parent (N (X), Parent (N (Z)));
if Color (N (Z)) = Black then
Delete_Fixup (Tree, X);
end if;
else
pragma Assert (Z /= Tree.First);
pragma Assert (Z /= Tree.Last);
Y := Next (Tree, Z);
pragma Assert (Left (N (Y)) = 0);
X := Right (N (Y));
if X = 0 then
if Y = Left (N (Parent (N (Y)))) then
pragma Assert (Parent (N (Y)) /= Z);
Delete_Swap (Tree, Z, Y);
Set_Left (N (Parent (N (Z))), Z);
else
pragma Assert (Y = Right (N (Parent (N (Y)))));
pragma Assert (Parent (N (Y)) = Z);
Set_Parent (N (Y), Parent (N (Z)));
if Z = Tree.Root then
Tree.Root := Y;
elsif Z = Left (N (Parent (N (Z)))) then
Set_Left (N (Parent (N (Z))), Y);
else
pragma Assert (Z = Right (N (Parent (N (Z)))));
Set_Right (N (Parent (N (Z))), Y);
end if;
Set_Left (N (Y), Left (N (Z)));
Set_Parent (N (Left (N (Y))), Y);
Set_Right (N (Y), Z);
Set_Parent (N (Z), Y);
Set_Left (N (Z), 0);
Set_Right (N (Z), 0);
declare
Y_Color : constant Color_Type := Color (N (Y));
begin
Set_Color (N (Y), Color (N (Z)));
Set_Color (N (Z), Y_Color);
end;
end if;
if Color (N (Z)) = Black then
Delete_Fixup (Tree, Z);
end if;
pragma Assert (Left (N (Z)) = 0);
pragma Assert (Right (N (Z)) = 0);
if Z = Right (N (Parent (N (Z)))) then
Set_Right (N (Parent (N (Z))), 0);
else
pragma Assert (Z = Left (N (Parent (N (Z)))));
Set_Left (N (Parent (N (Z))), 0);
end if;
else
if Y = Left (N (Parent (N (Y)))) then
pragma Assert (Parent (N (Y)) /= Z);
Delete_Swap (Tree, Z, Y);
Set_Left (N (Parent (N (Z))), X);
Set_Parent (N (X), Parent (N (Z)));
else
pragma Assert (Y = Right (N (Parent (N (Y)))));
pragma Assert (Parent (N (Y)) = Z);
Set_Parent (N (Y), Parent (N (Z)));
if Z = Tree.Root then
Tree.Root := Y;
elsif Z = Left (N (Parent (N (Z)))) then
Set_Left (N (Parent (N (Z))), Y);
else
pragma Assert (Z = Right (N (Parent (N (Z)))));
Set_Right (N (Parent (N (Z))), Y);
end if;
Set_Left (N (Y), Left (N (Z)));
Set_Parent (N (Left (N (Y))), Y);
declare
Y_Color : constant Color_Type := Color (N (Y));
begin
Set_Color (N (Y), Color (N (Z)));
Set_Color (N (Z), Y_Color);
end;
end if;
if Color (N (Z)) = Black then
Delete_Fixup (Tree, X);
end if;
end if;
end if;
Tree.Length := Tree.Length - 1;
end Delete_Node_Sans_Free;
-----------------
-- Delete_Swap --
-----------------
procedure Delete_Swap
(Tree : in out Tree_Type'Class;
Z, Y : Count_Type)
is
N : Nodes_Type renames Tree.Nodes;
pragma Assert (Z /= Y);
pragma Assert (Parent (N (Y)) /= Z);
Y_Parent : constant Count_Type := Parent (N (Y));
Y_Color : constant Color_Type := Color (N (Y));
begin
Set_Parent (N (Y), Parent (N (Z)));
Set_Left (N (Y), Left (N (Z)));
Set_Right (N (Y), Right (N (Z)));
Set_Color (N (Y), Color (N (Z)));
if Tree.Root = Z then
Tree.Root := Y;
elsif Right (N (Parent (N (Y)))) = Z then
Set_Right (N (Parent (N (Y))), Y);
else
pragma Assert (Left (N (Parent (N (Y)))) = Z);
Set_Left (N (Parent (N (Y))), Y);
end if;
if Right (N (Y)) /= 0 then
Set_Parent (N (Right (N (Y))), Y);
end if;
if Left (N (Y)) /= 0 then
Set_Parent (N (Left (N (Y))), Y);
end if;
Set_Parent (N (Z), Y_Parent);
Set_Color (N (Z), Y_Color);
Set_Left (N (Z), 0);
Set_Right (N (Z), 0);
end Delete_Swap;
----------
-- Free --
----------
procedure Free (Tree : in out Tree_Type'Class; X : Count_Type) is
pragma Assert (X > 0);
pragma Assert (X <= Tree.Capacity);
N : Nodes_Type renames Tree.Nodes;
-- pragma Assert (N (X).Prev >= 0); -- node is active
-- Find a way to mark a node as active vs. inactive; we could
-- use a special value in Color_Type for this. ???
begin
-- The set container actually contains two data structures: a list for
-- the "active" nodes that contain elements that have been inserted
-- onto the tree, and another for the "inactive" nodes of the free
-- store.
--
-- We desire that merely declaring an object should have only minimal
-- cost; specially, we want to avoid having to initialize the free
-- store (to fill in the links), especially if the capacity is large.
--
-- The head of the free list is indicated by Container.Free. If its
-- value is non-negative, then the free store has been initialized
-- in the "normal" way: Container.Free points to the head of the list
-- of free (inactive) nodes, and the value 0 means the free list is
-- empty. Each node on the free list has been initialized to point
-- to the next free node (via its Parent component), and the value 0
-- means that this is the last free node.
--
-- If Container.Free is negative, then the links on the free store
-- have not been initialized. In this case the link values are
-- implied: the free store comprises the components of the node array
-- started with the absolute value of Container.Free, and continuing
-- until the end of the array (Nodes'Last).
--
-- ???
-- It might be possible to perform an optimization here. Suppose that
-- the free store can be represented as having two parts: one
-- comprising the non-contiguous inactive nodes linked together
-- in the normal way, and the other comprising the contiguous
-- inactive nodes (that are not linked together, at the end of the
-- nodes array). This would allow us to never have to initialize
-- the free store, except in a lazy way as nodes become inactive.
-- When an element is deleted from the list container, its node
-- becomes inactive, and so we set its Prev component to a negative
-- value, to indicate that it is now inactive. This provides a useful
-- way to detect a dangling cursor reference.
-- The comment above is incorrect; we need some other way to
-- indicate a node is inactive, for example by using a special
-- Color_Type value. ???
-- N (X).Prev := -1; -- Node is deallocated (not on active list)
if Tree.Free >= 0 then
-- The free store has previously been initialized. All we need to
-- do here is link the newly-free'd node onto the free list.
Set_Parent (N (X), Tree.Free);
Tree.Free := X;
elsif X + 1 = abs Tree.Free then
-- The free store has not been initialized, and the node becoming
-- inactive immediately precedes the start of the free store. All
-- we need to do is move the start of the free store back by one.
Tree.Free := Tree.Free + 1;
else
-- The free store has not been initialized, and the node becoming
-- inactive does not immediately precede the free store. Here we
-- first initialize the free store (meaning the links are given
-- values in the traditional way), and then link the newly-free'd
-- node onto the head of the free store.
-- ???
-- See the comments above for an optimization opportunity. If the
-- next link for a node on the free store is negative, then this
-- means the remaining nodes on the free store are physically
-- contiguous, starting as the absolute value of that index value.
Tree.Free := abs Tree.Free;
if Tree.Free > Tree.Capacity then
Tree.Free := 0;
else
for I in Tree.Free .. Tree.Capacity - 1 loop
Set_Parent (N (I), I + 1);
end loop;
Set_Parent (N (Tree.Capacity), 0);
end if;
Set_Parent (N (X), Tree.Free);
Tree.Free := X;
end if;
end Free;
-----------------------
-- Generic_Allocate --
-----------------------
procedure Generic_Allocate
(Tree : in out Tree_Type'Class;
Node : out Count_Type)
is
N : Nodes_Type renames Tree.Nodes;
begin
if Tree.Free >= 0 then
Node := Tree.Free;
-- We always perform the assignment first, before we
-- change container state, in order to defend against
-- exceptions duration assignment.
Set_Element (N (Node));
Tree.Free := Parent (N (Node));
else
-- A negative free store value means that the links of the nodes
-- in the free store have not been initialized. In this case, the
-- nodes are physically contiguous in the array, starting at the
-- index that is the absolute value of the Container.Free, and
-- continuing until the end of the array (Nodes'Last).
Node := abs Tree.Free;
-- As above, we perform this assignment first, before modifying
-- any container state.
Set_Element (N (Node));
Tree.Free := Tree.Free - 1;
end if;
-- When a node is allocated from the free store, its pointer components
-- (the links to other nodes in the tree) must also be initialized (to
-- 0, the equivalent of null). This simplifies the post-allocation
-- handling of nodes inserted into terminal positions.
Set_Parent (N (Node), Parent => 0);
Set_Left (N (Node), Left => 0);
Set_Right (N (Node), Right => 0);
end Generic_Allocate;
-------------------
-- Generic_Equal --
-------------------
function Generic_Equal (Left, Right : Tree_Type'Class) return Boolean is
-- Per AI05-0022, the container implementation is required to detect
-- element tampering by a generic actual subprogram.
Lock_Left : With_Lock (Left.TC'Unrestricted_Access);
Lock_Right : With_Lock (Right.TC'Unrestricted_Access);
L_Node : Count_Type;
R_Node : Count_Type;
begin
if Left'Address = Right'Address then
return True;
end if;
if Left.Length /= Right.Length then
return False;
end if;
-- If the containers are empty, return a result immediately, so as to
-- not manipulate the tamper bits unnecessarily.
if Left.Length = 0 then
return True;
end if;
L_Node := Left.First;
R_Node := Right.First;
while L_Node /= 0 loop
if not Is_Equal (Left.Nodes (L_Node), Right.Nodes (R_Node)) then
return False;
end if;
L_Node := Next (Left, L_Node);
R_Node := Next (Right, R_Node);
end loop;
return True;
end Generic_Equal;
-----------------------
-- Generic_Iteration --
-----------------------
procedure Generic_Iteration (Tree : Tree_Type'Class) is
procedure Iterate (P : Count_Type);
-------------
-- Iterate --
-------------
procedure Iterate (P : Count_Type) is
X : Count_Type := P;
begin
while X /= 0 loop
Iterate (Left (Tree.Nodes (X)));
Process (X);
X := Right (Tree.Nodes (X));
end loop;
end Iterate;
-- Start of processing for Generic_Iteration
begin
Iterate (Tree.Root);
end Generic_Iteration;
------------------
-- Generic_Read --
------------------
procedure Generic_Read
(Stream : not null access Root_Stream_Type'Class;
Tree : in out Tree_Type'Class)
is
Len : Count_Type'Base;
Node, Last_Node : Count_Type;
N : Nodes_Type renames Tree.Nodes;
begin
Clear_Tree (Tree);
Count_Type'Base'Read (Stream, Len);
if Checks and then Len < 0 then
raise Program_Error with "bad container length (corrupt stream)";
end if;
if Len = 0 then
return;
end if;
if Checks and then Len > Tree.Capacity then
raise Constraint_Error with "length exceeds capacity";
end if;
-- Use Unconditional_Insert_With_Hint here instead ???
Allocate (Tree, Node);
pragma Assert (Node /= 0);
Set_Color (N (Node), Black);
Tree.Root := Node;
Tree.First := Node;
Tree.Last := Node;
Tree.Length := 1;
for J in Count_Type range 2 .. Len loop
Last_Node := Node;
pragma Assert (Last_Node = Tree.Last);
Allocate (Tree, Node);
pragma Assert (Node /= 0);
Set_Color (N (Node), Red);
Set_Right (N (Last_Node), Right => Node);
Tree.Last := Node;
Set_Parent (N (Node), Parent => Last_Node);
Rebalance_For_Insert (Tree, Node);
Tree.Length := Tree.Length + 1;
end loop;
end Generic_Read;
-------------------------------
-- Generic_Reverse_Iteration --
-------------------------------
procedure Generic_Reverse_Iteration (Tree : Tree_Type'Class) is
procedure Iterate (P : Count_Type);
-------------
-- Iterate --
-------------
procedure Iterate (P : Count_Type) is
X : Count_Type := P;
begin
while X /= 0 loop
Iterate (Right (Tree.Nodes (X)));
Process (X);
X := Left (Tree.Nodes (X));
end loop;
end Iterate;
-- Start of processing for Generic_Reverse_Iteration
begin
Iterate (Tree.Root);
end Generic_Reverse_Iteration;
-------------------
-- Generic_Write --
-------------------
procedure Generic_Write
(Stream : not null access Root_Stream_Type'Class;
Tree : Tree_Type'Class)
is
procedure Process (Node : Count_Type);
pragma Inline (Process);
procedure Iterate is new Generic_Iteration (Process);
-------------
-- Process --
-------------
procedure Process (Node : Count_Type) is
begin
Write_Node (Stream, Tree.Nodes (Node));
end Process;
-- Start of processing for Generic_Write
begin
Count_Type'Base'Write (Stream, Tree.Length);
Iterate (Tree);
end Generic_Write;
-----------------
-- Left_Rotate --
-----------------
procedure Left_Rotate (Tree : in out Tree_Type'Class; X : Count_Type) is
-- CLR p. 266
N : Nodes_Type renames Tree.Nodes;
Y : constant Count_Type := Right (N (X));
pragma Assert (Y /= 0);
begin
Set_Right (N (X), Left (N (Y)));
if Left (N (Y)) /= 0 then
Set_Parent (N (Left (N (Y))), X);
end if;
Set_Parent (N (Y), Parent (N (X)));
if X = Tree.Root then
Tree.Root := Y;
elsif X = Left (N (Parent (N (X)))) then
Set_Left (N (Parent (N (X))), Y);
else
pragma Assert (X = Right (N (Parent (N (X)))));
Set_Right (N (Parent (N (X))), Y);
end if;
Set_Left (N (Y), X);
Set_Parent (N (X), Y);
end Left_Rotate;
---------
-- Max --
---------
function Max
(Tree : Tree_Type'Class;
Node : Count_Type) return Count_Type
is
-- CLR p. 248
X : Count_Type := Node;
Y : Count_Type;
begin
loop
Y := Right (Tree.Nodes (X));
if Y = 0 then
return X;
end if;
X := Y;
end loop;
end Max;
---------
-- Min --
---------
function Min
(Tree : Tree_Type'Class;
Node : Count_Type) return Count_Type
is
-- CLR p. 248
X : Count_Type := Node;
Y : Count_Type;
begin
loop
Y := Left (Tree.Nodes (X));
if Y = 0 then
return X;
end if;
X := Y;
end loop;
end Min;
----------
-- Next --
----------
function Next
(Tree : Tree_Type'Class;
Node : Count_Type) return Count_Type
is
begin
-- CLR p. 249
if Node = 0 then
return 0;
end if;
if Right (Tree.Nodes (Node)) /= 0 then
return Min (Tree, Right (Tree.Nodes (Node)));
end if;
declare
X : Count_Type := Node;
Y : Count_Type := Parent (Tree.Nodes (Node));
begin
while Y /= 0 and then X = Right (Tree.Nodes (Y)) loop
X := Y;
Y := Parent (Tree.Nodes (Y));
end loop;
return Y;
end;
end Next;
--------------
-- Previous --
--------------
function Previous
(Tree : Tree_Type'Class;
Node : Count_Type) return Count_Type
is
begin
if Node = 0 then
return 0;
end if;
if Left (Tree.Nodes (Node)) /= 0 then
return Max (Tree, Left (Tree.Nodes (Node)));
end if;
declare
X : Count_Type := Node;
Y : Count_Type := Parent (Tree.Nodes (Node));
begin
while Y /= 0 and then X = Left (Tree.Nodes (Y)) loop
X := Y;
Y := Parent (Tree.Nodes (Y));
end loop;
return Y;
end;
end Previous;
--------------------------
-- Rebalance_For_Insert --
--------------------------
procedure Rebalance_For_Insert
(Tree : in out Tree_Type'Class;
Node : Count_Type)
is
-- CLR p. 268
N : Nodes_Type renames Tree.Nodes;
X : Count_Type := Node;
pragma Assert (X /= 0);
pragma Assert (Color (N (X)) = Red);
Y : Count_Type;
begin
while X /= Tree.Root and then Color (N (Parent (N (X)))) = Red loop
if Parent (N (X)) = Left (N (Parent (N (Parent (N (X)))))) then
Y := Right (N (Parent (N (Parent (N (X))))));
if Y /= 0 and then Color (N (Y)) = Red then
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Y), Black);
Set_Color (N (Parent (N (Parent (N (X))))), Red);
X := Parent (N (Parent (N (X))));
else
if X = Right (N (Parent (N (X)))) then
X := Parent (N (X));
Left_Rotate (Tree, X);
end if;
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Parent (N (Parent (N (X))))), Red);
Right_Rotate (Tree, Parent (N (Parent (N (X)))));
end if;
else
pragma Assert (Parent (N (X)) =
Right (N (Parent (N (Parent (N (X)))))));
Y := Left (N (Parent (N (Parent (N (X))))));
if Y /= 0 and then Color (N (Y)) = Red then
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Y), Black);
Set_Color (N (Parent (N (Parent (N (X))))), Red);
X := Parent (N (Parent (N (X))));
else
if X = Left (N (Parent (N (X)))) then
X := Parent (N (X));
Right_Rotate (Tree, X);
end if;
Set_Color (N (Parent (N (X))), Black);
Set_Color (N (Parent (N (Parent (N (X))))), Red);
Left_Rotate (Tree, Parent (N (Parent (N (X)))));
end if;
end if;
end loop;
Set_Color (N (Tree.Root), Black);
end Rebalance_For_Insert;
------------------
-- Right_Rotate --
------------------
procedure Right_Rotate (Tree : in out Tree_Type'Class; Y : Count_Type) is
N : Nodes_Type renames Tree.Nodes;
X : constant Count_Type := Left (N (Y));
pragma Assert (X /= 0);
begin
Set_Left (N (Y), Right (N (X)));
if Right (N (X)) /= 0 then
Set_Parent (N (Right (N (X))), Y);
end if;
Set_Parent (N (X), Parent (N (Y)));
if Y = Tree.Root then
Tree.Root := X;
elsif Y = Left (N (Parent (N (Y)))) then
Set_Left (N (Parent (N (Y))), X);
else
pragma Assert (Y = Right (N (Parent (N (Y)))));
Set_Right (N (Parent (N (Y))), X);
end if;
Set_Right (N (X), Y);
Set_Parent (N (Y), X);
end Right_Rotate;
---------
-- Vet --
---------
function Vet (Tree : Tree_Type'Class; Index : Count_Type) return Boolean is
Nodes : Nodes_Type renames Tree.Nodes;
Node : Node_Type renames Nodes (Index);
begin
if Parent (Node) = Index
or else Left (Node) = Index
or else Right (Node) = Index
then
return False;
end if;
if Tree.Length = 0
or else Tree.Root = 0
or else Tree.First = 0
or else Tree.Last = 0
then
return False;
end if;
if Parent (Nodes (Tree.Root)) /= 0 then
return False;
end if;
if Left (Nodes (Tree.First)) /= 0 then
return False;
end if;
if Right (Nodes (Tree.Last)) /= 0 then
return False;
end if;
if Tree.Length = 1 then
if Tree.First /= Tree.Last
or else Tree.First /= Tree.Root
then
return False;
end if;
if Index /= Tree.First then
return False;
end if;
if Parent (Node) /= 0
or else Left (Node) /= 0
or else Right (Node) /= 0
then
return False;
end if;
return True;
end if;
if Tree.First = Tree.Last then
return False;
end if;
if Tree.Length = 2 then
if Tree.First /= Tree.Root and then Tree.Last /= Tree.Root then
return False;
end if;
if Tree.First /= Index and then Tree.Last /= Index then
return False;
end if;
end if;
if Left (Node) /= 0 and then Parent (Nodes (Left (Node))) /= Index then
return False;
end if;
if Right (Node) /= 0 and then Parent (Nodes (Right (Node))) /= Index then
return False;
end if;
if Parent (Node) = 0 then
if Tree.Root /= Index then
return False;
end if;
elsif Left (Nodes (Parent (Node))) /= Index
and then Right (Nodes (Parent (Node))) /= Index
then
return False;
end if;
return True;
end Vet;
end Ada.Containers.Red_Black_Trees.Generic_Bounded_Operations;
|
src/asis/a4g-vcheck.ads | My-Colaborations/dynamo | 15 | 7297 | <filename>src/asis/a4g-vcheck.ads
------------------------------------------------------------------------------
-- --
-- ASIS-for-GNAT IMPLEMENTATION COMPONENTS --
-- --
-- A 4 G . V C H E C K --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2010, Free Software Foundation, Inc. --
-- --
-- ASIS-for-GNAT is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 2, or (at your option) any later --
-- version. ASIS-for-GNAT is distributed in the hope that it will be use- --
-- ful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER- --
-- CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General --
-- Public License for more details. You should have received a copy of the --
-- GNU General Public License distributed with ASIS-for-GNAT; see file --
-- COPYING. If not, write to the Free Software Foundation, 51 Franklin --
-- Street, Fifth Floor, Boston, MA 02110-1301, USA. --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- --
-- ASIS-for-GNAT was originally developed by the ASIS-for-GNAT team at the --
-- Software Engineering Laboratory of the Swiss Federal Institute of --
-- Technology (LGL-EPFL) in Lausanne, Switzerland, in cooperation with the --
-- Scientific Research Computer Center of Moscow State University (SRCC --
-- MSU), Russia, with funding partially provided by grants from the Swiss --
-- National Science Foundation and the Swiss Academy of Engineering --
-- Sciences. ASIS-for-GNAT is now maintained by AdaCore --
-- (http://www.adacore.com). --
-- --
------------------------------------------------------------------------------
with Ada.Exceptions; use Ada.Exceptions;
with Asis; use Asis;
with Asis.Text; use Asis.Text;
with Asis.Errors; use Asis.Errors;
with A4G.A_Types; use A4G.A_Types;
with A4G.Int_Knds; use A4G.Int_Knds;
-- This package contains the routines for checking the validity of the
-- arguments of the ASIS queries and for generating the diagnostic info.
-- This package in its current state originated from the very beginning of
-- the ASIS project and it definitely needs revising.
package A4G.Vcheck is
-- GNAT-style reformatting required!! Only formal compatibility with -gnatg
-- is achieved by now.
-- This package contains procedures for checking the validity of the
-- Context, Compilation_Unit and Element values, raising the
-- Asis-defined exceptions (with previous setting of the status
-- value and forming the Diagnosis string) in some standard
-- situations and utility subprograms to be used in the keeping to
-- the "catch-all" policy defined in the subsection 3.6 of the
-- ASIS: Detailed Semantics and Implementation Document (v. 1.1.1)
--
-- The first prototype implementation uses rather roof approach
-- to keep to the "catch-all" policy in respect to the
-- non-Asis-defined exceptions and to handle the status and Diagnosis
-- information. The main principles of this approach are:
--
-- (a) all non-Asis exceptions are caught by
--
-- when others =>
-- Raise_ASIS_Failed (Diagnosis => "Name of the routine in which"
-- &" this handler is" );
--
-- exception handler, and as a rule no attempt is undertaken
-- to recover from the error situation (Status is set as
-- "Value_Error" and ASIS_Failed is raised);
--
-- (b) Diagnosis string contains only general description of the failure
-- and the indication of the Asis query or low-level implementation
-- utility subprogram in which the Asis-defined exception was initially
-- raised;
--
-- (c) if Asis-defined exception propagates through the Asis implementation,
-- then the information related to the dynamic context of the exception
-- propagation is added to the Diagnosis (and separated by the
-- Asis_Types_And_Limits.ASIS_Line_Terminator constant).
--
-- (d) most of the routines in the Asis implementation should contain the
-- exception handler with the "others" choice (as described in the
-- paragraph (a) above. If it is known that the Asis_defined exception
-- could be raised in the procedure or function body, then the body
-- should contain two following exception handlers in the order given:
--
-- when Asis_ASIS_Inappropriate_Context |
-- ASIS_Inappropriate_Compilation_Unit |
-- ASIS_Inappropriate_Element =>
--
-- raise; -- nothing should be done additionally;
-- -- exception has been raised in the argument(s)
-- -- validity/appropriation checks in the same
-- -- frame
--
-- when ASIS_Failed -- | other possible Asis-defined exceptions
-- =>
-- Add_Call_Information (Outer_Call => "Name of the routine in which"
-- &" this handler is" );
-- raise; ---????????
--
-- when others =>
-- Raise_ASIS_Failed (Diagnosis => "Name of the routine in which"
-- &" this handler is" );
--
procedure Add (Phrase : String);
-- Adds Phrase to Diagnosis_Buffer and resets Diagnosis_Len. Exits with no
-- (further) change in Diagnosis_Buffer as soon as Diagnosis_Len attains
-- Max_Diagnosis_Length.
------------------------------------------------------------
-- Checking the validity of Context, Compilation_Unit and
-- Element
------------------------------------------------------------
------------------------------------------------------------
procedure Check_Validity
(Compilation_Unit : Asis.Compilation_Unit;
Query : String);
------------------------------------------------------------
-- Compilation_Unit - Specifies the unit to check
-- Query - Specifies the name of query in which the check
-- is performed. The parameter value is used to
-- form the Diagnosis string
--
-- Performs the check if the unit does not belong to the closed library
-- Sets the corresponding Status and forms the corresponding Diagnosis
-- if the check fails
--
-- BETTER DOCS NEEDED!!
---------------------------------------------------------------
procedure Check_Validity
(Element : Asis.Element;
Query : String);
------------------------------------------------------------
-- Element - Specifies the element to check
-- Query - Specifies the name of query in which the check is performed.
-- The parameter value is used to form the Diagnosis string
--
-- Performs the check if the element does not belong to the invalid
-- element
-- Sets the corresponding Status and forms the corresponding Diagnosis
-- if the check fails
--
-- BETTER DOCS NEEDED!!
---------------------------------------------------------------
procedure Check_Validity (Line : Asis.Text.Line;
Query : String);
------------------------------------------------------------
-- Line - Specifies the Line to check
-- Query - Specifies the name of query in which the check is performed.
-- The parameter value is used to form the Diagnosis string
--
-- Performs the check if the line does not belong to the invalid
-- Context
-- Sets the corresponding Status and forms the corresponding Diagnosis
-- if the check fails
--
-- BETTER DOCS NEEDED!!
------------------------------------------------------------
procedure Check_Validity (Context : Asis.Context;
Query : String);
------------------------------------------------------------
-- Context - Specifies the ASIS Context to check
-- Query - Specifies the name of query in which the check is performed.
-- The parameter value is used to form the Diagnosis string
--
-- Performs the check if the Context is not in inassosiated or inopened
-- state
-- Sets the corresponding Status and forms the corresponding Diagnosis
-- if the check fails
--
-- BETTER DOCS NEEDED!!
-------------------------------------
-- Raising Asis-defined exceptions --
-------------------------------------
procedure Raise_ASIS_Failed
(Diagnosis : String;
Argument : Asis.Element := Nil_Element;
Stat : Asis.Errors.Error_Kinds := Internal_Error;
Bool_Par : Boolean := False;
Internal_Bug : Boolean := True);
-- Raises ASIS_Failed with Stat as the value of ASIS Error Status.
-- Usually expects the query name as Diagnosis. If the corresponding ASIS
-- standard query has an optional boolean parameter, and if this parameter
-- is set on for the given call to this query, then Bool_Par is expected to
-- be set True. Internal_Bug specifies if the procedure is called for an
-- internal implementation bug.
-- This routine may be used to raise ASIS_Failed not only for the cases of
-- internal implementation errors. In this case Internal_Bug should be set
-- OFF, and Stat should specify the error kind.
-- If Argument is not IS_Nil, adds the debug image of the argument to the
-- diagnosis string.
procedure Raise_ASIS_Failed_In_Traversing
(Start_Element : Asis.Element;
Failure_At : Asis.Element;
Pre_Op : Boolean;
Exception_Info : String);
-- Raises ASIS_Failed with Stat as Unhandled_Exception_Error for the
-- situation when some non-ASIS exception is raised in actual Pre-
-- (Pre-Op is set ON) or Post-Operation (Pre_Op is set False). If forms the
-- diagnostic message indicating the starting Element of the traversal
-- (should be provided as the actual for Start_Element), the Element for
-- which the failure took place (actual for Failure_At) and the information
-- about the exception raised (passed as Exception_Info)
--------------------------------------------------------------------
procedure Raise_ASIS_Inappropriate_Compilation_Unit
(Diagnosis : String);
--------------------------------------------------------------------
-- Diagnosis - Specifies the query to which the Compilation Unit
-- with inappropriate kind was passed
--
-- Raises ASIS_Inappropriate_Compilation_Unit with Value_Error status
--
-- BETTER DOCS NEEDED!!
--------------------------------------------------------------------
procedure Raise_ASIS_Inappropriate_Element
(Diagnosis : String;
Wrong_Kind : Internal_Element_Kinds;
Status : Error_Kinds := Value_Error);
--------------------------------------------------------------------
-- Diagnosis - Specifies the query to which the Element with
-- inappropriate kind was passed
--
-- Raises ASIS_Inappropriate_Element with Status error status
--
-- BETTER DOCS NEEDED!!
--
--------------------------------------------------------------------
procedure Raise_ASIS_Inappropriate_Line_Number
(Diagnosis : String;
Status : Error_Kinds := Value_Error);
--------------------------------------------------------------------
procedure Not_Implemented_Yet (Diagnosis : String);
--------------------------------------------------------------------
-- Diagnosis - Specifies the query which has not been implemented
-- properly yet and has a placeholder as its body
--
-- Raises ASIS_Failed with Not_Implemented_Error status
--
-- This procedure is used in the placeholder bodies of the non-implemented
-- queries
--
-- BETTER DOCS NEEDED!!
--------------------------------------------------------------------
----------------------------------------------
-- Setting the Status and Diagnosis values --
----------------------------------------------
--------------------------------------------------------------------
procedure Set_Error_Status
(Status : Error_Kinds := Not_An_Error;
Diagnosis : String := Nil_Asis_String);
--------------------------------------------------------------------
--
-- This procedure is the full analog of the A4G.Set_Status
-- procedure, it is intended to be used as the implementation of the
-- A4G.Set_Status (by means of the renaming_as_a_body
-- in the body of Asis_Environment)
--------------------------------------------------------------------
-----------------------------
-- Adding Call Information --
-----------------------------
procedure Add_Call_Information
(Outer_Call : String;
Argument : Asis.Element := Nil_Element;
Bool_Par : Boolean := False);
-- Adds in the ASIS diagnosis the information about dynamically enclosing
-- calls when an ASIS exception is propagated from some dynamically
-- enclosed routine. If Argument is not Nil, adds its debug image in the
-- Diagnosis, if needed (that is, if Argument_Postponed flag is set on,
-- and resets this flag OFF after that)
pragma No_Return (Raise_ASIS_Failed);
pragma No_Return (Raise_ASIS_Inappropriate_Compilation_Unit);
pragma No_Return (Raise_ASIS_Inappropriate_Element);
pragma No_Return (Not_Implemented_Yet);
-------------------------------------------
-- The revised code is below this header --
-------------------------------------------
---------------------------------------------------------------------
-- Data Objects for Handling the Diagnosis string and Error Status --
---------------------------------------------------------------------
Status_Indicator : Error_Kinds := Not_An_Error;
Diagnosis_Buffer : String (1 .. Max_Diagnosis_Length);
Diagnosis_Len : Natural range 0 .. Max_Diagnosis_Length := 0;
-- The string buffer to form ASIS Diagnosis
---------------------------
-- ASIS Error handling --
---------------------------
-- The following documentation item should be revised when the revising of
-- the ASIS exception handling is completed (BB14-010)
-- According to the ASIS Standard, only ASIS-defined exceptions are allowed
-- to be raised by ASIS queries.
--
-- The semantics of ASIS_Inappropriate_*** expectations well-defined and is
-- supposed to be implemented in full conformance with ASIS Standard
-- requirements.
--
-- According to Asis.Exceptions, ASIS_Failed is "is a catch-all exception
-- that may be raised for different reasons in different ASIS
-- implementations".
--
-- We are using the following approach to handing and reporting the
-- internal implementation errors and to raising ASIS_Failed.
--
-- 1. According to the (rather ill-defined) requirement of the ASIS
-- Standard and other documents generated during the ASIS
-- standardization process (in particular, "ASIS: Detailed Semantics and
-- Implementation. Ada Semantic Interface Specification. ASIS version
-- 1.1.1. April 26, 1994 by <NAME>), the body of every ASIS
-- query contains 'when OTHERS' exception handler which does not allow
-- any non-ASIS exception to propagate out of any ASIS query. (The
-- exception is a set of rather trivial bodies of ASIS queries for which
-- raising of non-ASIS exceptions is practically impossible).
--
-- 2. By default any unexpected exception raise (that is, raising of any
-- non-ASIS exception because of any reason) is treated as ASIS
-- implementation error which should be immediately reported and which
-- does not allow to continue the execution of any ASIS application.
-- That is, detection of such an error should result in immediate exit
-- to OS. This is implemented as the default behavior of all the ASIS
-- and ASIS extensions queries.
--
-- 3. An application may want to continue its execution even in case when
-- an internal ASIS implementation error is detected. (The reason could
-- be to try to use some workarounds for known ASIS implementation
-- problems and to get the required information by some other ways).
-- For this the application may set the Keep_Going flag ON by setting
-- '-k' parameter of Asis.Implementation.Initialize. As a result,
-- instead of generating the exit to OS, ASIS_Failed is raised with
-- Unhandled_Exception_Error status.
--
-- 4. We have some other reasons for raising ASIS_Failed. It can be raised
-- in case when ASIS is initialized with "treat ASIS warnings as errors"
-- mode as a part of generating of the ASIS warning. We have to use
-- ASIS_Failed here, because the ASIS Standard does not give us any
-- other choice. ASIS_Failed may also be raised by queries from
-- Asis.Compilation_Units which are not supposed to be used for a
-- dynamic Context. The important thing is that when ASIS_Failed is
-- raised as a result of ASIS warning, the Error Status can never be
-- Unhandled_Exception_Error
--
-- 5. The general approach to exception handling in our ASIS implementation
-- is:
--
-- - For every standard ASIS query and for every ASIS Extensions query
-- which is not trivial enough to conclude that raising of any
-- non-ASIS exception is practically impossible, the body of this
-- query should contain "when EX : OTHERS' handler, and the only
-- statement in this handler should be the call to Report_ASIS_Bug
-- procedure (see the documentation of this procedure below)
--
-- - For every standard ASIS query and for every ASIS Extensions query
-- which is not trivial enough to conclude that generating of the ASIS
-- failure is practically impossible or for which we can not be sure
-- that its implementation does not use any other ASIS queries, the
-- body of this query should contain the handler for ASIS_Failed with
-- the following code
--
-- when ASIS_Failed =>
-- is Status_Indicator = Unhandled_Exception_Error then
-- Add_Call_Information (...)
-- end if;
--
-- raise;
--
-- The idea in behind is: if ASIS_Failed is the result of the internal
-- ASIS implementation bug (that is, unexpected exception suppressed),
-- we are collecting the information of enclosing calls, this may be
-- useful if the call to one ASIS query is used in the implementation
-- of some other ASIS query, the full "trace" of calls of the ASIS
-- queries may be useful for an ASIS application programmer if (s)he
-- would like to provide protections for ASIS bugs and to use some
-- workarounds. And if ASIS_Failed is a result of ASIS warning, it
-- should just propagated out of ASIS with the Diagnosis string formed
-- as a part of error generation. ASIS_Failed raised when calling
-- Asis.Compilation_Units queries which can not be used for a dynamic
-- context could never be raised inside the call to an ASIS query
-- enclosed into a call to some other ASIS query.
procedure Report_ASIS_Bug
(Query_Name : String;
Ex : Exception_Occurrence;
Arg_Element : Asis.Element := Nil_Element;
Arg_Element_2 : Asis.Element := Nil_Element;
Arg_CU : Asis.Compilation_Unit := Nil_Compilation_Unit;
Arg_CU_2 : Asis.Compilation_Unit := Nil_Compilation_Unit;
Arg_Line : Asis.Text.Line := Nil_Line;
Arg_Span : Asis.Text.Span := Nil_Span;
Bool_Par_ON : Boolean := False;
Context_Par : Boolean := False
-- What else???
);
pragma No_Return (Report_ASIS_Bug);
-- This procedure is supposed to be called in "when OTHERS" exception
-- handlers of an ASIS queries only. If we are in such an exception
-- handler, then for sure we have detected some ASIS implementation bug.
-- Depending on the ASIS initialization options, this procedure may
-- perform the following options:
--
-- - generates the ASIS bug box similar to the GNAT bug box generated by
-- the GNAT Comperr.Compiler_Abort procedure.
--
-- - raises ASIS_Failed with the summary of the information which should
-- go into the ASIS bug box as the ASIS Diagnosis string
--
-- - causes the exit to OS.
--
-- Either exit to OS or raising ASIS_Failed should take place in any case.
-- In case of exit to OS, the ASIS bug box should be generated.
--
-- The call to this procedure should never result in exception raise (other
-- then raising ASIS_Failed by purpose), the worst case is that the
-- diagnostic information formed by this procedure is incomplete.
--
-- Query_Name should be set to the full expanded Ada name of the query
-- where this procedure is called
--
-- Ex should be the exception name form enclosing "when Ex : others"
-- handlers.
--
-- All the other parameters are used to compose some debug information
-- about the parameters of the call which fails. Some ASIS queries have
-- two Element or Compilation Unit parameters, that's why we need
-- Arg_Element_2 and Arg_CU_2. For queries having only one Element or CU
-- parameter, Arg_Element or Arg_CU should be used to pass the argument of
-- the call to form the diagnostic info.
end A4G.Vcheck;
|
source/strings/a-szecin.ads | ytomino/drake | 33 | 5173 | pragma License (Unrestricted);
-- Ada 2012
with Ada.Characters.Conversions;
with Ada.Strings.Generic_Equal_Case_Insensitive;
function Ada.Strings.Wide_Wide_Equal_Case_Insensitive is
new Generic_Equal_Case_Insensitive (
Wide_Wide_Character,
Wide_Wide_String,
Characters.Conversions.Get);
-- pragma Pure (Ada.Strings.Wide_Wide_Equal_Case_Insensitive);
pragma Preelaborate (Ada.Strings.Wide_Wide_Equal_Case_Insensitive); -- use maps
|
gi_01/src/wa1.ads | gerr135/gnat_bugs | 0 | 3470 | with Ada.Containers.Vectors;
package wa1 is
type Repr(<>) is private;
type Abstract_Base is interface;
function ToRepr(AB : Abstract_Base) return Repr is abstract;
procedure FromRepr(AB : in out Abstract_Base; rp : Repr) is abstract;
procedure Set_Smth (AB : in out Abstract_Base'Class; smth : Integer);
-----------------------------------------------
type Base is new Abstract_Base with private;
overriding
function ToRepr(B : Base) return Repr;
overriding
procedure FromRepr(B : in out Base; R : Repr);
private
type Smth_Array is array (Positive range <>) of Integer;
type Repr(Size : Natural) is record
smth : Integer;
sa : Smth_Array(1..Size);
end record;
----------------------------------------------------------------
package ACV is new Ada.Containers.Vectors(Positive, Integer);
type Base is new Abstract_Base with record
smth : Integer;
sv : ACV.Vector;
end record;
end wa1;
|
Cubical/Data/Empty/Properties.agda | limemloh/cubical | 0 | 2807 | {-# OPTIONS --cubical --safe #-}
module Cubical.Data.Empty.Properties where
open import Cubical.Core.Everything
open import Cubical.Foundations.Prelude
open import Cubical.Data.Empty.Base
isProp⊥ : isProp ⊥
isProp⊥ x = ⊥-elim x
|
Data/List/Permute.agda | oisdk/agda-playground | 6 | 1020 | <reponame>oisdk/agda-playground
{-# OPTIONS --cubical #-}
module Data.List.Permute where
open import Prelude
open import Data.Nat
open import Data.Nat.Properties using (_≤ᴮ_)
infixr 5 _∹_∷_
data Premuted {a} (A : Type a) : Type a where
[] : Premuted A
_∹_∷_ : ℕ → A → Premuted A → Premuted A
mutual
merge : Premuted A → Premuted A → Premuted A
merge [] = id
merge (n ∹ x ∷ xs) = mergeˡ n x (merge xs)
mergeˡ : ℕ → A → (Premuted A → Premuted A) → Premuted A → Premuted A
mergeˡ i x xs [] = i ∹ x ∷ xs []
mergeˡ i x xs (j ∹ y ∷ ys) = merge⁺ i x xs j y ys (i ≤ᴮ j)
merge⁺ : ℕ → A → (Premuted A → Premuted A) → ℕ → A → Premuted A → Bool → Premuted A
merge⁺ i x xs j y ys true = i ∹ x ∷ xs ((j ∸ i) ∹ y ∷ ys)
merge⁺ i x xs j y ys false = j ∹ y ∷ mergeˡ ((i ∸ j) ∸ 1) x xs ys
merge-idʳ : (xs : Premuted A) → merge xs [] ≡ xs
merge-idʳ [] = refl
merge-idʳ (i ∹ x ∷ xs) = cong (i ∹ x ∷_) (merge-idʳ xs)
open import Algebra
≤≡-trans : ∀ x y z → (x ≤ᴮ y) ≡ true → (y ≤ᴮ z) ≡ true → (x ≤ᴮ z) ≡ true
≤≡-trans zero y z p₁ p₂ = refl
≤≡-trans (suc x) zero z p₁ p₂ = ⊥-elim (subst (bool ⊤ ⊥) p₁ tt)
≤≡-trans (suc x) (suc y) zero p₁ p₂ = ⊥-elim (subst (bool ⊤ ⊥) p₂ tt)
≤≡-trans (suc x) (suc y) (suc z) p₁ p₂ = ≤≡-trans x y z p₁ p₂
<≡-trans : ∀ x y z → (x ≤ᴮ y) ≡ false → (y ≤ᴮ z) ≡ false → (x ≤ᴮ z) ≡ false
<≡-trans zero y z p₁ p₂ = ⊥-elim (subst (bool ⊥ ⊤) p₁ tt)
<≡-trans (suc x) zero z p₁ p₂ = ⊥-elim (subst (bool ⊥ ⊤) p₂ tt)
<≡-trans (suc x) (suc y) zero p₁ p₂ = p₂
<≡-trans (suc x) (suc y) (suc z) p₁ p₂ = <≡-trans x y z p₁ p₂
≤≡-sub : ∀ i j k → (j ≤ᴮ k) ≡ true → (j ∸ i ≤ᴮ k ∸ i) ≡ true
≤≡-sub zero j k p = p
≤≡-sub (suc i) zero k p = refl
≤≡-sub (suc i) (suc j) zero p = ⊥-elim (subst (bool ⊤ ⊥) p tt)
≤≡-sub (suc i) (suc j) (suc k) p = ≤≡-sub i j k p
≥≡-sub : ∀ i j k → (j ≤ᴮ k) ≡ false → (i ≤ᴮ k) ≡ true → (j ∸ i ≤ᴮ k ∸ i) ≡ false
≥≡-sub i zero k p _ = ⊥-elim (subst (bool ⊥ ⊤) p tt)
≥≡-sub zero (suc j) k p _ = p
≥≡-sub (suc i) (suc j) zero p p₂ = ⊥-elim (subst (bool ⊤ ⊥) p₂ tt)
≥≡-sub (suc i) (suc j) (suc k) p p₂ = ≥≡-sub i j k p p₂
<≡-sub : ∀ i j k → (i ≤ᴮ j) ≡ false → (j ≤ᴮ k) ≡ false → (i ∸ k ∸ 1 ≤ᴮ j ∸ k ∸ 1) ≡ false
<≡-sub zero j k p _ = ⊥-elim (subst (bool ⊥ ⊤) p tt)
<≡-sub (suc i) zero k p p₂ = ⊥-elim (subst (bool ⊥ ⊤) p₂ tt)
<≡-sub (suc i) (suc j) zero p p₂ = p
<≡-sub (suc i) (suc j) (suc k) p p₂ = <≡-sub i j k p p₂
>≡-sub : ∀ i j k → (i ≤ᴮ j) ≡ true → (j ≤ᴮ k) ≡ false → (i ≤ᴮ k) ≡ false → (i ∸ k ∸ 1 ≤ᴮ j ∸ k ∸ 1) ≡ true
>≡-sub i zero k p₁ p₂ p₃ = ⊥-elim (subst (bool ⊥ ⊤) p₂ tt)
>≡-sub zero (suc j) k p₁ p₂ p₃ = ⊥-elim (subst (bool ⊥ ⊤) p₃ tt)
>≡-sub (suc i) (suc j) zero p₁ p₂ p₃ = p₁
>≡-sub (suc i) (suc j) (suc k) p₁ p₂ p₃ = >≡-sub i j k p₁ p₂ p₃
zero-sub : ∀ n → zero ∸ n ≡ zero
zero-sub zero = refl
zero-sub (suc n) = refl
≤-sub-id : ∀ i j k → (i ≤ᴮ j) ≡ true → k ∸ i ∸ (j ∸ i) ≡ k ∸ j
≤-sub-id zero j k p = refl
≤-sub-id (suc i) zero k p = ⊥-elim (subst (bool ⊤ ⊥) p tt)
≤-sub-id (suc i) (suc j) zero p = zero-sub (j ∸ i)
≤-sub-id (suc i) (suc j) (suc k) p = ≤-sub-id i j k p
lemma₁ : ∀ i j k → (j ≤ᴮ k) ≡ false → i ∸ k ∸ 1 ∸ (j ∸ k ∸ 1) ∸ 1 ≡ i ∸ j ∸ 1
lemma₁ zero j k _ = cong (λ zk → zk ∸ 1 ∸ (j ∸ k ∸ 1) ∸ 1) (zero-sub k) ; cong (_∸ 1) (zero-sub (j ∸ k ∸ 1)) ; sym (cong (_∸ 1) (zero-sub j))
lemma₁ (suc i) zero k p₂ = ⊥-elim (subst (bool ⊥ ⊤) p₂ tt)
lemma₁ (suc i) (suc j) zero p₂ = refl
lemma₁ (suc i) (suc j) (suc k) p₂ = lemma₁ i j k p₂
lemma₂ : ∀ i j k → (i ≤ᴮ j) ≡ true → (j ≤ᴮ k) ≡ false → (i ≤ᴮ k) ≡ false → j ∸ i ≡ j ∸ k ∸ 1 ∸ (i ∸ k ∸ 1)
lemma₂ i zero k p₁ p₂ p₃ = ⊥-elim (subst (bool ⊥ ⊤) p₂ tt)
lemma₂ zero (suc j) k p₁ p₂ p₃ = ⊥-elim (subst (bool ⊥ ⊤) p₃ tt)
lemma₂ (suc i) (suc j) zero p₁ p₂ p₃ = refl
lemma₂ (suc i) (suc j) (suc k) p₁ p₂ p₃ = lemma₂ i j k p₁ p₂ p₃
{-# TERMINATING #-}
merge-assoc : Associative (merge {A = A})
merge-assoc [] ys zs = refl
merge-assoc (i ∹ x ∷ xs) [] zs = cong (flip merge zs) (merge-idʳ (i ∹ x ∷ xs))
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) [] = merge-idʳ (merge (i ∹ x ∷ xs) (j ∹ y ∷ ys)) ; sym (cong (merge (i ∹ x ∷ xs)) (merge-idʳ (j ∹ y ∷ ys)))
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) with merge-assoc xs (j ∸ i ∹ y ∷ ys) (k ∸ i ∹ z ∷ zs) | merge-assoc (i ∸ k ∸ 1 ∹ x ∷ xs) (j ∸ k ∸ 1 ∹ y ∷ ys) zs | (merge-assoc (i ∸ j ∸ 1 ∹ x ∷ xs) ys (k ∸ j ∹ z ∷ zs)) | i ≤ᴮ j | inspect (i ≤ᴮ_) j | j ≤ᴮ k | inspect (j ≤ᴮ_) k
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | r | _ | _ | true | 〖 ij 〗 | true | 〖 jk 〗 = cong (merge⁺ i x (merge (merge xs (j ∸ i ∹ y ∷ ys))) k z zs) (≤≡-trans i j k ij jk) ;
cong (i ∹ x ∷_) (r ;
cong (merge xs) (cong (merge⁺ (j ∸ i) y (merge ys) (k ∸ i) z zs) (≤≡-sub i j k jk) ; cong (λ kij → j ∸ i ∹ y ∷ merge ys (kij ∹ z ∷ zs)) (≤-sub-id i j k ij))) ;
cong (merge⁺ i x (merge xs) j y (merge ys (k ∸ j ∹ z ∷ zs))) (sym ij)
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | _ | r | _ | false | 〖 ij 〗 | false | 〖 jk 〗 = cong (merge⁺ j y (merge (mergeˡ (i ∸ j ∸ 1) x (merge xs) ys)) k z zs ) jk ;
cong (k ∹ z ∷_) (cong (λ s → mergeˡ (j ∸ k ∸ 1) y (merge (mergeˡ s x (merge xs) ys)) zs) (sym (lemma₁ i j k jk)) ;
cong (λ s → merge (merge⁺ (i ∸ k ∸ 1) x (merge xs) (j ∸ k ∸ 1) y ys s) zs) (sym (<≡-sub i j k ij jk)) ;
r) ;
cong (merge⁺ i x (merge xs) k z (mergeˡ (j ∸ k ∸ 1) y (merge ys) zs)) (sym (<≡-trans i j k ij jk))
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | _ | _ | r | false | 〖 ij 〗 | true | 〖 jk 〗 = cong (merge⁺ j y (merge (mergeˡ (i ∸ j ∸ 1) x (merge xs) ys)) k z zs) jk ;
cong (j ∹ y ∷_) r ;
cong (merge⁺ i x (merge xs) j y (merge ys (k ∸ j ∹ z ∷ zs))) (sym ij)
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | _ | _ | _ | true | ij | false | jk with i ≤ᴮ k | inspect (i ≤ᴮ_) k
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | _ | r | _ | true | 〖 ij 〗 | false | 〖 jk 〗 | false | 〖 ik 〗 = cong (k ∹ z ∷_) ((cong (λ s → mergeˡ (i ∸ k ∸ 1) x (merge (merge xs (s ∹ y ∷ ys))) zs) (lemma₂ i j k ij jk ik) ;
cong (λ c → merge (merge⁺ (i ∸ k ∸ 1) x (merge xs) (j ∸ k ∸ 1) y ys c) zs) (sym (>≡-sub i j k ij jk ik ))) ;
r )
merge-assoc (i ∹ x ∷ xs) (j ∹ y ∷ ys) (k ∹ z ∷ zs) | r | _ | _ | true | 〖 ij 〗 | false | 〖 jk 〗 | true | 〖 ik 〗 = cong (i ∹ x ∷_) (r ;
cong (merge xs) (cong (merge⁺ (j ∸ i) y (merge ys) (k ∸ i) z zs) (≥≡-sub i j k jk ik) ;
cong (λ s → k ∸ i ∹ z ∷ mergeˡ s y (merge ys) zs) (cong (_∸ 1) (≤-sub-id i k j ik)) ))
open import Data.List
index : List ℕ → List A → List (Premuted A)
index _ [] = []
index [] (x ∷ xs) = (0 ∹ x ∷ []) ∷ index [] xs
index (i ∷ is) (x ∷ xs) = (i ∹ x ∷ []) ∷ index is xs
unindex : Premuted A → List A
unindex [] = []
unindex (_ ∹ x ∷ xs) = x ∷ unindex xs
open import TreeFold
shuffle : List ℕ → List A → List A
shuffle is = unindex ∘ treeFold merge [] ∘ index is
open import Data.List.Syntax
e : List ℕ
e = shuffle [ 0 , 1 , 0 ] [ 1 , 2 , 3 ]
|
Task/Averages-Simple-moving-average/Ada/averages-simple-moving-average-1.ada | LaudateCorpus1/RosettaCodeData | 1 | 21811 | <filename>Task/Averages-Simple-moving-average/Ada/averages-simple-moving-average-1.ada<gh_stars>1-10
generic
Max_Elements : Positive;
type Number is digits <>;
package Moving is
procedure Add_Number (N : Number);
function Moving_Average (N : Number) return Number;
function Get_Average return Number;
end Moving;
|
theorems/cw/cohomology/HigherCoboundary.agda | mikeshulman/HoTT-Agda | 0 | 6029 | <reponame>mikeshulman/HoTT-Agda
{-# OPTIONS --without-K --rewriting #-}
open import HoTT
open import groups.Cokernel
open import cohomology.Theory
open import cw.CW
module cw.cohomology.HigherCoboundary {i} (OT : OrdinaryTheory i)
{n} (⊙skel : ⊙Skeleton {i} (S (S n))) where
open OrdinaryTheory OT
open import cw.cohomology.WedgeOfCells OT
open import cw.cohomology.GridLongExactSequence cohomology-theory
(ℕ-to-ℤ (S n)) (⊙cw-incl-last (⊙cw-init ⊙skel)) (⊙cw-incl-last ⊙skel)
cw-co∂-last : CXₙ/Xₙ₋₁ (⊙cw-init ⊙skel) (ℕ-to-ℤ (S n)) →ᴳ CXₙ/Xₙ₋₁ ⊙skel (ℕ-to-ℤ (S (S n)))
cw-co∂-last = grid-co∂
module CokerCo∂ where
grp = Coker cw-co∂-last (CXₙ/Xₙ₋₁-is-abelian ⊙skel (ℕ-to-ℤ (S (S n))))
open Group grp public
CokerCo∂ = CokerCo∂.grp
|
src/util/oli/app/sortlst.asm | olifink/qspread | 0 | 101441 | ; sort list of pointers
include win1_mac_oli
section utility
xdef ut_sortlst
;+++
; sort list of string pointers
;
; Entry Exit
; d1.l 0 or nr. of elements
; a1 ptr to list
;
; errors: imem
; cc set
;+++
ut_sortlst subr a0-a3/d1-d3
tst.l d1
bne.s nr_known
xjsr ut_cntlst ; count nr of elements
nr_known
move.l a1,a0 ; a0 final index
xjsr ut_allst ; allocate space for temp index
bne.s exit
xjsr ut_cpylst ; copy to temp list
move.l a0,a2 ; a2 final running pointer
move.l a1,a3 ; a3 unsorted list adr
bra.s start
again bsr.s rival ; get valid rival ptr
beq.s eol ; no more rivals.. smallest found
bsr.s compare ; compare rival to smallest
bpl.s nochg ; rival is bigger.. no change
move.l a0,a1 ; rival becomes smallest
nochg addq.w #4,a0 ; next rival in list
bra.s again ; ..try again
eol move.l (a1),d0 ; ptr to smallest string
move.l d0,(a2)+ ; put smallest in final list
move.l #1,(a1) ; blank it out of unsorted list
start move.l a3,a0 ; first is new rival
bsr.s rival ; get a real rival ptr
beq.s nomore ; no more rivals found?
move.l a0,a1 ; first is new smallest
bra.s again ; for all elements
nomore clr.l (a2) ; end of final list
move.l a3,a0
xjsr ut_rechp
exit subend
; mi = eol
; eq = smaller
; ne = no change
compare subr a0/a1/d1
move.l (a0),a0 ; rival string
move.l (a1),a1 ; smallest string
moveq #1,d0 ; basic comparison
xjsr st_cmpst ; compare strings
subend
deleted addq.l #4,a0 ; try next entry
rival move.l (a0),d0 ; rival entry
beq.s str_eol ; end of list reached
cmp.l #1,d0 ; rival deleted?
beq.s deleted
str_eol rts
end
|
Cubical/Homotopy/Freudenthal.agda | knrafto/cubical | 0 | 11847 | <reponame>knrafto/cubical
{-
Freudenthal suspension theorem
-}
{-# OPTIONS --cubical --no-import-sorts --safe #-}
module Cubical.Homotopy.Freudenthal where
open import Cubical.Foundations.Everything
open import Cubical.Data.HomotopyGroup
open import Cubical.Data.Nat
open import Cubical.Data.Sigma
open import Cubical.HITs.Nullification
open import Cubical.HITs.Susp
open import Cubical.HITs.Truncation as Trunc renaming (rec to trRec)
open import Cubical.Homotopy.Connected
open import Cubical.Homotopy.WedgeConnectivity
open import Cubical.Homotopy.Loopspace
module _ {ℓ} (n : HLevel) {A : Pointed ℓ} (connA : isConnected (suc (suc n)) (typ A)) where
σ : typ A → typ (Ω (∙Susp (typ A)))
σ a = merid a ∙ merid (pt A) ⁻¹
private
2n+2 = suc n + suc n
module WC (p : north ≡ north) =
WedgeConnectivity (suc n) (suc n) A connA A connA
(λ a b →
( (σ b ≡ p → hLevelTrunc 2n+2 (fiber (λ x → merid x ∙ merid a ⁻¹) p))
, isOfHLevelΠ 2n+2 λ _ → isOfHLevelTrunc 2n+2
))
(λ a r → ∣ a , (rCancel' (merid a) ∙ rCancel' (merid (pt A)) ⁻¹) ∙ r ∣)
(λ b r → ∣ b , r ∣)
(funExt λ r →
cong′ (λ w → ∣ pt A , w ∣)
(cong (_∙ r) (rCancel' (rCancel' (merid (pt A))))
∙ lUnit r ⁻¹))
fwd : (p : north ≡ north) (a : typ A)
→ hLevelTrunc 2n+2 (fiber σ p)
→ hLevelTrunc 2n+2 (fiber (λ x → merid x ∙ merid a ⁻¹) p)
fwd p a = Trunc.rec (isOfHLevelTrunc 2n+2) (uncurry (WC.extension p a))
isEquivFwd : (p : north ≡ north) (a : typ A) → isEquiv (fwd p a)
isEquivFwd p a .equiv-proof =
elim.isEquivPrecompose (λ _ → pt A) (suc n)
(λ a →
( (∀ t → isContr (fiber (fwd p a) t))
, isProp→isOfHLevelSuc n (isPropΠ λ _ → isPropIsContr)
))
(isConnectedPoint (suc n) connA (pt A))
.equiv-proof
(λ _ → Trunc.elim
(λ _ → isProp→isOfHLevelSuc (n + suc n) isPropIsContr)
(λ fib →
subst (λ k → isContr (fiber k ∣ fib ∣))
(cong (Trunc.rec (isOfHLevelTrunc 2n+2) ∘ uncurry)
(funExt (WC.right p) ⁻¹))
(subst isEquiv
(funExt (Trunc.mapId) ⁻¹)
(idIsEquiv _)
.equiv-proof ∣ fib ∣)
))
.fst .fst a
interpolate : (a : typ A)
→ PathP (λ i → typ A → north ≡ merid a i) (λ x → merid x ∙ merid a ⁻¹) merid
interpolate a i x j = compPath-filler (merid x) (merid a ⁻¹) (~ i) j
Code : (y : Susp (typ A)) → north ≡ y → Type ℓ
Code north p = hLevelTrunc 2n+2 (fiber σ p)
Code south q = hLevelTrunc 2n+2 (fiber merid q)
Code (merid a i) p =
Glue
(hLevelTrunc 2n+2 (fiber (interpolate a i) p))
(λ
{ (i = i0) → _ , (fwd p a , isEquivFwd p a)
; (i = i1) → _ , idEquiv _
})
encode : (y : Susp (typ A)) (p : north ≡ y) → Code y p
encode y = J Code ∣ pt A , rCancel' (merid (pt A)) ∣
encodeMerid : (a : typ A) → encode south (merid a) ≡ ∣ a , refl ∣
encodeMerid a =
cong (transport (λ i → gluePath i))
(funExt⁻ (WC.left refl a) _ ∙ cong ∣_∣ (cong (a ,_) (lem _ _)))
∙ transport (PathP≡Path gluePath _ _)
(λ i → ∣ a , (λ j k → rCancel-filler' (merid a) i j k) ∣)
where
gluePath : I → Type _
gluePath i = hLevelTrunc 2n+2 (fiber (interpolate a i) (λ j → merid a (i ∧ j)))
lem : ∀ {ℓ} {A : Type ℓ} {x y z : A} (p : x ≡ y) (q : z ≡ y) → (p ∙ q ⁻¹) ∙ q ≡ p
lem p q = assoc p (q ⁻¹) q ⁻¹ ∙ cong (p ∙_) (lCancel q) ∙ rUnit p ⁻¹
contractCodeSouth : (p : north ≡ south) (c : Code south p) → encode south p ≡ c
contractCodeSouth p =
Trunc.elim
(λ _ → isOfHLevelPath 2n+2 (isOfHLevelTrunc 2n+2) _ _)
(uncurry λ a →
J (λ p r → encode south p ≡ ∣ a , r ∣) (encodeMerid a))
isConnectedMerid : isConnectedFun 2n+2 (merid {A = typ A})
isConnectedMerid p = encode south p , contractCodeSouth p
isConnectedσ : isConnectedFun 2n+2 σ
isConnectedσ =
transport (λ i → isConnectedFun 2n+2 (interpolate (pt A) (~ i))) isConnectedMerid
FreudenthalEquiv : ∀ {ℓ} (n : HLevel) (A : Pointed ℓ)
→ isConnected (2 + n) (typ A)
→ hLevelTrunc ((suc n) + (suc n)) (typ A)
≃ hLevelTrunc ((suc n) + (suc n)) (typ (Ω (Susp (typ A) , north)))
FreudenthalEquiv n A iscon = connectedTruncEquiv _
(σ n {A = A} iscon)
(isConnectedσ _ iscon)
FreudenthalIso : ∀ {ℓ} (n : HLevel) (A : Pointed ℓ)
→ isConnected (2 + n) (typ A)
→ Iso (hLevelTrunc ((suc n) + (suc n)) (typ A))
(hLevelTrunc ((suc n) + (suc n)) (typ (Ω (Susp (typ A) , north))))
FreudenthalIso n A iscon = connectedTruncIso _ (σ n {A = A} iscon) (isConnectedσ _ iscon)
|
test/Succeed/Issue153.agda | shlevy/agda | 3 | 14165 | {-# OPTIONS --allow-unsolved-metas #-}
-- This file documents a bug caused by one of the fixes for issue 153.
module Issue153 where
open import Common.Coinduction
record R : Set₁ where
field
S : Set
T : S → Set
module D (r : R) (s : R.S r) where
open R r
data D (t : T s) : Set where
module M (r : R) (s : R.S r) where
open R r
open D _ s
postulate
t : T s
d : D t
foo : ∞ (D t)
foo = ♯ d
-- An internal error has occurred. Please report this as a bug.
-- Location of the error: src/full/Agda/Interaction/Highlighting/Generate.hs:383
|
image_random_test.adb | jrcarter/Image_Random | 1 | 28912 | -- Image_Random_Test: Test of Image_Random
-- Copyright (C) 2020 by Pragmada Software Engineering
-- Released under the terms of the BSD 3-Clause license; see https://opensource.org/licenses
--
-- 2020-09-01 Initial version
--
with Ada.Streams;
with Ada.Text_IO;
with Image_Random;
procedure Image_Random_Test is
Rand : constant Ada.Streams.Stream_Element_Array := Image_Random.Random;
begin -- Image_Random_Test
Put : for I in Rand'Range loop
Ada.Text_IO.Put_Line (Item => Ada.Streams.Stream_Element'Image (Rand (I) ) );
end loop Put;
end Image_Random_Test;
|
oeis/003/A003053.asm | neoneye/loda-programs | 11 | 20123 | <reponame>neoneye/loda-programs<filename>oeis/003/A003053.asm
; A003053: Order of orthogonal group O(n, GF(2)).
; Submitted by <NAME>(s2)
; 1,2,6,48,720,23040,1451520,185794560,47377612800,24257337753600,24815256521932800,50821645356918374400,208114637736580743168000,1704875112338069448032256000,27930968965434591767112450048000,915241991059360703024740763172864000,59980383884075203672726385914533642240000,7861748876453505095791592854589753555681280000,2060902435720151186326095525680721766346957783040000,1080506416218846625176535970968094253434513802154475520000,1132992015386677099994486205757869431795095310094129168384000000
mov $1,49
mov $3,1
lpb $0
sub $0,1
mul $2,2
add $3,1
add $4,$3
mul $1,$4
mov $3,$2
mov $2,$4
lpe
mov $0,$1
div $0,49
|
oeis/216/A216315.asm | neoneye/loda-programs | 11 | 91215 | ; A216315: Primes congruent to 1 mod 59.
; Submitted by <NAME>
; 709,827,1063,1181,1889,2243,2833,3187,3541,3659,4013,4603,4721,4957,5783,6373,6491,7789,7907,8969,9323,9677,10267,10739,11093,11329,11447,11801,12037,12391,13099,13217,13807,14633,14869,16993,19471,20297,20533,20887,21713,22067,22303,23011,23719,24781,25253,26669,27259,27967,28439,28793,29147,29383,29501,30091,31153,31271,32569,32687,33749,34457,34693,35401,36109,37171,37643,37879,37997,38351,40357,40829,41183,42953,43189,43543,43661,44959,45077,45667,46021,47791,49207,50033,50387,50741,51449
mov $2,$0
add $2,6
pow $2,2
lpb $2
mov $3,$4
mul $3,2
seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0.
sub $0,$3
mov $1,$0
max $1,0
cmp $1,$0
mul $2,$1
sub $2,1
add $4,59
lpe
mov $0,$4
sub $0,354
mul $0,2
add $0,709
|
test/Succeed/Issue2792.agda | shlevy/agda | 1,989 | 10221 | <reponame>shlevy/agda<gh_stars>1000+
{-# OPTIONS --rewriting #-}
module Issue2792 where
open import Issue2792.Safe
|
Ask Wolfram Alpha.applescript | n8henrie/qs_wolframalpha | 0 | 3804 | <reponame>n8henrie/qs_wolframalpha
on process_text(query)
(*
Assumes you've made a keychain entry with service named `wolframalpha`
and account named `appid`, otherwise just put your appid here
*)
set appid to do shell script "security find-generic-password -s wolframalpha -a appid -w"
set response to do shell script "/usr/local/bin/python3 /path/to/qs_wolframalpha/qs_wolframalpha.py " & appid & " " & quoted form of query
return response
end process_text
using terms from application "Quicksilver"
on get direct types
return {"NSStringPboardType"}
end get direct types
on process text query
try
set response to process_text(query)
tell application "Quicksilver" to set selection to response
on error a number b
activate
display dialog a with title "error with your QS action script"
end try
end process text
end using terms from
on run
set query to text returned of (display dialog "What do you want to ask Wolfram Alpha?" default answer "convert 38 mm to in")
set response to process_text(query)
display dialog response
end run
|
Source/ncurses.adb | bkold/Terminal-Chess | 0 | 9734 | package body NCurses is
procedure Start_Color_Init is
begin
Start_Color;
Init_Color_Pair(1, COLOR_WHITE, COLOR_BLACK);
Init_Color_Pair(2, COLOR_BLACK, COLOR_WHITE);
Init_Color_Pair(3, COLOR_RED, COLOR_BLACK);
Setup;
end Start_Color_Init;
procedure Pretty_Print_Window (Item : in String) is
begin
Print_Window(Item & ASCII.nul);
end Pretty_Print_Window;
procedure Pretty_Print_Line_Window (Item : in String) is
begin
Print_Window(Item & ASCII.lf & ASCII.nul);
end Pretty_Print_Line_Window;
end NCurses; |
programs/oeis/247/A247060.asm | neoneye/loda | 22 | 9983 | ; A247060: Dynamic Betting Game D(n,4,1).
; 1,5,8,12,16,17,21,24,28,32,33,37,40,44,48,49,53,56,60,64,65,69,72,76,80,81,85,88,92,96,97,101,104,108,112,113,117,120,124,128,129,133,136,140,144,145,149,152,156,160,161,165,168,172,176,177,181,184,188,192,193,197,200,204,208,209,213,216,220,224,225,229,232,236,240,241,245,248,252,256,257,261,264,268,272,273,277,280,284,288,289,293,296,300,304,305,309,312,316,320
mov $2,$0
add $2,1
mov $4,$0
lpb $2
mov $0,$4
sub $2,1
sub $0,$2
mul $0,7
mov $3,0
mov $5,0
lpb $0
sub $0,5
lpe
lpb $0
add $5,3
mov $3,$5
sub $5,$0
trn $0,2
lpe
add $3,1
add $1,$3
lpe
mov $0,$1
|
data/wild/maps/Route24.asm | opiter09/ASM-Machina | 1 | 24352 | <filename>data/wild/maps/Route24.asm
Route24WildMons:
def_grass_wildmons 25 ; encounter rate
db 23, KRABBY
db 25, POLIWAG
db 23, SQUIRTLE
db 23, SHELLDER
db 24, KRABBY
db 22, PIDGEOTTO
db 24, GLOOM
db 23, BEEDRILL
db 26, SQUIRTLE
db 27, SHELLDER
end_grass_wildmons
def_water_wildmons 0 ; encounter rate
end_water_wildmons
|
src/security-oauth-clients.ads | jquorning/ada-security | 19 | 2863 | <gh_stars>10-100
-----------------------------------------------------------------------
-- security-oauth -- OAuth Security
-- Copyright (C) 2012, 2013, 2016, 2017, 2018, 2019 <NAME>
-- Written by <NAME> (<EMAIL>)
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.
-----------------------------------------------------------------------
with Ada.Strings.Unbounded;
-- == OAuth Client ==
-- The `Security.OAuth.Clients` package implements the client OAuth 2.0 authorization.
--
-- === Application setup ===
-- For an OAuth2 client application to authenticate, it must be registered on the server
-- and the server provides the following information:
--
-- * **client_id**: the client identifier is a unique string that identifies the application.
-- * **client_secret** the client secret is a secret shared between the server and the
-- client application. The client secret is optional.
--
-- The `Security.OAuth.Clients.Application` tagged record is the primary type that
-- allows to perform one of the OAuth 2.0 authorization flows. It is necessary to
-- declare an `Application` instance and register the **client_id**, the **client_secret**
-- and the authorisation URLs to connect to the server.
--
-- App : Security.OAuth.Clients.Application;
-- ...
-- App.Set_Application_Identifier ("app-identifier");
-- App.Set_Application_Secret ("app-secret");
-- App.Set_Provider_URL ("https://graph.facebook.com/oauth/access_token");
--
--
-- === Resource Owner Password Credentials Grant ===
-- The RFC 6749: 4.3. Resource Owner Password Credentials Grant allows to authorize an
-- application by using the user's name and password. This is the simplest OAuth flow
-- but because it requires to know the user's name and password, it is not recommended and
-- not supported by several servers. To use this authorization, the application will use
-- the `Request_Token` procedure and will give the user's name, password and the scope
-- of permissions. When the authorization succeeds, a `Grant_Type` token object is returned.
--
-- Token : Security.OAuth.Clients.Grant_Type;
-- ...
-- App.Request_Token ("admin", "admin", "scope", Token);
--
-- === Refreshing an access token ===
-- An access token has an expiration date and a new access token must be asked by using the
-- refresh token. When the access token has expired, the grant token object can be refreshed
-- to retrieve a new access token by using the `Refresh_Token` procedure. The scope of
-- permissions can also be passsed.
--
-- App.Refresh_Token ("scope", Token);
--
package Security.OAuth.Clients is
-- Note: OAuth 1.0 could be implemented but since it's being deprecated
-- it's not worth doing it.
-- ------------------------------
-- Access Token
-- ------------------------------
-- Access tokens are credentials used to access protected resources.
-- The access token is represented as a <b>Principal</b>. This is an opaque
-- value for an application.
type Access_Token (Len : Natural) is new Security.Principal with private;
type Access_Token_Access is access all Access_Token'Class;
-- Get the principal name. This is the OAuth access token.
function Get_Name (From : in Access_Token) return String;
type OpenID_Token (Len, Id_Len, Refresh_Len : Natural) is new Access_Token with private;
type OpenID_Token_Access is access all OpenID_Token'Class;
-- Get the id_token that was returned by the authentication process.
function Get_Id_Token (From : in OpenID_Token) return String;
-- Generate a random nonce with at last the number of random bits.
-- The number of bits is rounded up to a multiple of 32.
-- The random bits are then converted to base64url in the returned string.
function Create_Nonce (Bits : in Positive := 256) return String;
type Grant_Type is new Security.Principal with private;
-- Get the principal name. This is the OAuth access token.
function Get_Name (From : in Grant_Type) return String;
-- Get the Authorization header to be used for accessing a protected resource.
-- (See RFC 6749 7. Accessing Protected Resources)
function Get_Authorization (From : in Grant_Type) return String;
-- ------------------------------
-- Application
-- ------------------------------
-- The <b>Application</b> holds the necessary information to let a user
-- grant access to its protected resources on the resource server. It contains
-- information that allows the OAuth authorization server to identify the
-- application (client id and secret key).
type Application is new Security.OAuth.Application with private;
-- Set the OAuth authorization server URI that the application must use
-- to exchange the OAuth code into an access token.
procedure Set_Provider_URI (App : in out Application;
URI : in String);
-- OAuth 2.0 Section 4.1.1 Authorization Request
-- Build a unique opaque value used to prevent cross-site request forgery.
-- The <b>Nonce</b> parameters is an optional but recommended unique value
-- used only once. The state value will be returned back by the OAuth provider.
-- This protects the <tt>client_id</tt> and <tt>redirect_uri</tt> parameters.
function Get_State (App : in Application;
Nonce : in String) return String;
-- Get the authenticate parameters to build the URI to redirect the user to
-- the OAuth authorization form.
function Get_Auth_Params (App : in Application;
State : in String;
Scope : in String := "") return String;
-- OAuth 2.0 Section 4.1.2 Authorization Response
-- Verify that the <b>State</b> opaque value was created by the <b>Get_State</b>
-- operation with the given client and redirect URL.
function Is_Valid_State (App : in Application;
Nonce : in String;
State : in String) return Boolean;
-- OAuth 2.0 Section 4.1.3. Access Token Request
-- Section 4.1.4. Access Token Response
-- Exchange the OAuth code into an access token.
function Request_Access_Token (App : in Application;
Code : in String) return Access_Token_Access;
-- Get a request token with username and password.
-- RFC 6749: 4.3. Resource Owner Password Credentials Grant
procedure Request_Token (App : in Application;
Username : in String;
Password : in String;
Scope : in String;
Token : in out Grant_Type'Class);
-- Refresh the access token.
-- RFC 6749: 6. Refreshing an Access Token
procedure Refresh_Token (App : in Application;
Scope : in String;
Token : in out Grant_Type'Class);
-- Create the access token
function Create_Access_Token (App : in Application;
Token : in String;
Refresh : in String;
Id_Token : in String;
Expires : in Natural) return Access_Token_Access;
private
type Access_Token (Len : Natural) is new Security.Principal with record
Access_Id : String (1 .. Len);
end record;
type OpenID_Token (Len, Id_Len, Refresh_Len : Natural) is new Access_Token (Len) with record
Id_Token : String (1 .. Id_Len);
Refresh_Token : String (1 .. Refresh_Len);
end record;
type Application is new Security.OAuth.Application with record
Request_URI : Ada.Strings.Unbounded.Unbounded_String;
end record;
type Grant_Type is new Security.Principal with record
Access_Token : Ada.Strings.Unbounded.Unbounded_String;
Refresh_Token : Ada.Strings.Unbounded.Unbounded_String;
Id_Token : Ada.Strings.Unbounded.Unbounded_String;
Expires : Natural;
end record;
end Security.OAuth.Clients;
|
source/image/required/s-imglli.ads | ytomino/drake | 33 | 3364 | pragma License (Unrestricted);
-- implementation unit required by compiler
package System.Img_LLI is
pragma Pure;
-- required for Long_Long_Integer'Image by compiler (s-imgint.ads)
procedure Image_Long_Long_Integer (
V : Long_Long_Integer;
S : in out String;
P : out Natural);
end System.Img_LLI;
|
programs/oeis/341/A341915.asm | neoneye/loda | 22 | 164865 | <gh_stars>10-100
; A341915: For any nonnegative number n with runs in binary expansion (r_1, ..., r_w), a(n) = Sum_{k = 1..w} 2^(r_1 + ... + r_k - 1).
; 0,1,3,2,5,7,6,4,9,13,15,11,10,14,12,8,17,25,29,21,23,31,27,19,18,26,30,22,20,28,24,16,33,49,57,41,45,61,53,37,39,55,63,47,43,59,51,35,34,50,58,42,46,62,54,38,36,52,60,44,40,56,48,32,65,97,113,81,89,121,105,73,77,109,125,93,85,117,101,69,71,103,119,87,95,127,111,79,75,107,123,91,83,115,99,67,66,98,114,82
lpb $0
mov $2,$0
div $0,2
seq $2,69125 ; a(n) = (11*n^2 - 11*n + 2)/2.
gcd $2,2
add $1,$2
mul $1,2
lpe
div $1,4
mov $0,$1
|
programs/oeis/151/A151754.asm | neoneye/loda | 22 | 28328 | ; A151754: Number of n-digit numbers that are divisible by 5^n.
; 1,3,7,14,28,57,115,230,460,921,1843,3686,7372,14745,29491,58982,117964,235929,471859,943718,1887436,3774873,7549747,15099494,30198988,60397977,120795955,241591910,483183820,966367641
mov $1,2
pow $1,$0
mul $1,9
div $1,5
mov $0,$1
|
src/matrix_functions_h.ads | JeremyGrosser/arm_cmsis_dsp | 0 | 25455 | <filename>src/matrix_functions_h.ads
pragma Ada_2012;
pragma Style_Checks (Off);
pragma Warnings ("U");
with Interfaces.C; use Interfaces.C;
with sys_ustdint_h;
with arm_math_types_h;
package matrix_functions_h is
type arm_matrix_instance_f32 is record
numRows : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:117
numCols : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:118
pData : access arm_math_types_h.float32_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:119
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:120
type arm_matrix_instance_f64 is record
numRows : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:127
numCols : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:128
pData : access arm_math_types_h.float64_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:129
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:130
type arm_matrix_instance_q7 is record
numRows : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:137
numCols : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:138
pData : access arm_math_types_h.q7_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:139
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:140
type arm_matrix_instance_q15 is record
numRows : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:147
numCols : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:148
pData : access arm_math_types_h.q15_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:149
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:150
type arm_matrix_instance_q31 is record
numRows : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:157
numCols : aliased sys_ustdint_h.uint16_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:158
pData : access arm_math_types_h.q31_t; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:159
end record
with Convention => C_Pass_By_Copy; -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:160
function arm_mat_add_f32
(pSrcA : access constant arm_matrix_instance_f32;
pSrcB : access constant arm_matrix_instance_f32;
pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:170
with Import => True,
Convention => C,
External_Name => "arm_mat_add_f32";
function arm_mat_add_q15
(pSrcA : access constant arm_matrix_instance_q15;
pSrcB : access constant arm_matrix_instance_q15;
pDst : access arm_matrix_instance_q15) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:183
with Import => True,
Convention => C,
External_Name => "arm_mat_add_q15";
function arm_mat_add_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:196
with Import => True,
Convention => C,
External_Name => "arm_mat_add_q31";
function arm_mat_cmplx_mult_f32
(pSrcA : access constant arm_matrix_instance_f32;
pSrcB : access constant arm_matrix_instance_f32;
pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:209
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_mult_f32";
function arm_mat_cmplx_mult_q15
(pSrcA : access constant arm_matrix_instance_q15;
pSrcB : access constant arm_matrix_instance_q15;
pDst : access arm_matrix_instance_q15;
pScratch : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:222
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_mult_q15";
function arm_mat_cmplx_mult_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:236
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_mult_q31";
function arm_mat_trans_f32 (pSrc : access constant arm_matrix_instance_f32; pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:248
with Import => True,
Convention => C,
External_Name => "arm_mat_trans_f32";
function arm_mat_trans_f64 (pSrc : access constant arm_matrix_instance_f64; pDst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:259
with Import => True,
Convention => C,
External_Name => "arm_mat_trans_f64";
function arm_mat_cmplx_trans_f32 (pSrc : access constant arm_matrix_instance_f32; pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:270
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_trans_f32";
function arm_mat_trans_q15 (pSrc : access constant arm_matrix_instance_q15; pDst : access arm_matrix_instance_q15) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:282
with Import => True,
Convention => C,
External_Name => "arm_mat_trans_q15";
function arm_mat_cmplx_trans_q15 (pSrc : access constant arm_matrix_instance_q15; pDst : access arm_matrix_instance_q15) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:293
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_trans_q15";
function arm_mat_trans_q7 (pSrc : access constant arm_matrix_instance_q7; pDst : access arm_matrix_instance_q7) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:304
with Import => True,
Convention => C,
External_Name => "arm_mat_trans_q7";
function arm_mat_trans_q31 (pSrc : access constant arm_matrix_instance_q31; pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:315
with Import => True,
Convention => C,
External_Name => "arm_mat_trans_q31";
function arm_mat_cmplx_trans_q31 (pSrc : access constant arm_matrix_instance_q31; pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:326
with Import => True,
Convention => C,
External_Name => "arm_mat_cmplx_trans_q31";
function arm_mat_mult_f32
(pSrcA : access constant arm_matrix_instance_f32;
pSrcB : access constant arm_matrix_instance_f32;
pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:338
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_f32";
function arm_mat_mult_f64
(pSrcA : access constant arm_matrix_instance_f64;
pSrcB : access constant arm_matrix_instance_f64;
pDst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:351
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_f64";
procedure arm_mat_vec_mult_f32
(pSrcMat : access constant arm_matrix_instance_f32;
pVec : access arm_math_types_h.float32_t;
pDst : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:362
with Import => True,
Convention => C,
External_Name => "arm_mat_vec_mult_f32";
function arm_mat_mult_q7
(pSrcA : access constant arm_matrix_instance_q7;
pSrcB : access constant arm_matrix_instance_q7;
pDst : access arm_matrix_instance_q7;
pState : access arm_math_types_h.q7_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:376
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_q7";
procedure arm_mat_vec_mult_q7
(pSrcMat : access constant arm_matrix_instance_q7;
pVec : access arm_math_types_h.q7_t;
pDst : access arm_math_types_h.q7_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:388
with Import => True,
Convention => C,
External_Name => "arm_mat_vec_mult_q7";
function arm_mat_mult_q15
(pSrcA : access constant arm_matrix_instance_q15;
pSrcB : access constant arm_matrix_instance_q15;
pDst : access arm_matrix_instance_q15;
pState : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:402
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_q15";
procedure arm_mat_vec_mult_q15
(pSrcMat : access constant arm_matrix_instance_q15;
pVec : access arm_math_types_h.q15_t;
pDst : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:414
with Import => True,
Convention => C,
External_Name => "arm_mat_vec_mult_q15";
function arm_mat_mult_fast_q15
(pSrcA : access constant arm_matrix_instance_q15;
pSrcB : access constant arm_matrix_instance_q15;
pDst : access arm_matrix_instance_q15;
pState : access arm_math_types_h.q15_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:428
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_fast_q15";
function arm_mat_mult_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:442
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_q31";
function arm_mat_mult_opt_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31;
pState : access arm_math_types_h.q31_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:456
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_opt_q31";
procedure arm_mat_vec_mult_q31
(pSrcMat : access constant arm_matrix_instance_q31;
pVec : access arm_math_types_h.q31_t;
pDst : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:468
with Import => True,
Convention => C,
External_Name => "arm_mat_vec_mult_q31";
function arm_mat_mult_fast_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:481
with Import => True,
Convention => C,
External_Name => "arm_mat_mult_fast_q31";
function arm_mat_sub_f32
(pSrcA : access constant arm_matrix_instance_f32;
pSrcB : access constant arm_matrix_instance_f32;
pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:494
with Import => True,
Convention => C,
External_Name => "arm_mat_sub_f32";
function arm_mat_sub_f64
(pSrcA : access constant arm_matrix_instance_f64;
pSrcB : access constant arm_matrix_instance_f64;
pDst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:507
with Import => True,
Convention => C,
External_Name => "arm_mat_sub_f64";
function arm_mat_sub_q15
(pSrcA : access constant arm_matrix_instance_q15;
pSrcB : access constant arm_matrix_instance_q15;
pDst : access arm_matrix_instance_q15) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:520
with Import => True,
Convention => C,
External_Name => "arm_mat_sub_q15";
function arm_mat_sub_q31
(pSrcA : access constant arm_matrix_instance_q31;
pSrcB : access constant arm_matrix_instance_q31;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:533
with Import => True,
Convention => C,
External_Name => "arm_mat_sub_q31";
function arm_mat_scale_f32
(pSrc : access constant arm_matrix_instance_f32;
scale : arm_math_types_h.float32_t;
pDst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:546
with Import => True,
Convention => C,
External_Name => "arm_mat_scale_f32";
function arm_mat_scale_q15
(pSrc : access constant arm_matrix_instance_q15;
scaleFract : arm_math_types_h.q15_t;
shift : sys_ustdint_h.int32_t;
pDst : access arm_matrix_instance_q15) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:560
with Import => True,
Convention => C,
External_Name => "arm_mat_scale_q15";
function arm_mat_scale_q31
(pSrc : access constant arm_matrix_instance_q31;
scaleFract : arm_math_types_h.q31_t;
shift : sys_ustdint_h.int32_t;
pDst : access arm_matrix_instance_q31) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:575
with Import => True,
Convention => C,
External_Name => "arm_mat_scale_q31";
procedure arm_mat_init_q31
(S : access arm_matrix_instance_q31;
nRows : sys_ustdint_h.uint16_t;
nColumns : sys_ustdint_h.uint16_t;
pData : access arm_math_types_h.q31_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:588
with Import => True,
Convention => C,
External_Name => "arm_mat_init_q31";
procedure arm_mat_init_q15
(S : access arm_matrix_instance_q15;
nRows : sys_ustdint_h.uint16_t;
nColumns : sys_ustdint_h.uint16_t;
pData : access arm_math_types_h.q15_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:601
with Import => True,
Convention => C,
External_Name => "arm_mat_init_q15";
procedure arm_mat_init_f32
(S : access arm_matrix_instance_f32;
nRows : sys_ustdint_h.uint16_t;
nColumns : sys_ustdint_h.uint16_t;
pData : access arm_math_types_h.float32_t) -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:614
with Import => True,
Convention => C,
External_Name => "arm_mat_init_f32";
function arm_mat_inverse_f32 (src : access constant arm_matrix_instance_f32; dst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:629
with Import => True,
Convention => C,
External_Name => "arm_mat_inverse_f32";
function arm_mat_inverse_f64 (src : access constant arm_matrix_instance_f64; dst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:641
with Import => True,
Convention => C,
External_Name => "arm_mat_inverse_f64";
function arm_mat_cholesky_f64 (src : access constant arm_matrix_instance_f64; dst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:654
with Import => True,
Convention => C,
External_Name => "arm_mat_cholesky_f64";
function arm_mat_cholesky_f32 (src : access constant arm_matrix_instance_f32; dst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:667
with Import => True,
Convention => C,
External_Name => "arm_mat_cholesky_f32";
function arm_mat_solve_upper_triangular_f32
(ut : access constant arm_matrix_instance_f32;
a : access constant arm_matrix_instance_f32;
dst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:678
with Import => True,
Convention => C,
External_Name => "arm_mat_solve_upper_triangular_f32";
function arm_mat_solve_lower_triangular_f32
(lt : access constant arm_matrix_instance_f32;
a : access constant arm_matrix_instance_f32;
dst : access arm_matrix_instance_f32) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:690
with Import => True,
Convention => C,
External_Name => "arm_mat_solve_lower_triangular_f32";
function arm_mat_solve_upper_triangular_f64
(ut : access constant arm_matrix_instance_f64;
a : access constant arm_matrix_instance_f64;
dst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:703
with Import => True,
Convention => C,
External_Name => "arm_mat_solve_upper_triangular_f64";
function arm_mat_solve_lower_triangular_f64
(lt : access constant arm_matrix_instance_f64;
a : access constant arm_matrix_instance_f64;
dst : access arm_matrix_instance_f64) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:715
with Import => True,
Convention => C,
External_Name => "arm_mat_solve_lower_triangular_f64";
function arm_mat_ldlt_f32
(src : access constant arm_matrix_instance_f32;
l : access arm_matrix_instance_f32;
d : access arm_matrix_instance_f32;
pp : access sys_ustdint_h.uint16_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:731
with Import => True,
Convention => C,
External_Name => "arm_mat_ldlt_f32";
function arm_mat_ldlt_f64
(src : access constant arm_matrix_instance_f64;
l : access arm_matrix_instance_f64;
d : access arm_matrix_instance_f64;
pp : access sys_ustdint_h.uint16_t) return arm_math_types_h.arm_status -- ../CMSIS_5/CMSIS/DSP/Include/dsp/matrix_functions.h:747
with Import => True,
Convention => C,
External_Name => "arm_mat_ldlt_f64";
end matrix_functions_h;
|
programs/oeis/168/A168255.asm | neoneye/loda | 22 | 86161 | ; A168255: n appears n-th nonprime number times.
; 1,2,2,2,2,3,3,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,7,7,7,7,7,7,7,7,7,7,7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10
mul $0,2
mov $1,1
lpb $0
sub $0,8
trn $0,$1
add $1,3
lpe
div $1,3
add $1,1
mov $0,$1
|
Quickdraw/QuickDraw Source/Lines.asm | Computer-history-Museum/MacPaint | 2 | 12822 | .INCLUDE GRAFTYPES.TEXT
;-----------------------------------------------------------------
;
;
; * *** * * ***** ***
; * * * * * * *
; * * ** * * *
; * * * * * *** ***
; * * * ** * *
; * * * * * * *
; ***** *** * * ***** ***
;
;
;
; Line Drawing Rountines
;
.PROC StdLine,1
.REF CheckPic,PutPicVerb,PutPicByte,PutPicLong,DoLine
;---------------------------------------------------------------
;
; PROCEDURE StdLine(newPt: Point);
;
PARAMSIZE .EQU 4
NEWPT .EQU PARAMSIZE+8-4
LINK A6,#0 ;NO LOCAL VARS
MOVEM.L D5-D7/A3-A4,-(SP) ;SAVE REGS
JSR CHECKPIC ;SET UP A4,A3 AND CHECK PICSAVE
BLE.S NOTPIC ;BRANCH IF NOT PICSAVE
MOVE.B #FRAME,-(SP) ;PUSH VERB
JSR PutPicVerb ;CHECK pnSize, pnMode, pnPat
;--------------------------------------------------------
;
; PUT ONE OF FOUR LINE OPCODES BASED ON NEWPT AND DH,DV.
;
; line 20, pnLoc(pt), newPt(pt)
; line from 21, newPt(pt)
; short line 22, pnLoc(pt), dh,dv(-128..127)
; short line from 23, dh,dv(-128..127)
;
MOVEQ #$20,D7 ;INIT OPCODE TO $20
MOVE.L PICSAVE(A3),A4 ;GET PICSAVE HANDLE
MOVE.L (A4),A4 ;DE-REFERENCE PICSAVE
MOVE.L PNLOC(A3),D0 ;GET CURRENT PNLOC
CMP.L PICPNLOC(A4),D0 ;IS LINE FROM LAST ENDPOINT ?
BNE.S NOTFROM ;NO, CONTINUE
ADDQ #1,D7 ;YES, SET BIT ZERO
NOTFROM MOVE NEWPT+H(A6),D6 ;GET NEWPT.H
SUB D0,D6 ;CALC DH = NEWPT.H - PNLOC.H
MOVE D6,D0 ;COPY DH
EXT.W D0
CMP.W D6,D0 ;IS DH -128..127 ?
BNE.S PUTOP ;NO, CONTINUE
MOVE NEWPT+V(A6),D5 ;GET NEWPT.V
SUB PNLOC+V(A3),D5 ;CALC DV = NEWPT.V - PNLOC.V
MOVE D5,D0 ;COPY DV
EXT.W D0
CMP.W D5,D0 ;IS DV -128..127 ?
BNE.S PUTOP ;NO, CONTINUE
ADDQ #2,D7 ;YES, SET BIT ONE IN OPCODE
PUTOP MOVE.B D7,-(SP)
JSR PutPicByte ;PUT ONE OF 4 LINE OPCODES
ROR #1,D7 ;DO WE NEED STARTPT ? (BIT 0)
BCS.S STARTOK ;NO, CONTINUE
MOVE.L PNLOC(A3),-(SP)
JSR PutPicLong ;YES, PUT STARTPT = PNLOC
STARTOK ROR #1,D7 ;IS LINE SHORT ? (BIT 1)
BCS.S DHDV ;YES, PUT DH,DV
MOVE.L NEWPT(A6),-(SP) ;NO, PUT LONG NEWPT
JSR PutPicLong ;PUT NEWPT TO THEPIC
BRA.S UPDATE
DHDV MOVE.B D6,-(SP) ;PUSH DH (-128..127)
JSR PutPicByte ;PUT TO THEPIC
MOVE.B D5,-(SP) ;PUSH DV (-128..127)
JSR PutPicByte ;PUT TO THEPIC
UPDATE MOVE.L PICSAVE(A3),A4 ;GET PICSAVE HANDLE
MOVE.L (A4),A4 ;DE-REFERENCE PICSAVE
MOVE.L NEWPT(A6),PICPNLOC(A4) ;UPDATE PICTURE SAVING STATE
NOTPIC MOVE.L NEWPT(A6),-(SP) ;PUSH NEWPT
JSR DoLine ;DoLine(newPt);
MOVEM.L (SP)+,D5-D7/A3-A4 ;RESTORE REGS
UNLINK PARAMSIZE,'STDLINE '
.PROC LineTo,2
.REF StdLine
;----------------------------------------------------------
;
; PROCEDURE LineTo(h,v: INTEGER);
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
MOVE.L GRAFPROCS(A0),D0 ;IS GRAFPROCS NIL ?
LEA STDLINE,A0
BEQ.S USESTD ;YES, USE STD PROC
MOVE.L D0,A0
MOVE.L LINEPROC(A0),A0 ;NO, GET PROC PTR
USESTD JMP (A0) ;GO TO IT
.PROC Line,2
.REF LineTo
;----------------------------------------------------------
;
; PROCEDURE Line(dh,dv: INTEGER);
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
MOVE PNLOC+H(A0),D0 ;GET CURRENT PENLOC.H
ADD D0,6(SP) ;ADD TO DH
MOVE PNLOC+V(A0),D0 ;GET CURRENT PENLOC.V
ADD D0,4(SP) ;ADD TO DV
JMP LineTo ;LineTo(pnLoc.h+dh,pnLoc.v+dv);
.PROC MoveTo,2
;----------------------------------------------------------
;
; PROCEDURE MoveTo(h,v: INTEGER);
;
MOVE.L (SP)+,A0 ;POP RETURN ADDR
MOVE.L GRAFGLOBALS(A5),A1 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A1),A1 ;POINT TO CURRENT GRAFPORT
MOVE.L (SP)+,PNLOC(A1) ;COPY POINT INTO PNLOC
JMP (A0) ;RETURN
.PROC MQVE,2
.DEF Moov
;----------------------------------------------------------
;
; PROCEDURE Move(dh,dv: INTEGER);
;
MOOV MOVE.L (SP)+,A0 ;POP RETURN ADDR
MOVE (SP)+,D0 ;POP DV
MOVE (SP)+,D1 ;POP DH
MOVE.L GRAFGLOBALS(A5),A1 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A1),A1 ;GET CURRENT GRAFPORT
ADD D0,PNLOC+V(A1) ;ADD DV TO PNLOC.V
ADD D1,PNLOC+H(A1) ;ADD DH TO PNLOC.H
JMP (A0) ;RETURN
.PROC DoLine,1
.REF DrawLine,PutLine,SetSize
;----------------------------------------------------------
;
; PROCEDURE DoLine(newPt: Point);
;
; { called by StdLine and StdPoly frame }
;
MOVEM.L D6-D7/A3-A4,-(SP) ;SAVE REGS
MOVE.L GRAFGLOBALS(A5),A4 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A4),A3 ;POINT TO CURRENT GRAFPORT
MOVE.L 20(SP),D7 ;GET NEWPT
MOVE.L PNLOC(A3),D6 ;OLDPT := THEPORT^.PNLOC
;
; CHECK IF WE ARE SAVING FOR A POLYGON
;
TST.L POLYSAVE(A3) ;ARE WE SAVING FOR A POLYGON ?
BEQ.S NOTPOLY ;NO, CONTINUE
MOVE.L THEPOLY(A4),A1 ;YES, GET POLYHANDLE
MOVE.L (A1),A0 ;DE-REFERENCE IT
MOVE (A0),D0 ;GET CURRENT POLYSIZE
CMP #10,D0 ;IS THIS THE FIRST POINT ?
BNE.S FIRSTOK ;NO, CONTINUE
MOVE.L D6,0(A0,D0) ;YES, INSTALL FIRST := OLDPT
ADD #4,D0 ;BUMP INDEX
FIRSTOK MOVE.L D7,0(A0,D0) ;INSTALL NEWPT AT END
ADD #4,D0 ;BUMP INDEX
MOVE D0,(A0) ;UPDATE INDEX
CMP POLYMAX(A4),D0 ;TIME TO MAKE BIGGER ?
BLT.S SIZEOK ;NO, CONTINUE
ADD #256,POLYMAX(A4) ;YES, GROW IN CHUNKS
MOVE.L A1,-(SP) ;PUSH POLYHANDLE
MOVE POLYMAX(A4),-(SP) ;PUSH NEW SIZE
JSR SETSIZE ;MAKE THEPOLY BIGGER
SIZEOK BRA.S NOTRGN ;DONT SAVE FOR RGN TOO
;
; IF NOT POLY, THEN CHECK FOR RGNSAVE.
; IF RGNSAVE THEN PutLine(oldPt,newPt,rgnBuf,rgnIndex,rgnMax);
;
NOTPOLY TST.L RGNSAVE(A3) ;ARE WE SAVING FOR A REGION ?
BEQ.S NOTRGN
MOVE.L D6,-(SP) ;PUSH OLDPT
MOVE.L D7,-(SP) ;PUSH NEWPT
MOVE.L RGNBUF(A4),-(SP) ;PUSH RGNBUF
PEA RGNINDEX(A4) ;PUSH VAR RGNINDEX
PEA RGNMAX(A4) ;PUSH VAR RGNMAX
JSR PUTLINE ;ADD INVERSION PTS TO RGNBUF
NOTRGN MOVE.L D6,-(SP) ;PUSH OLDPT
MOVE.L D7,-(SP) ;PUSH NEWPT
JSR DRAWLINE ;DRAW THE LINE
MOVE.L D7,PNLOC(A3) ;UPDATE THEPORT^.PNLOC
MOVEM.L (SP)+,D6-D7/A3-A4 ;RESTORE REGS
MOVE.L (SP)+,(SP) ;STRIP PARAM
RTS ;AND RETURN
.PROC HidePen,0
.DEF ShowPen
;----------------------------------------------------------
;
; PROCEDURE HidePen;
;
MOVEQ #-1,D0
BRA.S SHARE
;----------------------------------------------------------
;
; PROCEDURE ShowPen;
;
ShowPen MOVEQ #1,D0
SHARE MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT PORT
ADD D0,PNVIS(A0) ;INCREMENT/DECREMENT PNVIS
RTS ;AND RETURN
.PROC GetPenState,1
.DEF SetPenState
;----------------------------------------------------------
;
; PROCEDURE GetPenState(VAR pnState: PenState);
; PROCEDURE SetPenState(pnState: PenState);
;
MOVEQ #1,D0 ;SET A FLAG
BRA.S SHARE ;AND SHARE CODE
SetPenState
CLR D0 ;CLEAR FLAG AND SHARE
SHARE MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
LEA PNLOC(A0),A0 ;POINT TO PNLOC
MOVE.L 4(SP),A1 ;POINT TO VAR PNSTATE
TST D0 ;is this SET penstate ?
BNE.S NOTSET ;NO, CONTINUE
EXG A0,A1 ;YES, SWAP SRC AND DST
NOTSET MOVE.L (A0)+,(A1)+ ;COPY PNLOC FROM THEPORT
MOVE.L (A0)+,(A1)+ ;COPY PNSIZE FROM THEPORT
MOVE.W (A0)+,(A1)+ ;COPY PNMODE FROM THEPORT
MOVE.L (A0)+,(A1)+ ;COPY PNPAT FROM THEPORT
MOVE.L (A0)+,(A1)+ ;ALL 8 BYTES
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
RTS ;AND RETURN
.PROC GetPen,1
;----------------------------------------------------------
;
; PROCEDURE GetPen(VAR pt: Point);
; { inquire the current pen location }
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
MOVE.L 4(SP),A1 ;POINT TO VAR PT
MOVE.L PNLOC(A0),(A1) ;GET PNLOC FROM THEPORT
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
RTS ;AND RETURN
.PROC PenSize,2
;----------------------------------------------------------
;
; PROCEDURE PenSize(width,height: INTEGER);
; { set the pen width and height }
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
MOVE.L 4(SP),PNSIZE(A0) ;SET PEN WIDTH AND HEIGHT
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
RTS ;AND RETURN
.PROC PenMode,1
.REF PortWord
;----------------------------------------------------------
;
; PROCEDURE PenMode(mode: INTEGER);
; { set the transfer mode for line drawing }
;
MOVEQ #PNMODE,D0 ;PUT PORT OFFSET IN D0
JMP PORTWORD ;INSTALL PARAM INTO THEPORT
.PROC PenPat,1
;----------------------------------------------------------
;
; PROCEDURE PenPat(pat: Pattern);
; { set the pattern for line drawing }
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
LEA PNPAT(A0),A0 ;POINT TO PNPAT
MOVE.L 4(SP),A1 ;POINT TO INPUT PATTERN
MOVE.L (A1)+,(A0)+ ;COPY PATTERN INTO THEPORT
MOVE.L (A1)+,(A0)+ ;ALL 8 BYTES
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
RTS ;AND RETURN
.PROC PenNormal,0
;----------------------------------------------------------
;
; PROCEDURE PenNormal;
; { restore all line drawing parameters to normal }
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
MOVE.L #$00010001,PNSIZE(A0) ;PEN SIZE:=1,1
MOVE #8,PNMODE(A0) ;PENMODE:=PATTERN COPY
MOVEQ #-1,D0
MOVE.L D0,PNPAT(A0) ;PNPAT:=BLACK
MOVE.L D0,PNPAT+4(A0)
RTS
.END
|
TypeTheory/Lecture/StreamPredicates.agda | hbasold/Sandbox | 0 | 7104 | <reponame>hbasold/Sandbox<gh_stars>0
module StreamPredicates where
open import PropsAsTypes
open import Stream
module Modalities (A : Set) where
private
Aω : Set
Aω = Stream A
record Always (P : Pred Aω) (s : Stream A) : Prop where
coinductive
field
valid : P s
step : Always P (tl s)
open Always public
data Eventually (P : Pred Aω) (s : Stream A) : Prop where
now : P s → Eventually P s
later : Eventually P (tl s) → Eventually P s
GE : Pred Aω → Pred Aω
GE P = Always (Eventually P)
EG : Pred Aω → Pred Aω
EG P = Eventually (Always P)
Always⇒GE : ∀{P : Pred Aω} → Always P ⊆ GE P
Always⇒GE s p .valid = now (p .valid)
Always⇒GE s p .step = Always⇒GE (s .tl) (p .step)
EG⇒Eventually : ∀{P : Pred Aω} → EG P ⊆ Eventually P
EG⇒Eventually s (now p) = now (p .valid)
EG⇒Eventually s (later Evs') = later (EG⇒Eventually (s .tl) Evs')
EG⇒GE : ∀{P : Pred Aω} → EG P ⊆ GE P
EG⇒GE s p .valid = EG⇒Eventually s p
EG⇒GE s (now p) .step = Always⇒GE (tl s) (p .step)
EG⇒GE s (later p) .step = EG⇒GE (tl s) p
module ModalitiesExamples where
open import Data.Nat
open import Relation.Binary.PropositionalEquality as PE
exP : Pred (Stream ℕ)
exP s = s .hd ≡ 0
alt : Stream ℕ
alt .hd = 0
alt .tl .hd = 1
alt .tl .tl = alt
open Modalities ℕ
exP-holds-on-alt-GE : GE exP alt
exP-holds-on-alt-GE .valid = now refl
exP-holds-on-alt-GE .step .valid = later (now refl)
exP-holds-on-alt-GE .step .step = exP-holds-on-alt-GE
exP-holds-not-on-alt-EG : ¬ (EG exP alt)
exP-holds-not-on-alt-EG (now p) = zero-not-suc 0 (p .step .valid)
exP-holds-not-on-alt-EG (later (now p)) = zero-not-suc 0 (p .valid)
exP-holds-not-on-alt-EG (later (later EGalt'')) =
exP-holds-not-on-alt-EG EGalt''
|
programs/oeis/315/A315733.asm | neoneye/loda | 22 | 11805 | ; A315733: Coordination sequence Gal.6.642.6 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
; 1,6,12,18,22,28,34,40,44,50,56,62,68,74,80,84,90,96,102,106,112,118,124,130,136,142,146,152,158,164,168,174,180,186,192,198,204,208,214,220,226,230,236,242,248,254,260,266,270,276
mov $4,$0
add $4,1
mov $11,$0
lpb $4
mov $0,$11
sub $4,1
sub $0,$4
mov $7,$0
mov $9,2
lpb $9
mov $0,$7
sub $9,1
add $0,$9
trn $0,1
seq $0,315750 ; Coordination sequence Gal.6.627.4 where G.u.t.v denotes the coordination sequence for a vertex of type v in tiling number t in the Galebach list of u-uniform tilings.
mov $2,6
mov $3,-3
trn $5,259
gcd $3,$5
mov $6,1
add $6,$0
mul $0,2
trn $3,$6
sub $2,$3
add $0,$2
mov $6,$0
mov $10,$9
lpb $10
mov $8,$6
sub $10,1
lpe
lpe
lpb $7
mov $7,0
sub $8,$6
lpe
mov $6,$8
sub $6,6
add $1,$6
lpe
mov $0,$1
|
main.asm | vipoo/bbcbasic-z80 | 2 | 6445 | <gh_stars>1-10
; TITLE BBC BASIC (C) R.T.RUSSELL 1987
;
;BBC BASIC INTERPRETER - Z80 VERSION
;COMMAND, ERROR AND LEXICAL ANALYSIS MODULE - "MAIN"
;(C) COPYRIGHT R.T.RUSSELL 1984
;VERSION 2.3, 07-05-1984
;VERSION 3.0, 01-03-1987
;
include "hbios.inc"
include "constants.inc"
include "version._inc"
EXTERN XEQ
EXTERN RUN0
EXTERN CHAIN0
EXTERN TERMQ
EXTERN MUL16
EXTERN X4OR5
EXTERN FILL
EXTERN ESCAPE
EXTERN CHECK
EXTERN SEARCH
;
EXTERN OSWRCH
EXTERN OSLINE
EXTERN OSINIT
EXTERN OSLOAD
EXTERN OSSAVE
EXTERN OSBGET
EXTERN OSBPUT
EXTERN OSSHUT
EXTERN OSSTAT
EXTERN PROMPT
EXTERN LTRAP
EXTERN OSCLI
EXTERN RESET
;
EXTERN COMMA
EXTERN BRAKET
EXTERN NXT
EXTERN ZERO
EXTERN ITEMI
EXTERN EXPRI
EXTERN EXPRS
EXTERN DECODE
EXTERN LOADN
EXTERN SFIX
;
PUBLIC OUTCHR
PUBLIC TKOUT
PUBLIC ERROR
PUBLIC EXTERR
PUBLIC REPORT
PUBLIC CLOOP
PUBLIC WARM
PUBLIC NEW
PUBLIC OLD
PUBLIC LOAD
PUBLIC SAVE
PUBLIC RENUMBER
PUBLIC AUTO
PUBLIC CLEAR
PUBLIC CRLF
PUBLIC SAYLN
PUBLIC LOAD0
PUBLIC TELL
PUBLIC FINDL
PUBLIC SETLIN
PUBLIC LIST
PUBLIC DELETE
PUBLIC GETVAR
PUBLIC PUTVAR
PUBLIC GETDEF
PUBLIC CREATE
PUBLIC PBCDL
PUBLIC LEXAN2
PUBLIC RANGE
PUBLIC TEXT
;
EXTERN PAGE
EXTERN ACCS
EXTERN BUFFER
EXTERN LINENO
EXTERN LOMEM
EXTERN HIMEM
EXTERN COUNT
EXTERN WIDTH
EXTERN TOP
EXTERN FREE
EXTERN STAVAR
EXTERN DYNVAR
EXTERN ERRTXT
EXTERN ERR
EXTERN ERL
EXTERN ERRLIN
EXTERN ERRTRP
EXTERN FNPTR
EXTERN PROPTR
EXTERN AUTONO
EXTERN INCREM
EXTERN LISTON
EXTERN TRACEN
EXTERN NUMTOSTR
EXTERN HBIOS_INIT
EXTERN KEYWDS, KEYWDL, ERRWDS
EXTERN TKR_LINE, TK_TOKLO, TK_TOKHI, TK_OFFSET, TKR_THEN, TKR_ELSE, TKR_ERROR
EXTERN TKE_DECODE, TKN_DATA, TKE_FN, TKN_RENUMBER, TKN_FOR, TKN_GOSUB, TKN_GOTO, TKN_IF, TKN_NEXT, TKN_PROC, TKN_REM, TKN_REPEAT, TKN_RESTOR, TKN_TRACE, TKN_UNTIL
EXTERN TK_EXTENDED
EXTERN PRTHL
ORG 100H
APPSTART:
COLD: LD HL,STAVAR ;COLD START
LD SP,HL
LD (HL),10
INC L
LD (HL),9
INC L
XOR A
PURGE: LD (HL),A ;CLEAR SCRATCHPAD
INC L
JR NZ,PURGE
LD A,37H ;V3.0
LD (LISTON),A
LD HL,NOTICE
LD (ERRTXT),HL
CALL OSINIT
LD DE, APPSTART ; HIMEM IS OUT START ADDRESS
LD HL, $100 ; START PROG AT ZERO PAGE
LD (HIMEM), DE
LD (PAGE), HL
CALL NEWIT
JP NZ,CHAIN0 ;AUTO-RUN
CALL HBIOS_INIT
CALL TELL
DEFM "DINO BASIC Version "
DEFM VERSIONSTAMP
DEFB CR
DEFB LF
DEFM "Assembled Date: "
DEFM BUILDTIME
DEFB CR
DEFB LF
DEFM "(C) Copyright <NAME> 2020"
DEFB CR
DEFB LF
DEFB 0
LD SP, (HIMEM)
LD HL, (HIMEM)
LD DE, (PAGE)
OR A
SBC HL, DE
CALL PRTHL
CALL TELL
DEFM " Free bytes"
DEFB CR
DEFB LF
DEFB CR
DEFB LF
DEFM "Based on BBC BASIC (Z80) Version 3.00 "
DEFB CR
DEFB LF
NOTICE: DEFM "(C) Copyright R.T.Russell 1987"
DEFB CR
DEFB LF
DEFB 0
WARM:
CLOOP: SCF
LD SP,(HIMEM)
CALL PROMPT ;PROMPT USER
LD HL,LISTON
LD A,(HL)
AND 0FH ;LISTO
OR 30H ;OPT 3
LD (HL),A
SBC HL,HL ;HL <- 0 (V3.0)
LD (ERRTRP),HL
LD (ERRLIN),HL
LD HL,(AUTONO)
LD (LINENO),HL
LD A,H
OR L
JR Z,NOAUTO
PUSH HL
CALL PBCD ;AUTO NUMBER
POP HL
LD BC,(INCREM)
LD B,0
ADD HL,BC
JP C,TOOBIG
LD (AUTONO),HL
LD A,' '
CALL OUTCHR
NOAUTO: LD HL,ACCS
CALL OSLINE ;GET CONSOLE INPUT
XOR A
LD (COUNT),A
LD IY,ACCS
CALL LINNUM
CALL NXT
LD A,H
OR L
JR Z,LNZERO ;FOR AUTO (NON-MAPPED)
LD (LINENO),HL
LNZERO: LD DE,BUFFER
LD C,1 ;LEFT MODE
CALL LEXAN2 ;LEXICAL ANALYSIS
LD (DE),A ;TERMINATOR
XOR A
LD B,A
LD C,E ;BC=LINE LENGTH
INC DE
LD (DE),A ;ZERO NEXT
LD HL,(LINENO)
LD A,H
OR L
LD IY,BUFFER ;FOR XEQ
JP Z,XEQ ;DIRECT MODE
PUSH BC
PUSH HL
CALL SETTOP ;SET TOP
POP HL
CALL FINDL
CALL Z,DEL
POP BC
LD A,C
OR A
JP Z,CLOOP ;DELETE LINE ONLY
ADD A,4
LD C,A ;LENGTH INCLUSIVE
PUSH DE ;LINE NUMBER
PUSH BC ;SAVE LINE LENGTH
EX DE,HL
LD HL,(TOP)
PUSH HL
ADD HL,BC
PUSH HL
INC H
XOR A
SBC HL,SP
POP HL
JP NC,ERROR ;"No room"
LD (TOP),HL
EX (SP),HL
PUSH HL
INC HL
OR A
SBC HL,DE
LD B,H ;BC=AMOUNT TO MOVE
LD C,L
POP HL
POP DE
JR Z,ATEND
LDDR ;MAKE SPACE
ATEND: POP BC ;LINE LENGTH
POP DE ;LINE NUMBER
INC HL
LD (HL),C ;STORE LENGTH
INC HL
LD (HL),E ;STORE LINE NUMBER
INC HL
LD (HL),D
INC HL
LD DE,BUFFER
EX DE,HL
DEC C
DEC C
DEC C
LDIR ;ADD LINE
CALL CLEAN
JP CLOOP
;
;COMMANDS:
;
;DELETE line,line
;
DELETE: CALL SETTOP ;SET TOP
CALL DLPAIR
DELET1: LD A,(HL)
OR A
JR Z,WARMNC
INC HL
LD E,(HL)
INC HL
LD D,(HL)
LD A,D
OR E
JR Z,CLOOP1 ;LINE NUMBER ZERO
DEC HL
DEC HL
EX DE,HL
SCF
SBC HL,BC
EX DE,HL
JR NC,WARMNC
PUSH BC
CALL DEL
POP BC
JR DELET1
;
;LISTO expr
;
LISTO: INC IY ;SKIP "O"
CALL EXPRI
EXX
LD A,L
LD (LISTON),A
CLOOP1: JP CLOOP
;
;LIST
;LIST line
;LIST line,line [IF string]
;LIST ,line
;LIST line,
;
LIST: CP 'O'
JR Z,LISTO
CALL DLPAIR
CALL NXT
CP TKN_IF ;IF CLAUSE ?
LD A,0 ;INIT IF-CLAUSE LENGTH
JR NZ,LISTB
INC IY ;SKIP IF
CALL NXT ;SKIP SPACES (IF ANY)
EX DE,HL
PUSH IY
POP HL ;HL ADDRESSES IF CLAUSE
LD A,CR
PUSH BC
LD BC,256
CPIR ;LOCATE CR
LD A,C
CPL ;A = SUBSTRING LENGTH
POP BC
EX DE,HL
LISTB: LD E,A ;IF-CLAUSE LENGTH
LD A,B
OR C
JR NZ,LISTA
DEC BC
LISTA: EXX
LD IX,LISTON
LD BC,0 ;INDENTATION COUNT
EXX
LD A,20
;
LISTC: PUSH BC ;SAVE HIGH LINE NUMBER
PUSH DE ;SAVE IF-CLAUSE LENGTH
PUSH HL ;SAVE PROGRAM POINTER
EX AF,AF'
LD A,(HL)
OR A
JR Z,WARMNC
;
;CHECK IF PAST TERMINATING LINE NUMBER:
;
LD A,E ;A = IF-CLAUSE LENGTH
INC HL
LD E,(HL)
INC HL
LD D,(HL) ;DE = LINE NUMBER
DEC HL
DEC HL
PUSH DE ;SAVE LINE NUMBER
EX DE,HL
SCF
SBC HL,BC
EX DE,HL
POP DE ;RESTORE LINE NUMBER
WARMNC: JP NC,WARM
LD C,(HL) ;C = LINE LENGTH + 4
LD B,A ;B = IF-CLAUSE LENGTH
;
;CHECK IF "UNLISTABLE":
;
LD A,D
OR E
JP Z,CLOOP
;
;CHECK FOR IF CLAUSE:
;
INC HL
INC HL
INC HL ;HL ADDRESSES LINE TEXT
DEC C
DEC C
DEC C
DEC C ;C = LINE LENGTH
PUSH DE ;SAVE LINE NUMBER
PUSH HL ;SAVE LINE ADDRESS
XOR A ;A <- 0
CP B ;WAS THERE AN IF-CLAUSE
PUSH IY
POP DE ;DE ADDRESSES IF-CLAUSE
CALL NZ,SEARCH ;SEARCH FOR IF CLAUSE
POP HL ;RESTORE LINE ADDRESS
POP DE ;RESTORE LINE NUMBER
PUSH IY
CALL Z,LISTIT ;LIST IF MATCH
POP IY
;
EX AF,AF'
DEC A
CALL LTRAP
POP HL ;RESTORE POINTER
LD E,(HL)
LD D,0
ADD HL,DE ;ADDRESS NEXT LINE
POP DE ;RESTORE IF-CLAUSE LEN
POP BC ;RESTORE HI LINE NUMBER
JR LISTC
;
;RENUMBER
;RENUMBER start
;RENUMBER start,increment
;RENUMBER ,increment
;
RENUMBER: CALL CLEAR ;USES DYNAMIC AREA
CALL PAIR ;LOAD HL,BC
EXX
LD HL,(PAGE)
LD DE,(LOMEM)
RENUM1: LD A,(HL) ;BUILD TABLE
OR A
JR Z,RENUM2
INC HL
LD C,(HL) ;OLD LINE NUMBER
INC HL
LD B,(HL)
LD A,B
OR C
JP Z,CLOOP ;LINE NUMBER ZERO
EX DE,HL
LD (HL),C
INC HL
LD (HL),B
INC HL
EXX
PUSH HL
ADD HL,BC ;ADD INCREMENT
JP C,TOOBIG ;"Too big"
EXX
POP BC
LD (HL),C
INC HL
LD (HL),B
INC HL
EX DE,HL
DEC HL
DEC HL
XOR A
LD B,A
LD C,(HL)
ADD HL,BC ;NEXT LINE
EX DE,HL
PUSH HL
INC H
SBC HL,SP
POP HL
EX DE,HL
JR C,RENUM1 ;CONTINUE
CALL EXTERR ;"RENUMBER space"
DEFB TKN_RENUMBER
DEFB 8
DEFB 0
;
RENUM2: EX DE,HL
LD (HL),-1
INC HL
LD (HL),-1
LD DE,(LOMEM)
EXX
LD HL,(PAGE)
RENUM3: LD C,(HL)
LD A,C
OR A
JP Z,WARM
EXX
EX DE,HL
INC HL
INC HL
LD E,(HL)
INC HL
LD D,(HL)
INC HL
PUSH DE
EX DE,HL
LD (LINENO),HL
EXX
POP DE
INC HL
LD (HL),E ;NEW LINE NUMBER
INC HL
LD (HL),D
INC HL
DEC C
DEC C
DEC C
LD B,0
RENUM7: LD A,TKE_DECODE
CPIR ;SEARCH FOR LINE NUMBER
JR NZ,RENUM3
PUSH BC
PUSH HL
PUSH HL
POP IY
EXX
CALL DECODE ;DECODE LINE NUMBER
EXX
LD B,H
LD C,L
LD HL,(LOMEM)
RENUM4: LD E,(HL) ;CROSS-REFERENCE TABLE
INC HL
LD D,(HL)
INC HL
EX DE,HL
OR A ;CLEAR CARRY
SBC HL,BC
EX DE,HL
LD E,(HL) ;NEW NUMBER
INC HL
LD D,(HL)
INC HL
JR C,RENUM4
EX DE,HL
JR Z,RENUM5 ;FOUND
CALL TELL
DEFM "Failed at "
DEFB 0
LD HL,(LINENO)
CALL PBCDL
CALL CRLF
JR RENUM6
RENUM5: POP DE
PUSH DE
DEC DE
CALL ENCODE ;RE-WRITE NUMBER
RENUM6: POP HL
POP BC
JR RENUM7
;
;AUTO
;AUTO start,increment
;AUTO start
;AUTO ,increment
;
AUTO: CALL PAIR
LD (AUTONO),HL
LD A,C
LD (INCREM),A
JR CLOOP0
;
;BAD
;NEW
;
BAD: CALL TELL ;"Bad program"
DEFB 3
DEFM "program"
DEFB CR
DEFB LF
DEFB 0
NEW: CALL NEWIT
JR CLOOP0
;
;OLD
;
OLD: LD HL,(PAGE)
PUSH HL
INC HL
INC HL
INC HL
LD BC,252
LD A,CR
CPIR
JR NZ,BAD
LD A,L
POP HL
LD (HL),A
CALL CLEAN
CLOOP0: JP CLOOP
;
;LOAD filename
;
LOAD: CALL EXPRS ;GET FILENAME
LD A,CR
LD (DE),A
CALL LOAD0
CALL CLEAR
JR WARM0
;
;SAVE filename
;
SAVE: CALL SETTOP ;SET TOP
CALL EXPRS ;FILENAME
LD A,CR
LD (DE),A
LD DE,(PAGE)
LD HL,(TOP)
OR A
SBC HL,DE
LD B,H ;LENGTH OF PROGRAM
LD C,L
LD HL,ACCS
CALL OSSAVE
WARM0: JP WARM
;
;ERROR
;
ERROR: LD SP,(HIMEM)
LD HL,ERRWDS
OR A
JR Z,ERROR1
LD B,A ;ERROR NUMBER
EX AF,AF'
XOR A
ERROR0: CP (HL)
INC HL
JR NZ,ERROR0
DJNZ ERROR0
EX AF,AF'
ERROR1: PUSH HL
EXTERR: POP HL
LD (ERRTXT),HL
LD SP,(HIMEM)
LD (ERR),A
CALL SETLIN
LD (ERL),HL
OR A
JR Z,ERROR2
LD HL,(ERRTRP)
LD A,H
OR L
PUSH HL
POP IY
JP NZ,XEQ ;ERROR TRAPPED
ERROR2: LD HL,0
LD (AUTONO),HL
LD (TRACEN),HL ;CANCEL TRACE
CALL RESET ;RESET OPSYS
CALL CRLF
CALL REPORT ;MESSAGE
CALL SAYLN
LD E,0
CALL C,OSSHUT ;CLOSE ALL FILES
CALL CRLF
JP CLOOP
;
;SUBROUTINES:
;
;
;LEX - SEARCH FOR KEYWORDS
; Inputs: HL = start of keyword table
; IY = start of match text
; Outputs: If found, Z-flag set, A=token.
; If not found, Z-flag reset, A=(IY).
; IY updated (if NZ, IY unchanged).
; Destroys: A,B,H,L,IY,F
;
LEX: LD HL, KEYWDS
LEX0: LD A,(IY)
LD B,(HL)
EX AF, AF
LD A, B
CP TK_EXTENDED
JR NZ, LEX_NOT_EXTENDED
INC HL
LD A, (HL) ; PLACE EXTENDED TOKEN IN A'
LEX_NOT_EXTENDED:
EX AF, AF
INC HL
CP (HL)
JR Z,LEX2
RET C ;FAIL EXIT
LEX1: INC HL
BIT 7,(HL)
JR Z,LEX1
JR LEX0
LEX2: PUSH IY ;SAVE POINTER
LEX3: INC HL
BIT 7,(HL)
JR NZ,LEX6 ;FOUND
INC IY
LD A,(IY)
CP '.'
JR Z,LEX6 ;FOUND (ABBREV.)
CP (HL)
JR Z,LEX3
CALL RANGE1
JR C,LEX5
LEX4: POP IY ;RESTORE POINTER
JR LEX1
LEX5: LD A,(HL)
OR A
JR NZ,LEX4
DEC IY
LEX6: POP AF
XOR A
LD A,B
RET
;
;DEL - DELETE A PROGRAM LINE.
; Inputs: HL addresses program line.
; Destroys: B,C,F
;
DEL: PUSH DE
PUSH HL
PUSH HL
LD B,0
LD C,(HL)
ADD HL,BC
PUSH HL
EX DE,HL
LD HL,(TOP)
SBC HL,DE
LD B,H
LD C,L
POP HL
POP DE
LDIR ;DELETE LINE
LD (TOP),DE
POP HL
POP DE
RET
;
;LOAD0 - LOAD A DISK FILE THEN CLEAN.
; Inputs: Filename in ACC$ (term CR)
; Destroys: A,B,C,D,E,H,L,F
;
;CLEAN - CHECK FOR BAD PROGRAM, FIND END OF TEXT
; AND WRITE FF FF, THEN LOAD (TOP).
; Destroys: A,B,C,H,L,F
;
LOAD0: LD DE,(PAGE)
LD HL,-256
ADD HL,SP
SBC HL,DE ;FIND AVAILABLE SPACE
LD B,H
LD C,L
LD HL,ACCS
CALL OSLOAD ;LOAD
CALL NC,NEWIT
LD A,0
JP NC,ERROR ;"No room"
CLEAN: CALL SETTOP
DEC HL
LD (HL),-1 ;WRITE &FFFF
DEC HL
LD (HL),-1
JR CLEAR
;
SETTOP: LD HL,(PAGE)
LD B,0
LD A,CR
SETOP1: LD C,(HL)
INC C
DEC C
JR Z,SETOP2
ADD HL,BC
DEC HL
CP (HL)
INC HL
JR Z,SETOP1
JP BAD
SETOP2: INC HL ;N.B. CALLED FROM NEWIT
INC HL
INC HL
LD (TOP),HL
RET
;
;NEWIT - NEW PROGRAM THEN CLEAR
; Destroys: H,L
;
;CLEAR - CLEAR ALL DYNAMIC VARIABLES INCLUDING
; FUNCTION AND PROCEDURE POINTERS.
; Destroys: Nothing
;
NEWIT: LD HL,(PAGE)
LD (HL),0
CALL SETOP2
CLEAR: PUSH HL
LD HL,(TOP)
LD (LOMEM),HL
LD (FREE),HL
LD HL,DYNVAR
PUSH BC
LD B,2*(54+2)
CLEAR1: LD (HL),0
INC HL
DJNZ CLEAR1
POP BC
POP HL
RET
;
;LISTIT - LIST A PROGRAM LINE.
; Inputs: HL addresses line
; DE = line number (binary)
; IX addresses LISTON
; Destroys: A,D,E,B',C',D',E',H',L',IY,F
;
LISTIT: PUSH HL
EX DE,HL
PUSH BC
CALL PBCD
POP BC
POP HL
LD A,(HL)
CP TKN_NEXT
CALL Z,INDENT
CP TKN_UNTIL
CALL Z,INDENT
EXX
LD A,' '
BIT 0,(IX)
CALL NZ,OUTCHR
LD A,B
ADD A,A
BIT 1,(IX)
CALL NZ,FILL
LD A,C
ADD A,A
BIT 2,(IX)
CALL NZ,FILL
EXX
LD A,(HL)
CP TKN_FOR
CALL Z,INDENT
CP TKN_REPEAT
CALL Z,INDENT
LD E,0
LIST8: LD A,(HL)
INC HL
CP CR
JR Z,CRLF
CP DOUBLE_QUOTE
JR NZ,LIST7
INC E
LIST7: CALL LOUT
JR LIST8
;
PRLINO: PUSH HL
POP IY
PUSH BC
CALL DECODE
POP BC
EXX
PUSH BC
CALL PBCDL
POP BC
EXX
PUSH IY
POP HL
RET
;
LOUT: BIT 0,E
JR NZ,OUTCHR
CP TKE_DECODE
JR Z,PRLINO
CP TK_EXTENDED
JR NZ, LOUT1
EX AF, AF ; IF EXTENDED, RETREIEVE EXTENDED TOKEN INTO A'
LD A, (HL)
INC HL
EX AF, AF
LOUT1: CALL TKOUT
LD A,(HL)
INDENT: EXX
CP TKN_FOR
JR Z,IND1
CP TKN_NEXT
JR NZ,IND2
DEC B
JP P,IND2
IND1: INC B
IND2: CP TKN_REPEAT
JR Z,IND3
CP TKN_UNTIL
JR NZ,IND4
DEC C
JP P,IND4
IND3: INC C
IND4: EXX
RET
;
;CRLF - SEND CARRIAGE RETURN, LINE FEED.
; Destroys: A,F
;OUTCHR - OUTPUT A CHARACTER TO CONSOLE.
; Inputs: A = character
; Destroys: A,F
;
CRLF: LD A,CR
CALL OUTCHR
LD A,LF
OUTCHR: CALL OSWRCH
SUB CR
JR Z,CARRET
RET C ;NON-PRINTING
LD A,(COUNT)
INC A
CARRET: LD (COUNT),A
RET Z
PUSH HL
LD HL,(WIDTH)
CP L
POP HL
RET NZ
JR CRLF
;
;TKOUT - SEND CHARACTER OR KEYWORD
; Inputs: A = character (>=10, <128)
; A = Token (<10, >=128)
; IF A == TK_EXTENDED (FF), THEN A' IS THE EXTENDED TOKEN VALUE
; Destroys: A,F
;
TKOUT: CP 138
JP PE,OUTCHR
PUSH BC
PUSH HL
LD HL,KEYWDS
LD BC,KEYWDL
TOKEN1:
CPIR
CP TK_EXTENDED
JR NZ, TOKEN2
EX AF, AF
CP (HL) ; CHECK EXTENDED TOKEN
INC HL
JR Z, TOKEN2 ; IF NO SAME, CONTINUE SEARCH
EX AF, AF
JR TOKEN1
TOKEN2: LD A,(HL)
INC HL
CP 138
PUSH AF
CALL PE,OUTCHR
POP AF
JP PE,TOKEN2
POP HL
POP BC
RET
;
;FINDL - FIND PROGRAM LINE.
; Inputs: HL = line number (binary)
; Outputs: HL addresses line (if found)
; DE = line number
; Z-flag set if found.
; Destroys: A,B,C,D,E,H,L,F
;
FINDL: EX DE,HL
LD HL,(PAGE)
XOR A ;A=0
CP (HL)
INC A
RET NC
XOR A ;CLEAR CARRY
LD B,A
FINDL1: LD C,(HL)
PUSH HL
INC HL
LD A,(HL)
INC HL
LD H,(HL)
LD L,A
SBC HL,DE
POP HL
RET NC ;FOUND OR PAST
ADD HL,BC
JP FINDL1
;
;SETLIN - Search program for line containing address.
; Update (LINENO).
; Inputs: Address in (ERRLIN)
; Outputs: Line number in HL and (LINENO)
; Destroys: B,C,D,E,H,L,F
;
SETLIN: LD B,0
LD DE,(ERRLIN)
LD HL,(PAGE)
OR A
SBC HL,DE
ADD HL,DE
JR NC,SET3
SET1: LD C,(HL)
INC C
DEC C
JR Z,SET3
ADD HL,BC
SBC HL,DE
ADD HL,DE
JR C,SET1
SBC HL,BC
INC HL
LD E,(HL) ;LINE NUMBER
INC HL
LD D,(HL)
EX DE,HL
SET2: LD (LINENO),HL
RET
SET3: LD HL,0
JR SET2
;
;SAYLN - PRINT " at line nnnn" MESSAGE.
; Outputs: Carry=0 if line number is zero.
; Carry=1 if line number is non-zero.
; Destroys: A,B,C,D,E,H,L,F
;
SAYLN: LD HL,(LINENO)
LD A,H
OR L
RET Z
CALL TELL
DEFM " at line "
DEFB 0
PBCDL: LD C,0
JR PBCD0
;
;PBCD - PRINT NUMBER AS DECIMAL INTEGER.
; Inputs: HL = number (binary).
; Outputs: Carry = 1
; Destroys: A,B,C,D,E,H,L,F
;
PBCD: LD C,' '
PBCD0: LD B,5
LD DE,10000
PBCD1: XOR A
PBCD2: SBC HL,DE
INC A
JR NC,PBCD2
ADD HL,DE
DEC A
JR Z,PBCD3
SET 4,C
SET 5,C
PBCD3: OR C
CALL NZ,OUTCHR
LD A,B
CP 5
JR Z,PBCD4
ADD HL,HL
LD D,H
LD E,L
ADD HL,HL
ADD HL,HL
ADD HL,DE
PBCD4: LD DE,1000
DJNZ PBCD1
SCF
RET
;
;PUTVAR - CREATE VARIABLE AND INITIALISE TO ZERO.
; Inputs: HL, IY as returned from GETVAR (NZ).
; Outputs: As GETVAR.
; Destroys: everything
;
PUTVAR: CALL CREATE
LD A,(IY)
CP '('
JR NZ,GETVZ ;SET EXIT CONDITIONS
ARRAY: LD A,14 ;'Array'
ERROR3: JP ERROR
;
;GETVAR - GET LOCATION OF VARIABLE, RETURN IN HL & IX
; Inputs: IY addresses first character.
; Outputs: Carry set and NZ if illegal character.
; Z-flag set if variable found, then:
; A = variable type (0,4,5,128 or 129)
; HL = IX = variable pointer.
; IY updated
; If Z-flag & carry reset, then:
; HL, IY set for subsequent PUTVAR call.
; Destroys: everything
;
GETVAR: LD A,(IY)
CP '$'
JR Z,GETV4
CP '!!'
JR Z,GETV5
CP '?'
JR Z,GETV6
CALL LOCATE
RET NZ
LD A,(IY)
CP '(' ;ARRAY?
JR NZ,GETVX ;EXIT
PUSH DE ;SAVE TYPE
LD A,(HL) ;NO. OF DIMENSIONS
OR A
JR Z,ARRAY
INC HL
LD DE,0 ;ACCUMULATOR
PUSH AF
INC IY ;SKIP (
JR GETV3
GETV2: PUSH AF
CALL COMMA
GETV3: PUSH HL
PUSH DE
CALL EXPRI ;SUBSCRIPT
EXX
POP DE
EX (SP),HL
LD C,(HL)
INC HL
LD B,(HL)
INC HL
EX (SP),HL
EX DE,HL
PUSH DE
CALL MUL16 ;HL=HL*BC
POP DE
ADD HL,DE
EX DE,HL
OR A
SBC HL,BC
LD A,15
JR NC,ERROR3 ;"Subscript"
POP HL
POP AF
DEC A ;DIMENSION COUNTER
JR NZ,GETV2
CALL BRAKET ;CLOSING BRACKET
POP AF ;RESTORE TYPE
PUSH HL
CALL X4OR5 ;DE=DE*n
POP HL
ADD HL,DE
LD D,A ;TYPE
LD A,(IY)
GETVX: CP '?'
JR Z,GETV9
CP '!!'
JR Z,GETV8
GETVZ: PUSH HL ;SET EXIT CONDITIONS
POP IX
LD A,D
CP A
RET
;
;PROCESS UNARY & BINARY INDIRECTION:
;
GETV4: LD A,128 ;STATIC STRING
JR GETV7
GETV5: LD A,4 ;UNARY 32-BIT INDIRN.
JR GETV7
GETV6: XOR A ;UNARY 8-BIT INDIRECTION
GETV7: LD HL,0
PUSH AF
JR GETV0
;
GETV8: LD B,4 ;32-BIT BINARY INDIRN.
JR GETVA
GETV9: LD B,0 ;8-BIT BINARY INDIRN.
GETVA: PUSH HL
POP IX
LD A,D ;TYPE
CP 129
RET Z ;STRING!
PUSH BC
CALL LOADN ;LEFT OPERAND
CALL SFIX
EXX
GETV0: PUSH HL
INC IY
CALL ITEMI
EXX
POP DE
POP AF
ADD HL,DE
PUSH HL
POP IX
CP A
RET
;
;GETDEF - Find entry for FN or PROC in dynamic area.
; Inputs: IY addresses byte following "DEF" token.
; Outputs: Z flag set if found
; Carry set if neither FN or PROC first.
; If Z: HL points to entry
; IY addresses delimiter
; Destroys: A,D,E,H,L,IY,F
;
GETDEF: LD A,(IY+1)
CALL RANGE1
RET C
LD A,(IY)
LD HL,FNPTR
CP TKE_FN
JR Z,LOC2
LD HL,PROPTR
CP TKN_PROC
JR Z,LOC2
SCF
RET
;
;LOCATE - Try to locate variable name in static or
;dynamic variables. If illegal first character return
;carry, non-zero. If found, return no-carry, zero.
;If not found, return no-carry, non-zero.
; Inputs: IY addresses first character of name.
; A=(IY)
; Outputs: Z-flag set if found, then:
; IY addresses terminator
; HL addresses location of variable
; D=type of variable: 4 = integer
; 5 = floating point
; 129 = string
; Destroys: A,D,E,H,L,IY,F
;
LOCATE: SUB '@'
RET C
LD H,0
CP 'Z'-'@'+1
JR NC,LOC0 ;NOT STATIC
ADD A,A
LD L,A
LD A,(IY+1) ;2nd CHARACTER
CP '%'
JR NZ,LOC1 ;NOT STATIC
LD A,(IY+2)
CP '('
JR Z,LOC1 ;NOT STATIC
ADD HL,HL
LD DE,STAVAR ;STATIC VARIABLES
ADD HL,DE
INC IY
INC IY
LD D,4 ;INTEGER TYPE
XOR A
RET
;
LOC0: CP '_'-'@'
RET C
CP 'z'-'@'+1
CCF
DEC A ;SET NZ
RET C
SUB 3
ADD A,A
LD L,A
LOC1: LD DE,DYNVAR ;DYNAMIC VARIABLES
DEC L
DEC L
SCF
RET M
ADD HL,DE
LOC2: LD E,(HL)
INC HL
LD D,(HL)
LD A,D
OR E
JR Z,LOC6 ;UNDEFINED VARIABLE
LD H,D
LD L,E
INC HL ;SKIP LINK
INC HL
PUSH IY
LOC3: LD A,(HL) ;COMPARE
INC HL
INC IY
CP (IY)
JR Z,LOC3
OR A ;0=TERMINATOR
JR Z,LOC5 ;FOUND (MAYBE)
LOC4: POP IY
EX DE,HL
JP LOC2 ;TRY NEXT ENTRY
;
LOC5: DEC IY
LD A,(IY)
CP '('
JR Z,LOC5A ;FOUND
INC IY
CALL RANGE
JR C,LOC5A ;FOUND
CP '('
JR Z,LOC4 ;KEEP LOOKING
LD A,(IY-1)
CALL RANGE1
JR NC,LOC4 ;KEEP LOOKING
LOC5A: POP DE
TYPE: LD A,(IY-1)
CP '$'
LD D,129
RET Z ;STRING
CP '%'
LD D,4
RET Z ;INTEGER
INC D
CP A
RET
;
LOC6: INC A ;SET NZ
RET
;
;CREATE - CREATE NEW ENTRY, INITIALISE TO ZERO.
; Inputs: HL, IY as returned from LOCATE (NZ).
; Outputs: As LOCATE, GETDEF.
; Destroys: As LOCATE, GETDEF.
;
CREATE: XOR A
LD DE,(FREE)
LD (HL),D
DEC HL
LD (HL),E
EX DE,HL
LD (HL),A
INC HL
LD (HL),A
INC HL
LOC7: INC IY
CALL RANGE ;END OF VARIABLE?
JR C,LOC8
LD (HL),A
INC HL
CALL RANGE1
JR NC,LOC7
CP '('
JR Z,LOC8
LD A,(IY+1)
CP '('
JR Z,LOC7
INC IY
LOC8: LD (HL),0 ;TERMINATOR
INC HL
PUSH HL
CALL TYPE
LD A,5
CP D
JR Z,LOC9
DEC A
LOC9: LD (HL),0 ;INITIALISE TO ZERO
INC HL
DEC A
JR NZ,LOC9
LD (FREE),HL
CALL CHECK
POP HL
XOR A
RET
;
;LINNUM - GET LINE NUMBER FROM TEXT STRING
; Inputs: IY = Text Pointer
; Outputs: HL = Line number (zero if none)
; IY updated
; Destroys: A,D,E,H,L,IY,F
;
LINNUM: CALL NXT
LD HL,0
LINNM1: LD A,(IY)
SUB '0'
RET C
CP 10
RET NC
INC IY
LD D,H
LD E,L
ADD HL,HL ;*2
JR C,TOOBIG
ADD HL,HL ;*4
JR C,TOOBIG
ADD HL,DE ;*5
JR C,TOOBIG
ADD HL,HL ;*10
JR C,TOOBIG
LD E,A
LD D,0
ADD HL,DE ;ADD IN DIGIT
JR NC,LINNM1
TOOBIG: LD A,20
JP ERROR ;"Too big"
;
;PAIR - GET PAIR OF LINE NUMBERS FOR RENUMBER/AUTO.
; Inputs: IY = text pointer
; Outputs: HL = first number (10 by default)
; BC = second number (10 by default)
; Destroys: A,B,C,D,E,H,L,B',C',D',E',H',L',IY,F
;
PAIR: CALL LINNUM ;FIRST
LD A,H
OR L
JR NZ,PAIR1
LD L,10
PAIR1: CALL TERMQ
INC IY
PUSH HL
LD HL,10
CALL NZ,LINNUM ;SECOND
EX (SP),HL
POP BC
LD A,B
OR C
RET NZ
CALL EXTERR
DEFM "Silly"
DEFB 0
;
;DLPAIR - GET PAIR OF LINE NUMBERS FOR DELETE/LIST.
; Inputs: IY = text pointer
; Outputs: HL = points to program text
; BC = second number (0 by default)
; Destroys: A,B,C,D,E,H,L,IY,F
;
DLPAIR: CALL LINNUM
PUSH HL
CALL TERMQ
JR Z,DLP1
CP TKN_IF
JR Z,DLP1
INC IY
CALL LINNUM
DLP1: EX (SP),HL
CALL FINDL
POP BC
RET
;
;TEST FOR VALID CHARACTER IN VARIABLE NAME:
; Inputs: IY addresses character
; Outputs: Carry set if out-of-range.
; Destroys: A,F
;
RANGE: LD A,(IY)
CP '$'
RET Z
CP '%'
RET Z
CP '('
RET Z
RANGE1: CP '0'
RET C
CP '9'+1
CCF
RET NC
CP '@' ;V2.4
RET Z
RANGE2: CP 'A'
RET C
CP 'Z'+1
CCF
RET NC
CP '_'
RET C
CP 'z'+1
CCF
RET
;
SPACE: XOR A
CALL EXTERR ;"LINE space"
DEFB TKR_LINE
DEFB 8
DEFB 0
;
;LEXAN - LEXICAL ANALYSIS.
; Bit 0,C: 1=left, 0=right
; Bit 3,C: 1=in HEX
; Bit 4,C: 1=accept line number
; Bit 5,C: 1=in variable, FN, PROC
; Bit 6,C: 1=in REM, DATA, *
; Bit 7,C: 1=in quotes
; Inputs: IY addresses source string
; DE addresses destination string
; (must be page boundary)
; C sets initial mode
; Outputs: DE, IY updated
; A holds carriage return
;
LEXAN1: LD (DE),A ;TRANSFER TO BUFFER
CP TK_EXTENDED
JR NZ, LEXAN_NOT_EXTENDED
EX AF, AF ; STORE THE EXTENDED TOKEN VALUE
INC DE
LD (DE), A
EX AF, AF
LEXAN_NOT_EXTENDED:
INC DE ;INCREMENT POINTERS
INC IY
LEXAN2: LD A,E ;MAIN ENTRY
CP 252 ;TEST LENGTH
JR NC,SPACE ;LINE TOO LONG
LD A,(IY)
CP CR
RET Z ;END OF LINE
CALL RANGE1
JR NC,LEXAN3
RES 5,C ;NOT IN VARIABLE
RES 3,C ;NOT IN HEX
LEXAN3: CP ' '
JR Z,LEXAN1 ;PASS SPACES
CP ','
JR Z,LEXAN1 ;PASS COMMAS
CP 'G'
JR C,LEXAN4
RES 3,C ;NOT IN HEX
LEXAN4: CP DOUBLE_QUOTE
JR NZ,LEXAN5
RL C
CCF ;TOGGLE C7
RR C
LEXAN5: BIT 4,C
JR Z,LEXAN6
RES 4,C
PUSH BC
PUSH DE
CALL LINNUM ;GET LINE NUMBER
POP DE
POP BC
LD A,H
OR L
CALL NZ,ENCODE ;ENCODE LINE NUMBER
JR LEXAN2 ;CONTINUE
;
LEXAN6: DEC C
JR Z,LEXAN7 ;C=1 (LEFT)
INC C
JR NZ,LEXAN1
OR A
CALL P,LEX ;TOKENISE IF POSS.
JR LEXAN8
;
LEXAN7: CP '*'
JR Z,LEXAN9
OR A
CALL P,LEX ;TOKENISE IF POSS.
CP TK_TOKLO
JR C,LEXAN8
CP TK_TOKHI+1
JR NC,LEXAN8
ADD A,TK_OFFSET ;LEFT VERSION
LEXAN8: CP TKN_REM
JR Z,LEXAN9
CP TKN_DATA
JR NZ,LEXANA
LEXAN9: SET 6,C ;QUIT TOKENISING
LEXANA: CP TKE_FN
JR Z,LEXANB
CP TKN_PROC
JR Z,LEXANB
CALL RANGE2
JR C,LEXANC
LEXANB: SET 5,C ;IN VARIABLE/FN/PROC
LEXANC: CP '&'
JR NZ,LEXAND
SET 3,C ;IN HEX
LEXAND: LD HL,LIST1
PUSH BC
LD BC,LIST1L
CPIR
POP BC
JR NZ,LEXANE
SET 4,C ;ACCEPT LINE NUMBER
LEXANE: LD HL,LIST2
PUSH BC
LD BC,LIST2L
CPIR
POP BC
JR NZ,LEXANF
SET 0,C ;ENTER LEFT MODE
LEXANF: JP LEXAN1
;
LIST1: DEFB TKN_GOTO
DEFB TKN_GOSUB
DEFB TKN_RESTOR
DEFB TKN_TRACE
LIST2: DEFB TKR_THEN
DEFB TKR_ELSE
LIST1END:
LIST1L EQU LIST1END - LIST1 ; $-LIST1
DEFB TKN_REPEAT
DEFB TKR_ERROR
DEFB ':'
LIST2END:
LIST2L EQU LIST2END - LIST2 ;$-LIST2
;
;ENCODE - ENCODE LINE NUMBER INTO PSEUDO-BINARY FORM.
; Inputs: HL=line number, DE=string pointer
; Outputs: DE updated, BIT 4,C set.
; Destroys: A,B,C,D,E,H,L,F
;
ENCODE: SET 4,C
EX DE,HL
LD (HL),TKE_DECODE
INC HL
LD A,D
AND 0C0H
RRCA
RRCA
LD B,A
LD A,E
AND 0C0H
OR B
RRCA
RRCA
XOR 01010100B
LD (HL),A
INC HL
LD A,E
AND 3FH
OR '@'
LD (HL),A
INC HL
LD A,D
AND 3FH
OR '@'
LD (HL),A
INC HL
EX DE,HL
RET
;
;TEXT - OUTPUT MESSAGE.
; Inputs: HL addresses text (terminated by nul)
; Outputs: HL addresses character following nul.
; Destroys: A,H,L,F
;
REPORT: LD HL,(ERRTXT)
TEXT: LD A,(HL)
INC HL
OR A
RET Z
CALL TKOUT
JR TEXT
;
;TELL - OUTPUT MESSAGE.
; Inputs: Text follows subroutine call (term=nul)
; Destroys: A,F
;
TELL: EX (SP),HL ;GET RETURN ADDRESS
CALL TEXT
EX (SP),HL
RET
PRTHL: ; PRINT in DECIMAL, the 16bit number in HL
EXX
LD HL, 0
LD C, 0
LD DE, ACCS
LD IX, NO_FORMAT
CALL NUMTOSTR
EX DE, HL
LD (HL), 0
LD HL, ACCS
JP TEXT
NO_FORMAT:
DEFB 0
DEFB 0
DEFB 0
DEFB 0
|
src/frontend/Experimental_Ada_ROSE_Connection/parser/asis_adapter/source/asis_adapter-context.adb | ouankou/rose | 488 | 5074 | with Asis.Ada_Environments;
with Asis.Compilation_Units;
with Asis.Exceptions;
with Asis.Errors;
with Asis.Implementation;
with GNAT.Directory_Operations;
with Asis_Adapter.Unit;
with a_nodes_h.Support;
package body Asis_Adapter.Context is
procedure Set_Context
(Asis_Context : in Asis.Context;
A_Nodes : in Standard.A_Nodes.Access_Class)
is
use Asis.Ada_Environments;
begin
A_Nodes.Set
(Context =>
(Name => To_Chars_Ptr (Name (Asis_Context)),
Parameters => To_Chars_Ptr (Parameters (Asis_Context)),
Debug_Image => To_Chars_Ptr (Debug_Image (Asis_Context))));
end Set_Context;
procedure Process_Units
(This : in out Class;
Options : in Unit.Options_Record;
Outputs : in Outputs_Record)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process_Units";
package Logging is new Generic_Logging (Module_Name); use Logging;
use Asis.Exceptions;
Units : Asis.Compilation_Unit_List :=
Asis.Compilation_Units.Compilation_Units (This.Asis_Context);
begin
for Unit of Units loop
declare
Tool_Unit : Asis_Adapter.Unit.Class;
begin
Tool_Unit.Process (Unit, Options, Outputs);
end;
end loop;
exception
when Ex : ASIS_Inappropriate_Context |
ASIS_Inappropriate_Container |
ASIS_Inappropriate_Compilation_Unit |
ASIS_Inappropriate_Element |
ASIS_Inappropriate_Line |
ASIS_Inappropriate_Line_Number |
ASIS_Failed =>
Log ("Caught ASIS exception: " & AEX.Exception_Name (Ex));
Log ("ASIS Error Status: " &
Asis.Errors.Error_Kinds'Image (Asis.Implementation.Status));
Log ("ASIS Diagnosis: " & To_String (Asis.Implementation.Diagnosis));
Log ("Reraising");
raise;
end Process_Units;
------------
-- EXPORTED:
------------
procedure Process
(This : in out Class;
Tree_File_Name : in String;
Unit_Options : in Unit.Options_Record;
Outputs : in Outputs_Record)
is
Parent_Name : constant String := Module_Name;
Module_Name : constant String := Parent_Name & ".Process";
package Logging is new Generic_Logging (Module_Name); use Logging;
procedure Begin_Environment is begin
Asis.Ada_Environments.Associate
(The_Context => This.Asis_Context,
Name => To_Wide_String (Tree_File_Name),
Parameters => To_Wide_String ("-C1 " & Tree_File_Name));
Asis.Ada_Environments.Open (This.Asis_Context);
Trace_Put_Line ("Context info: " & Asis.Ada_Environments.Debug_Image
(This.Asis_Context));
end;
procedure End_Environment is begin
Asis.Ada_Environments.Close (This.Asis_Context);
Asis.Ada_Environments.Dissociate (This.Asis_Context);
end;
begin
Log ("BEGIN");
Log ("Tree_File_Name => """ & Tree_File_Name & """");
Begin_Environment;
-- Call Begin_Environment first:
Outputs.Graph.Set_ID
("""" & To_String (Asis.Ada_Environments.Name (This.Asis_Context)) & """");
Set_Context (This.Asis_Context, Outputs.A_Nodes);
Process_Units (This, Unit_Options, Outputs);
End_Environment;
Log ("END");
end Process;
end Asis_Adapter.Context;
|
libsrc/_DEVELOPMENT/alloc/malloc/z80/asm_aligned_alloc.asm | jpoikela/z88dk | 640 | 14991 |
; ===============================================================
; Dec 2013
; ===============================================================
;
; void *aligned_alloc(size_t alignment, size_t size)
;
; Allocate size bytes from the thread's default heap at an
; address that is an integer multiple of alignment.
; Returns 0 with carry set on failure.
;
; If alignment is not an exact power of 2, it will be rounded up
; to the next power of 2.
;
; Returns 0 if size == 0 without indicating error.
;
; ===============================================================
INCLUDE "config_private.inc"
SECTION code_clib
SECTION code_alloc_malloc
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
IF __CLIB_OPT_MULTITHREAD & $01
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC asm_aligned_alloc
EXTERN __malloc_heap
EXTERN asm_heap_alloc_aligned
asm_aligned_alloc:
; Attempt to allocate memory at an address that is aligned to a power of 2
; from the thread's default heap
;
; enter : hl = size
; bc = alignment (promoted to next higher power of two if necessary)
;
; exit : success
;
; hl = void *p_aligned could be zero if size == 0
; carry reset
;
; fail on alignment == $10000
;
; hl = 0
; carry set, errno = EINVAL
;
; fail on memory not found
;
; hl = 0
; carry set, errno = ENOMEM
;
; fail on lock acquisition
;
; hl = 0
; carry set, errno = ENOLCK
;
; uses : af, bc, de, hl
ld de,(__malloc_heap)
jp asm_heap_alloc_aligned
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ELSE
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
PUBLIC asm_aligned_alloc
EXTERN asm_aligned_alloc_unlocked
defc asm_aligned_alloc = asm_aligned_alloc_unlocked
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ENDIF
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
support/MinGW/lib/gcc/mingw32/9.2.0/adainclude/s-finmas.adb | orb-zhuchen/Orb | 0 | 20894 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- S Y S T E M . F I N A L I Z A T I O N _ M A S T E R S --
-- --
-- B o d y --
-- --
-- Copyright (C) 2015-2019, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception, --
-- version 3.1, as published by the Free Software Foundation. --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
with Ada.Exceptions; use Ada.Exceptions;
with System.Address_Image;
with System.HTable; use System.HTable;
with System.IO; use System.IO;
with System.Soft_Links; use System.Soft_Links;
with System.Storage_Elements; use System.Storage_Elements;
package body System.Finalization_Masters is
-- Finalize_Address hash table types. In general, masters are homogeneous
-- collections of controlled objects. Rare cases such as allocations on a
-- subpool require heterogeneous masters. The following table provides a
-- relation between object address and its Finalize_Address routine.
type Header_Num is range 0 .. 127;
function Hash (Key : System.Address) return Header_Num;
-- Address --> Finalize_Address_Ptr
package Finalize_Address_Table is new Simple_HTable
(Header_Num => Header_Num,
Element => Finalize_Address_Ptr,
No_Element => null,
Key => System.Address,
Hash => Hash,
Equal => "=");
---------------------------
-- Add_Offset_To_Address --
---------------------------
function Add_Offset_To_Address
(Addr : System.Address;
Offset : System.Storage_Elements.Storage_Offset) return System.Address
is
begin
return System.Storage_Elements."+" (Addr, Offset);
end Add_Offset_To_Address;
------------
-- Attach --
------------
procedure Attach (N : not null FM_Node_Ptr; L : not null FM_Node_Ptr) is
begin
Lock_Task.all;
Attach_Unprotected (N, L);
Unlock_Task.all;
-- Note: No need to unlock in case of an exception because the above
-- code can never raise one.
end Attach;
------------------------
-- Attach_Unprotected --
------------------------
procedure Attach_Unprotected
(N : not null FM_Node_Ptr;
L : not null FM_Node_Ptr)
is
begin
L.Next.Prev := N;
N.Next := L.Next;
L.Next := N;
N.Prev := L;
end Attach_Unprotected;
---------------
-- Base_Pool --
---------------
function Base_Pool
(Master : Finalization_Master) return Any_Storage_Pool_Ptr
is
begin
return Master.Base_Pool;
end Base_Pool;
-----------------------------------------
-- Delete_Finalize_Address_Unprotected --
-----------------------------------------
procedure Delete_Finalize_Address_Unprotected (Obj : System.Address) is
begin
Finalize_Address_Table.Remove (Obj);
end Delete_Finalize_Address_Unprotected;
------------
-- Detach --
------------
procedure Detach (N : not null FM_Node_Ptr) is
begin
Lock_Task.all;
Detach_Unprotected (N);
Unlock_Task.all;
-- Note: No need to unlock in case of an exception because the above
-- code can never raise one.
end Detach;
------------------------
-- Detach_Unprotected --
------------------------
procedure Detach_Unprotected (N : not null FM_Node_Ptr) is
begin
if N.Prev /= null and then N.Next /= null then
N.Prev.Next := N.Next;
N.Next.Prev := N.Prev;
N.Prev := null;
N.Next := null;
end if;
end Detach_Unprotected;
--------------
-- Finalize --
--------------
overriding procedure Finalize (Master : in out Finalization_Master) is
Cleanup : Finalize_Address_Ptr;
Curr_Ptr : FM_Node_Ptr;
Ex_Occur : Exception_Occurrence;
Obj_Addr : Address;
Raised : Boolean := False;
function Is_Empty_List (L : not null FM_Node_Ptr) return Boolean;
-- Determine whether a list contains only one element, the dummy head
-------------------
-- Is_Empty_List --
-------------------
function Is_Empty_List (L : not null FM_Node_Ptr) return Boolean is
begin
return L.Next = L and then L.Prev = L;
end Is_Empty_List;
-- Start of processing for Finalize
begin
Lock_Task.all;
-- Synchronization:
-- Read - allocation, finalization
-- Write - finalization
if Master.Finalization_Started then
Unlock_Task.all;
-- Double finalization may occur during the handling of stand alone
-- libraries or the finalization of a pool with subpools. Due to the
-- potential aliasing of masters in these two cases, do not process
-- the same master twice.
return;
end if;
-- Lock the master to prevent any allocations while the objects are
-- being finalized. The master remains locked because either the master
-- is explicitly deallocated or the associated access type is about to
-- go out of scope.
-- Synchronization:
-- Read - allocation, finalization
-- Write - finalization
Master.Finalization_Started := True;
while not Is_Empty_List (Master.Objects'Unchecked_Access) loop
Curr_Ptr := Master.Objects.Next;
-- Synchronization:
-- Write - allocation, deallocation, finalization
Detach_Unprotected (Curr_Ptr);
-- Skip the list header in order to offer proper object layout for
-- finalization.
Obj_Addr := Curr_Ptr.all'Address + Header_Size;
-- Retrieve TSS primitive Finalize_Address depending on the master's
-- mode of operation.
-- Synchronization:
-- Read - allocation, finalization
-- Write - outside
if Master.Is_Homogeneous then
-- Synchronization:
-- Read - finalization
-- Write - allocation, outside
Cleanup := Master.Finalize_Address;
else
-- Synchronization:
-- Read - finalization
-- Write - allocation, deallocation
Cleanup := Finalize_Address_Unprotected (Obj_Addr);
end if;
begin
Cleanup (Obj_Addr);
exception
when Fin_Occur : others =>
if not Raised then
Raised := True;
Save_Occurrence (Ex_Occur, Fin_Occur);
end if;
end;
-- When the master is a heterogeneous collection, destroy the object
-- - Finalize_Address pair since it is no longer needed.
-- Synchronization:
-- Read - finalization
-- Write - outside
if not Master.Is_Homogeneous then
-- Synchronization:
-- Read - finalization
-- Write - allocation, deallocation, finalization
Delete_Finalize_Address_Unprotected (Obj_Addr);
end if;
end loop;
Unlock_Task.all;
-- If the finalization of a particular object failed or Finalize_Address
-- was not set, reraise the exception now.
if Raised then
Reraise_Occurrence (Ex_Occur);
end if;
end Finalize;
----------------------
-- Finalize_Address --
----------------------
function Finalize_Address
(Master : Finalization_Master) return Finalize_Address_Ptr
is
begin
return Master.Finalize_Address;
end Finalize_Address;
----------------------------------
-- Finalize_Address_Unprotected --
----------------------------------
function Finalize_Address_Unprotected
(Obj : System.Address) return Finalize_Address_Ptr
is
begin
return Finalize_Address_Table.Get (Obj);
end Finalize_Address_Unprotected;
--------------------------
-- Finalization_Started --
--------------------------
function Finalization_Started
(Master : Finalization_Master) return Boolean
is
begin
return Master.Finalization_Started;
end Finalization_Started;
----------
-- Hash --
----------
function Hash (Key : System.Address) return Header_Num is
begin
return
Header_Num
(To_Integer (Key) mod Integer_Address (Header_Num'Range_Length));
end Hash;
-----------------
-- Header_Size --
-----------------
function Header_Size return System.Storage_Elements.Storage_Count is
begin
return FM_Node'Size / Storage_Unit;
end Header_Size;
----------------
-- Initialize --
----------------
overriding procedure Initialize (Master : in out Finalization_Master) is
begin
-- The dummy head must point to itself in both directions
Master.Objects.Next := Master.Objects'Unchecked_Access;
Master.Objects.Prev := Master.Objects'Unchecked_Access;
end Initialize;
--------------------
-- Is_Homogeneous --
--------------------
function Is_Homogeneous (Master : Finalization_Master) return Boolean is
begin
return Master.Is_Homogeneous;
end Is_Homogeneous;
-------------
-- Objects --
-------------
function Objects (Master : Finalization_Master) return FM_Node_Ptr is
begin
return Master.Objects'Unrestricted_Access;
end Objects;
------------------
-- Print_Master --
------------------
procedure Print_Master (Master : Finalization_Master) is
Head : constant FM_Node_Ptr := Master.Objects'Unrestricted_Access;
Head_Seen : Boolean := False;
N_Ptr : FM_Node_Ptr;
begin
-- Output the basic contents of a master
-- Master : 0x123456789
-- Is_Hmgen : TURE <or> FALSE
-- Base_Pool: null <or> 0x123456789
-- Fin_Addr : null <or> 0x123456789
-- Fin_Start: TRUE <or> FALSE
Put ("Master : ");
Put_Line (Address_Image (Master'Address));
Put ("Is_Hmgen : ");
Put_Line (Master.Is_Homogeneous'Img);
Put ("Base_Pool: ");
if Master.Base_Pool = null then
Put_Line ("null");
else
Put_Line (Address_Image (Master.Base_Pool'Address));
end if;
Put ("Fin_Addr : ");
if Master.Finalize_Address = null then
Put_Line ("null");
else
Put_Line (Address_Image (Master.Finalize_Address'Address));
end if;
Put ("Fin_Start: ");
Put_Line (Master.Finalization_Started'Img);
-- Output all chained elements. The format is the following:
-- ^ <or> ? <or> null
-- |Header: 0x123456789 (dummy head)
-- | Prev: 0x123456789
-- | Next: 0x123456789
-- V
-- ^ - the current element points back to the correct element
-- ? - the current element points back to an erroneous element
-- n - the current element points back to null
-- Header - the address of the list header
-- Prev - the address of the list header which the current element
-- points back to
-- Next - the address of the list header which the current element
-- points to
-- (dummy head) - present if dummy head
N_Ptr := Head;
while N_Ptr /= null loop -- Should never be null
Put_Line ("V");
-- We see the head initially; we want to exit when we see the head a
-- second time.
if N_Ptr = Head then
exit when Head_Seen;
Head_Seen := True;
end if;
-- The current element is null. This should never happen since the
-- list is circular.
if N_Ptr.Prev = null then
Put_Line ("null (ERROR)");
-- The current element points back to the correct element
elsif N_Ptr.Prev.Next = N_Ptr then
Put_Line ("^");
-- The current element points to an erroneous element
else
Put_Line ("? (ERROR)");
end if;
-- Output the header and fields
Put ("|Header: ");
Put (Address_Image (N_Ptr.all'Address));
-- Detect the dummy head
if N_Ptr = Head then
Put_Line (" (dummy head)");
else
Put_Line ("");
end if;
Put ("| Prev: ");
if N_Ptr.Prev = null then
Put_Line ("null");
else
Put_Line (Address_Image (N_Ptr.Prev.all'Address));
end if;
Put ("| Next: ");
if N_Ptr.Next = null then
Put_Line ("null");
else
Put_Line (Address_Image (N_Ptr.Next.all'Address));
end if;
N_Ptr := N_Ptr.Next;
end loop;
end Print_Master;
-------------------
-- Set_Base_Pool --
-------------------
procedure Set_Base_Pool
(Master : in out Finalization_Master;
Pool_Ptr : Any_Storage_Pool_Ptr)
is
begin
Master.Base_Pool := Pool_Ptr;
end Set_Base_Pool;
--------------------------
-- Set_Finalize_Address --
--------------------------
procedure Set_Finalize_Address
(Master : in out Finalization_Master;
Fin_Addr_Ptr : Finalize_Address_Ptr)
is
begin
-- Synchronization:
-- Read - finalization
-- Write - allocation, outside
Lock_Task.all;
Set_Finalize_Address_Unprotected (Master, Fin_Addr_Ptr);
Unlock_Task.all;
end Set_Finalize_Address;
--------------------------------------
-- Set_Finalize_Address_Unprotected --
--------------------------------------
procedure Set_Finalize_Address_Unprotected
(Master : in out Finalization_Master;
Fin_Addr_Ptr : Finalize_Address_Ptr)
is
begin
if Master.Finalize_Address = null then
Master.Finalize_Address := Fin_Addr_Ptr;
end if;
end Set_Finalize_Address_Unprotected;
----------------------------------------------------
-- Set_Heterogeneous_Finalize_Address_Unprotected --
----------------------------------------------------
procedure Set_Heterogeneous_Finalize_Address_Unprotected
(Obj : System.Address;
Fin_Addr_Ptr : Finalize_Address_Ptr)
is
begin
Finalize_Address_Table.Set (Obj, Fin_Addr_Ptr);
end Set_Heterogeneous_Finalize_Address_Unprotected;
--------------------------
-- Set_Is_Heterogeneous --
--------------------------
procedure Set_Is_Heterogeneous (Master : in out Finalization_Master) is
begin
-- Synchronization:
-- Read - finalization
-- Write - outside
Lock_Task.all;
Master.Is_Homogeneous := False;
Unlock_Task.all;
end Set_Is_Heterogeneous;
end System.Finalization_Masters;
|
tools/scitools/conf/understand/ada/ada12/g-locfil.ads | brucegua/moocos | 1 | 19509 | ------------------------------------------------------------------------------
-- --
-- GNAT COMPILER COMPONENTS --
-- --
-- G N A T . L O C K _ F I L E S --
-- --
-- S p e c --
-- --
-- Copyright (C) 1995-2010, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
-- ware Foundation; either version 3, or (at your option) any later ver- --
-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
-- GNAT was originally developed by the GNAT team at New York University. --
-- Extensive contributions were provided by Ada Core Technologies Inc. --
-- --
------------------------------------------------------------------------------
-- This package contains the necessary routines for using files for the
-- purpose of providing reliable system wide locking capability.
package GNAT.Lock_Files is
pragma Preelaborate;
Lock_Error : exception;
-- Exception raised if file cannot be locked
subtype Path_Name is String;
-- Pathname is used by all services provided in this unit to specified
-- directory name and file name. On DOS based systems both directory
-- separators are handled (i.e. slash and backslash).
procedure Lock_File
(Directory : Path_Name;
Lock_File_Name : Path_Name;
Wait : Duration := 1.0;
Retries : Natural := Natural'Last);
-- Create a lock file Lock_File_Name in directory Directory. If the file
-- cannot be locked because someone already owns the lock, this procedure
-- waits Wait seconds and retries at most Retries times. If the file
-- still cannot be locked, Lock_Error is raised. The default is to try
-- every second, almost forever (Natural'Last times). The full path of
-- the file is constructed by concatenating Directory and Lock_File_Name.
-- Directory can optionally terminate with a directory separator.
procedure Lock_File
(Lock_File_Name : Path_Name;
Wait : Duration := 1.0;
Retries : Natural := Natural'Last);
-- See above. The full lock file path is given as one string
procedure Unlock_File (Directory : Path_Name; Lock_File_Name : Path_Name);
-- Unlock a file. Directory can optionally terminate with a directory
-- separator.
procedure Unlock_File (Lock_File_Name : Path_Name);
-- Unlock a file whose full path is given in Lock_File_Name
end GNAT.Lock_Files;
|
test/hexfp.asm | bitwiseworks/nasm-os2 | 1 | 21461 | <gh_stars>1-10
;; BR 3392399
; All of these should be the same value...
%macro fp 1
%1 0.5
%1 5e-1
%1 0x1.0p-1
%1 0x0.8p0
%1 0x0.8
%1 0x8p-4
%1 0x.8
%1 0x1p-1
%1 0x0.1p3
%1 0x0.01p7
%1 0x0.01p7
%1 0x0.001p11
%endmacro
fp do
fp dt
fp dq
fp dd
fp dw
fp dd
|
cs/unittest/VowpalWabbit.g4 | martinpopel/vowpal_wabbit | 4 | 5211 | grammar VowpalWabbit;
number returns [float value] : NUMBER;
label_simple : value=number (WS initial=number)? WS;
label_cbf : value=INT ':' weight=NUMBER;
namespace : '|' name=STRING? (WS feature)+ WS?;
feature : index=(STRING | NUMBER) (':' x=number)? # FeatureSparse
| ':' x=NUMBER # FeatureDense
;
// needs more testing
tag : ('`' STRING)? WS
| STRING
;
example : label_simple tag? namespace (WS namespace)*;
start : (example NEWLINE)* example (NEWLINE | EOF);
// greedy matching, if same length its matched in order
NUMBER : INT | FLOAT;
INT : [+-]? [0-9]+ ([Ee] '-'? [0-9]+)?;
FLOAT : [+-]? [0-9]* '.' [0-9]+ ([Ee] '-'? [0-9]+)?;
WS : [ \t]+;
NEWLINE : '\r'? '\n';
STRING : ~([:| \t\r\n])+;
|
src/natools-s_expressions-atom_buffers.ads | faelys/natools | 0 | 6058 | <filename>src/natools-s_expressions-atom_buffers.ads<gh_stars>0
------------------------------------------------------------------------------
-- Copyright (c) 2014, <NAME> --
-- --
-- Permission to use, copy, modify, and distribute this software for any --
-- purpose with or without fee is hereby granted, provided that the above --
-- copyright notice and this permission notice appear in all copies. --
-- --
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES --
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF --
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR --
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES --
-- WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN --
-- ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF --
-- OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --
------------------------------------------------------------------------------
------------------------------------------------------------------------------
-- Natools.S_Expressions.Atom_Buffers implements an unbounded Atom designed --
-- to be used as an input buffer, accumulating data and extracting it as a --
-- single Atom object. --
-- It also provides an individual Octet accessor, used in parser internal --
-- recursive buffer. --
------------------------------------------------------------------------------
with Natools.S_Expressions.Atom_Refs;
package Natools.S_Expressions.Atom_Buffers is
pragma Preelaborate (Atom_Buffers);
type Atom_Buffer is new Ada.Streams.Root_Stream_Type with private;
pragma Preelaborable_Initialization (Atom_Buffer);
overriding procedure Write
(Buffer : in out Atom_Buffer;
Item : in Ada.Streams.Stream_Element_Array);
overriding procedure Read
(Buffer : in out Atom_Buffer;
Item : out Ada.Streams.Stream_Element_Array;
Last : out Ada.Streams.Stream_Element_Offset);
procedure Preallocate (Buffer : in out Atom_Buffer; Length : in Count);
-- Preallocate enough memory to append Length octets without
-- any further allocation.
procedure Append (Buffer : in out Atom_Buffer; Data : in Atom);
procedure Append (Buffer : in out Atom_Buffer; Data : in Octet);
-- Append Data after the end of Buffer
procedure Append_Reverse (Buffer : in out Atom_Buffer; Data : in Atom);
-- Append bytes from Atom from last to first
procedure Invert (Buffer : in out Atom_Buffer);
-- Invert the order of bytes (first becomes last, etc)
function Length (Buffer : Atom_Buffer) return Count;
function Capacity (Buffer : Atom_Buffer) return Count;
function Data (Buffer : Atom_Buffer) return Atom;
procedure Query
(Buffer : in Atom_Buffer;
Process : not null access procedure (Data : in Atom));
procedure Peek
(Buffer : in Atom_Buffer;
Data : out Atom;
Length : out Count);
function Element (Buffer : Atom_Buffer; Position : Count) return Octet;
-- Accessors to the whole buffer as an Atom
procedure Pop (Buffer : in out Atom_Buffer; Data : out Octet);
-- Remove last octet from Buffer and store it in Data
function Raw_Query (Buffer : Atom_Buffer) return Atom_Refs.Accessor;
-- Accessor to the whole allocated memory
procedure Hard_Reset (Buffer : in out Atom_Buffer);
-- Clear buffer and release internal memory
procedure Soft_Reset (Buffer : in out Atom_Buffer);
-- Clear buffer keeping internal memory
private
type Atom_Buffer is new Ada.Streams.Root_Stream_Type with record
Ref : Atom_Refs.Reference;
Available, Used : Count := 0;
end record;
end Natools.S_Expressions.Atom_Buffers;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.