max_stars_repo_path
stringlengths
4
261
max_stars_repo_name
stringlengths
6
106
max_stars_count
int64
0
38.8k
id
stringlengths
1
6
text
stringlengths
7
1.05M
src/main/antlr4/MySQLParser.g4
stream-iori/antlr4-mysql
0
5659
parser grammar MySQLParser; options { tokenVocab = MySQLLexer; } // expression statement ------- http://dev.mysql.com/doc/refman/5.6/en/expressions.html ------------- expression: exp_factor1 ( OR_SYM exp_factor1 )* ; exp_factor1: exp_factor2 ( XOR exp_factor2 )* ; exp_factor2: exp_factor3 ( AND_SYM exp_factor3 )* ; exp_factor3: (NOT_SYM)? exp_factor4 ; exp_factor4: bool_primary ( IS_SYM (NOT_SYM)? (BOOLEAN_LITERAL|NULL_SYM) )? ; bool_primary: ( predicate RELATIONAL_OP predicate ) | ( predicate RELATIONAL_OP ( ALL | ANY )? subquery ) | ( NOT_SYM? EXISTS subquery ) | predicate ; predicate: ( bit_expr (NOT_SYM)? IN_SYM (subquery | expression_list) ) | ( bit_expr (NOT_SYM)? BETWEEN bit_expr AND_SYM predicate ) | ( bit_expr SOUNDS_SYM LIKE_SYM bit_expr ) | ( bit_expr (NOT_SYM)? LIKE_SYM simple_expr (ESCAPE_SYM simple_expr)? ) | ( bit_expr (NOT_SYM)? REGEXP bit_expr ) | ( bit_expr ) ; bit_expr: factor1 ( VERTBAR factor1 )? ; factor1: factor2 ( BITAND factor2 )? ; factor2: factor3 ( (SHIFT_LEFT|SHIFT_RIGHT) factor3 )? ; factor3: factor4 ( (PLUS|MINUS) factor4 )? ; factor4: factor5 ( (ASTERISK|DIVIDE|MOD_SYM|POWER_OP) factor5 )? ; factor5: factor6 ( (PLUS|MINUS) interval_expr )? ; factor6: (PLUS | MINUS | NEGATION | BINARY) simple_expr | simple_expr ; factor7: simple_expr (COLLATE_SYM COLLATION_NAMES)?; simple_expr: LITERAL_VALUE | column_spec | function_call //| param_marker | USER_VAR | expression_list | (ROW_SYM expression_list) | subquery | EXISTS subquery //| {identifier expression} | match_against_statement | case_when_statement | interval_expr ; function_call: ( FUNCTION_LIST ( LPAREN (expression (COMMA expression)*)? RPAREN ) ? ) | ( CAST_SYM LPAREN expression AS_SYM CAST_DATA_TYPE RPAREN ) | ( CONVERT_SYM LPAREN expression COMMA CAST_DATA_TYPE RPAREN ) | ( CONVERT_SYM LPAREN expression USING_SYM TRANSCODING_NAME RPAREN ) | ( GROUP_FUNCTIONS LPAREN ( ASTERISK | ALL | DISTINCT )? bit_expr RPAREN ) ; case_when_statement: case_when_statement1 | case_when_statement2 ; case_when_statement1: CASE_SYM ( WHEN_SYM expression THEN_SYM bit_expr )+ ( ELSE_SYM bit_expr )? END_SYM ; case_when_statement2: CASE_SYM bit_expr ( WHEN_SYM bit_expr THEN_SYM bit_expr )+ ( ELSE_SYM bit_expr )? END_SYM ; match_against_statement: MATCH (column_spec (COMMA column_spec)* ) AGAINST (expression (SEARCH_MODIFIER)? ) ; column_spec: ( ( SCHEMA_NAME DOT )? TABLE_NAME DOT )? COLUMN_NAME ; expression_list: LPAREN expression ( COMMA expression )* RPAREN ; interval_expr: INTERVAL_SYM expression INTERVAL_UNIT ; // JOIN Syntax ---------- http://dev.mysql.com/doc/refman/5.6/en/join.html --------------- table_references: table_reference ( COMMA table_reference )* ; table_reference: table_factor1 | table_atom ; table_factor1: table_factor2 ( (INNER_SYM | CROSS)? JOIN_SYM table_atom (join_condition)? )? ; table_factor2: table_factor3 ( STRAIGHT_JOIN table_atom (ON expression)? )? ; table_factor3: table_factor4 ( (LEFT|RIGHT) (OUTER)? JOIN_SYM table_factor4 join_condition )? ; table_factor4: table_atom ( NATURAL ( (LEFT|RIGHT) (OUTER)? )? JOIN_SYM table_atom )? ; table_atom: ( table_spec (partition_clause)? (ALIAS)? (index_hint_list)? ) | ( subquery ALIAS ) | ( LPAREN table_references RPAREN ) | ( OJ_SYM table_reference LEFT OUTER JOIN_SYM table_reference ON expression ) ; join_condition: (ON expression) | (USING_SYM column_list) ; index_hint_list: index_hint (COMMA index_hint)* ; index_options: (INDEX_SYM | KEY_SYM) ( FOR_SYM ((JOIN_SYM) | (ORDER_SYM BY_SYM) | (GROUP_SYM BY_SYM)) )? ; index_hint: USE_SYM index_options LPAREN (index_list)? RPAREN | IGNORE_SYM index_options LPAREN index_list RPAREN | FORCE_SYM index_options LPAREN index_list RPAREN ; index_list: INDEX_NAME (COMMA INDEX_NAME)* ; partition_clause: PARTITION_SYM LPAREN partition_names RPAREN ; partition_names: PARTITION_NAME (COMMA PARTITION_NAME)* ; // SQL Statement Syntax ---- http://dev.mysql.com/doc/refman/5.6/en/sql-syntax.html ---------- root_statement: (SHIFT_LEFT SHIFT_RIGHT)? ( data_manipulation_statements | data_definition_statements /*| transactional_locking_statements | replication_statements*/ ) (SEMI)? ; data_manipulation_statements: select_statement | delete_statements | insert_statements | update_statements | call_statement | do_statement | handler_statements | load_data_statement | load_xml_statement | replace_statement ; data_definition_statements: create_database_statement | alter_database_statements | drop_database_statement | create_event_statement | alter_event_statement | drop_event_statement //| create_function_statement //| alter_function_statement //| drop_function_statement //| create_procedure_create_function_statement //| alter_procedure_statement //| drop_procedure_drop_function_statement //| create_trigger_statement //| drop_trigger_statement | create_server_statement | alter_server_statement | drop_server_statement | create_table_statement | alter_table_statement | drop_table_statement | create_view_statement | alter_view_statement | rename_table_statement | drop_view_statement | truncate_table_statement | create_index_statement | drop_index_statement ; /*transactional_locking_statements: start_transaction_statement | comment_statement | rollback_statement | savepoint_statement | rollback_to_savepoint_statement | release_savepoint_statement | lock_table_statement | unlock_table_statement | set_transaction_statement | xa_transaction_statement ; replication_statements: controlling_master_servers_statements | controlling_slave_servers_statements ; */ // select ------ http://dev.mysql.com/doc/refman/5.6/en/select.html ------------------------------- select_statement: select_expression ( (UNION_SYM (ALL)?) select_expression )* ; select_expression: SELECT ( ALL | DISTINCT | DISTINCTROW )? (HIGH_PRIORITY)? (STRAIGHT_JOIN)? (SQL_SMALL_RESULT)? (SQL_BIG_RESULT)? (SQL_BUFFER_RESULT)? (SQL_CACHE_SYM | SQL_NO_CACHE_SYM)? (SQL_CALC_FOUND_ROWS)? select_list ( FROM table_references ( partition_clause )? ( where_clause )? ( groupby_clause )? ( having_clause )? ) ? ( orderby_clause )? ( limit_clause )? ( ( FOR_SYM UPDATE) | (LOCK IN_SYM SHARE_SYM MODE_SYM) )? ; where_clause: WHERE expression ; groupby_clause: GROUP_SYM BY_SYM groupby_item (COMMA groupby_item)* (WITH ROLLUP_SYM)? ; groupby_item: column_spec | INTEGER_NUM | bit_expr ; having_clause: HAVING expression ; orderby_clause: ORDER_SYM BY_SYM orderby_item (COMMA orderby_item)* ; orderby_item: groupby_item (ASC | DESC)? ; limit_clause: LIMIT ((offset COMMA)? row_count) | (row_count OFFSET_SYM offset) ; offset: INTEGER_NUM ; row_count: INTEGER_NUM ; select_list: ( ( displayed_column ( COMMA displayed_column )*) | ASTERISK ) ; column_list: LPAREN column_spec (COMMA column_spec)* RPAREN ; subquery: LPAREN select_statement RPAREN ; table_spec: ( SCHEMA_NAME DOT )? TABLE_NAME ; displayed_column : ( table_spec DOT ASTERISK ) | ( column_spec (ALIAS)? ) | ( bit_expr (ALIAS)? ) ; // delete ------ http://dev.mysql.com/doc/refman/5.6/en/delete.html ------------------------ delete_statements: DELETE_SYM (LOW_PRIORITY)? (QUICK)? (IGNORE_SYM)? ( delete_single_table_statement | delete_multiple_table_statement1 | delete_multiple_table_statement2 ) ; delete_single_table_statement: FROM table_spec (partition_clause)? (where_clause)? (orderby_clause)? (limit_clause)? ; delete_multiple_table_statement1: table_spec (ALL_FIELDS)? (COMMA table_spec (ALL_FIELDS)?)* FROM table_references (where_clause)? ; delete_multiple_table_statement2: FROM table_spec (ALL_FIELDS)? (COMMA table_spec (ALL_FIELDS)?)* USING_SYM table_references (where_clause)? ; // insert --------- http://dev.mysql.com/doc/refman/5.6/en/insert.html ------------------------- insert_statements : insert_statement1 | insert_statement2 | insert_statement3 ; insert_header: INSERT (LOW_PRIORITY | HIGH_PRIORITY)? (IGNORE_SYM)? (INTO)? table_spec (partition_clause)? ; insert_subfix: ON DUPLICATE_SYM KEY_SYM UPDATE column_spec EQ_SYM expression (COMMA column_spec EQ_SYM expression)* ; insert_statement1: insert_header (column_list)? value_list_clause ( insert_subfix )? ; value_list_clause: (VALUES | VALUE_SYM) column_value_list (COMMA column_value_list)*; column_value_list: LPAREN (bit_expr|DEFAULT) (COMMA (bit_expr|DEFAULT) )* RPAREN ; insert_statement2: insert_header set_columns_cluase ( insert_subfix )? ; set_columns_cluase: SET_SYM set_column_cluase ( COMMA set_column_cluase )*; set_column_cluase: column_spec EQ_SYM (expression|DEFAULT) ; insert_statement3: insert_header (column_list)? select_expression ( insert_subfix )? ; // update -------- http://dev.mysql.com/doc/refman/5.6/en/update.html ------------------------ update_statements : single_table_update_statement | multiple_table_update_statement ; single_table_update_statement: UPDATE (LOW_PRIORITY)? (IGNORE_SYM)? table_reference set_columns_cluase (where_clause)? (orderby_clause)? (limit_clause)? ; multiple_table_update_statement: UPDATE (LOW_PRIORITY)? (IGNORE_SYM)? table_references set_columns_cluase (where_clause)? ; // call ----------- http://dev.mysql.com/doc/refman/5.6/en/call.html ------------------------- call_statement: CALL_SYM PROCEDURE_NAME (LPAREN ( bit_expr (COMMA bit_expr)* )? RPAREN)? ; // do -------------- http://dev.mysql.com/doc/refman/5.6/en/do.html ---------------------------- do_statement: DO_SYM root_statement (COMMA root_statement)* ; // handler ------------ http://dev.mysql.com/doc/refman/5.6/en/handler.html ---------------------- handler_statements: HANDLER_SYM TABLE_NAME (open_handler_statement | handler_statement1 | handler_statement2 | handler_statement3 | close_handler_statement) ; open_handler_statement: OPEN_SYM (ALIAS)? ; handler_statement1: READ_SYM INDEX_NAME RELATIONAL_OP LPAREN bit_expr (COMMA bit_expr)* RPAREN (where_clause)? (limit_clause)? ; handler_statement2: READ_SYM INDEX_NAME (FIRST_SYM | NEXT_SYM | PREV_SYM | LAST_SYM) (where_clause)? (limit_clause)? ; handler_statement3: READ_SYM (FIRST_SYM | NEXT_SYM) (where_clause)? (limit_clause)? ; close_handler_statement: CLOSE_SYM ; // load data ------------ http://dev.mysql.com/doc/refman/5.6/en/load-data.html --------------------- load_data_statement: LOAD DATA_SYM (LOW_PRIORITY | CONCURRENT)? (LOCAL_SYM)? INFILE TEXT_STRING (REPLACE | IGNORE_SYM)? INTO TABLE table_spec (partition_clause)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? ( (FIELDS_SYM | COLUMNS_SYM) (TERMINATED BY_SYM TEXT_STRING)? ((OPTIONALLY)? ENCLOSED BY_SYM TEXT_STRING)? (ESCAPED BY_SYM TEXT_STRING)? )? ( LINES (STARTING BY_SYM TEXT_STRING)? (TERMINATED BY_SYM TEXT_STRING)? )? (IGNORE_SYM INTEGER_NUM (LINES | ROWS_SYM))? (LPAREN (column_spec|USER_VAR) (COMMA (column_spec|USER_VAR))* RPAREN)? (set_columns_cluase)? ; // load xml --------------- http://dev.mysql.com/doc/refman/5.6/en/load-xml.html ---------------------- load_xml_statement: LOAD XML_SYM (LOW_PRIORITY | CONCURRENT)? (LOCAL_SYM)? INFILE TEXT_STRING (REPLACE | IGNORE_SYM)? INTO TABLE table_spec (partition_clause)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (ROWS_SYM IDENTIFIED_SYM BY_SYM TEXT_STRING)? (IGNORE_SYM INTEGER_NUM (LINES | ROWS_SYM))? (LPAREN (column_spec|USER_VAR) (COMMA (column_spec|USER_VAR))* RPAREN)? (set_columns_cluase)? ; // replace ------------------- http://dev.mysql.com/doc/refman/5.6/en/replace.html --------------------- replace_statement: replace_statement_header ( replace_statement1 | replace_statement2 | replace_statement3 ) ; replace_statement_header: REPLACE (LOW_PRIORITY | DELAYED_SYM)? (INTO)? TABLE_NAME (partition_clause)? ; replace_statement1: (column_list)? value_list_clause ; replace_statement2: set_columns_cluase ; replace_statement3: (column_list)? select_statement ; // http://dev.mysql.com/doc/refman/5.6/en/create-database.html create_database_statement: CREATE (DATABASE | SCHEMA) (IF NOT_SYM EXISTS)? SCHEMA_NAME ( create_specification (COMMA create_specification)* )* ; create_specification: (DEFAULT)? ( ( CHARACTER_SYM SET_SYM (EQ_SYM)? CHARSET_NAME ) | ( COLLATE_SYM (EQ_SYM)? COLLATION_NAME ) ) ; // http://dev.mysql.com/doc/refman/5.6/en/alter-database.html alter_database_statements: alter_database_statement1 | alter_database_statement2 ; alter_database_statement1: ALTER (DATABASE | SCHEMA) (SCHEMA_NAME)? alter_database_specification ; alter_database_statement2: ALTER (DATABASE | SCHEMA) SCHEMA_NAME UPGRADE_SYM DATA_SYM DIRECTORY_SYM NAME_SYM ; alter_database_specification: (DEFAULT)? CHARACTER_SYM SET_SYM (EQ_SYM)? CHARSET_NAME | (DEFAULT)? COLLATE_SYM (EQ_SYM)? COLLATION_NAMES ; // http://dev.mysql.com/doc/refman/5.6/en/drop-database.html drop_database_statement: DROP (DATABASE | SCHEMA) (IF EXISTS)? SCHEMA_NAME ; // http://dev.mysql.com/doc/refman/5.6/en/create-event.html create_event_statement: CREATE (DEFINER EQ_SYM ( USER_NAME | CURRENT_USER ))? EVENT_SYM (IF NOT_SYM EXISTS)? EVENT_NAME ON SCHEDULE_SYM schedule_definition (ON COMPLETION_SYM (NOT_SYM)? PRESERVE_SYM)? ( ENABLE_SYM | DISABLE_SYM | (DISABLE_SYM ON SLAVE) )? (COMMENT_SYM TEXT_STRING)? do_statement ; schedule_definition: ( AT_SYM timestamp (PLUS INTERVAL_SYM interval)* ) | ( EVERY_SYM interval ) ( STARTS_SYM timestamp (PLUS INTERVAL_SYM interval)* )? ( ENDS_SYM timestamp (PLUS INTERVAL_SYM interval)* )? ; interval: INTEGER_NUM (YEAR | QUARTER | MONTH | DAY_SYM | HOUR | MINUTE | WEEK | SECOND | YEAR_MONTH | DAY_HOUR | DAY_MINUTE | DAY_SECOND | HOUR_MINUTE | HOUR_SECOND | MINUTE_SECOND) ; timestamp: CURRENT_TIMESTAMP //| timestamp_literal //... ; // http://dev.mysql.com/doc/refman/5.6/en/alter-event.html alter_event_statement: ALTER (DEFINER EQ_SYM ( USER_NAME | CURRENT_USER ))? EVENT_SYM EVENT_NAME (ON SCHEDULE_SYM schedule_definition)? (ON COMPLETION_SYM (NOT_SYM)? PRESERVE_SYM)? (RENAME TO_SYM EVENT_NAME)? ( ENABLE_SYM | DISABLE_SYM | (DISABLE_SYM ON SLAVE) )? (COMMENT_SYM TEXT_STRING)? (do_statement)? ; // http://dev.mysql.com/doc/refman/5.6/en/drop-event.html drop_event_statement: DROP EVENT_SYM (IF EXISTS)? EVENT_NAME ; /* // http://dev.mysql.com/doc/refman/5.6/en/create-function.html create_function_statement: ; // http://dev.mysql.com/doc/refman/5.6/en/alter-function.html alter_function_statement: ALTER FUNCTION_SYM FUNCTION_NAME (characteristic)* ; characteristic: ( COMMENT_SYM TEXT_STRING ) | ( LANGUAGE SQL_SYM ) | ( (CONTAINS_SYM SQL_SYM) | (NO_SYM SQL_SYM) | (READS_SYM SQL_SYM DATA_SYM) | (MODIFIES_SYM SQL_SYM DATA_SYM) ) | ( SQL_SYM SECURITY_SYM (DEFINER | INVOKER_SYM) ) ; // http://dev.mysql.com/doc/refman/5.6/en/drop-function.html drop_function_statement: ; */ // http://dev.mysql.com/doc/refman/5.6/en/create-index.html create_index_statement: CREATE (UNIQUE_SYM|FULLTEXT_SYM|SPATIAL_SYM)? INDEX_SYM INDEX_NAME (index_type)? ON TABLE_NAME LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (algorithm_option | lock_option)* ; algorithm_option: ALGORITHM_SYM (EQ_SYM)? (DEFAULT|INPLACE_SYM|COPY_SYM) ; lock_option: LOCK (EQ_SYM)? (DEFAULT|NONE_SYM|SHARED_SYM|EXCLUSIVE_SYM) ; // http://dev.mysql.com/doc/refman/5.6/en/drop-index.html drop_index_statement: DROP INDEX_SYM INDEX_NAME ON TABLE_NAME (algorithm_option | lock_option)* ; /* // http://dev.mysql.com/doc/refman/5.6/en/create-procedure.html create_procedure_create_function_statement: ; // http://dev.mysql.com/doc/refman/5.6/en/alter-procedure.html alter_procedure_statement: ALTER PROCEDURE PROCEDURE_NAME (characteristic)* ; // http://dev.mysql.com/doc/refman/5.6/en/drop-procedure.html drop_procedure_drop_function_statement: ; */ // http://dev.mysql.com/doc/refman/5.6/en/create-server.html create_server_statement: CREATE SERVER_SYM SERVER_NAME FOREIGN DATA_SYM WRAPPER_SYM WRAPPER_NAME OPTIONS_SYM LPAREN create_server_option (COMMA create_server_option)* RPAREN ; create_server_option: | ( HOST_SYM STRING_LITERAL ) | ( DATABASE STRING_LITERAL ) | ( USER STRING_LITERAL ) | ( PASSWORD STRING_LITERAL ) | ( SOCKET_SYM STRING_LITERAL ) | ( OWNER_SYM STRING_LITERAL ) | ( PORT_SYM NUMBER_LITERAL ) ; // http://dev.mysql.com/doc/refman/5.6/en/alter-server.html alter_server_statement: ALTER SERVER_SYM SERVER_NAME OPTIONS_SYM LPAREN alter_server_option (COMMA alter_server_option)* RPAREN ; alter_server_option: (USER) (ID|TEXT_STRING) ; // http://dev.mysql.com/doc/refman/5.6/en/drop-server.html drop_server_statement: DROP SERVER_SYM (IF EXISTS)? SERVER_NAME ; // http://dev.mysql.com/doc/refman/5.6/en/create-table.html create_table_statement: create_table_statement1 | create_table_statement2 | create_table_statement3 ; create_table_statement1: CREATE (TEMPORARY)? TABLE (IF NOT_SYM EXISTS)? TABLE_NAME LPAREN create_definition (COMMA create_definition)* RPAREN (table_options)? (partition_options)? (select_statement)? ; create_table_statement2: CREATE (TEMPORARY)? TABLE (IF NOT_SYM EXISTS)? TABLE_NAME (table_options)? (partition_options)? select_statement ; create_table_statement3: CREATE (TEMPORARY)? TABLE (IF NOT_SYM EXISTS)? TABLE_NAME ( (LIKE_SYM TABLE_NAME) | (LPAREN LIKE_SYM TABLE_NAME RPAREN) ) ; create_definition: ( COLUMN_NAME column_definition ) | ( (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? PRIMARY_SYM KEY_SYM (index_type)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (index_option)* ) | ( (INDEX_SYM|KEY_SYM) (INDEX_NAME)? (index_type)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (index_option)* ) | ( (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? UNIQUE_SYM (INDEX_SYM|KEY_SYM)? (INDEX_NAME)? (index_type)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (index_option)* ) | ( (FULLTEXT_SYM|SPATIAL_SYM) (INDEX_SYM|KEY_SYM)? (INDEX_NAME)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (index_option)* ) | ( (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? FOREIGN KEY_SYM (INDEX_NAME)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN reference_definition ) | ( CHECK_SYM LPAREN expression RPAREN ) ; column_definition: column_data_type_header (AUTO_INCREMENT)? ( (UNIQUE_SYM (KEY_SYM)?) | (PRIMARY_SYM (KEY_SYM)?) )? (COMMENT_SYM TEXT_STRING)? (COLUMN_FORMAT (FIXED_SYM|DYNAMIC_SYM|DEFAULT))? (reference_definition)? ; null_or_notnull: (NOT_SYM NULL_SYM) | NULL_SYM ; column_data_type_header: ( BIT_SYM(LPAREN length RPAREN)? (null_or_notnull)? (DEFAULT BIT_LITERAL)? ) | ( TINYINT(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( SMALLINT(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( MEDIUMINT(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( INT_SYM(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( INTEGER_SYM(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( BIGINT(LPAREN length RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( REAL(LPAREN length COMMA NUMBER_LITERAL RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( DOUBLE_SYM(LPAREN length COMMA NUMBER_LITERAL RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( FLOAT_SYM(LPAREN length COMMA NUMBER_LITERAL RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( DECIMAL_SYM(LPAREN length( COMMA NUMBER_LITERAL)? RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( NUMERIC_SYM(LPAREN length( COMMA NUMBER_LITERAL)? RPAREN)? (UNSIGNED_SYM)? (ZEROFILL)? (null_or_notnull)? (DEFAULT NUMBER_LITERAL)? ) | ( DATE_SYM (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( TIME_SYM (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( TIMESTAMP (null_or_notnull)? (DEFAULT (CURRENT_TIMESTAMP|TEXT_STRING))? ) | ( DATETIME (null_or_notnull)? (DEFAULT (CURRENT_TIMESTAMP|TEXT_STRING))? ) | ( YEAR (null_or_notnull)? (DEFAULT INTEGER_NUM)? ) | ( CHAR (LPAREN length RPAREN)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( VARCHAR LPAREN length RPAREN (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( BINARY (LPAREN length RPAREN)? (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( VARBINARY LPAREN length RPAREN (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( TINYBLOB (null_or_notnull)? ) | ( BLOB_SYM (null_or_notnull)? ) | ( MEDIUMBLOB (null_or_notnull)? ) | ( LONGBLOB (null_or_notnull)? ) | ( TINYTEXT (BINARY)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? ) | ( TEXT_SYM (BINARY)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? ) | ( MEDIUMTEXT (BINARY)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? ) | ( LONGTEXT (BINARY)? (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? ) | ( ENUM LPAREN TEXT_STRING (COMMA TEXT_STRING)* RPAREN (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? (DEFAULT TEXT_STRING)? ) | ( SET_SYM LPAREN TEXT_STRING (COMMA TEXT_STRING)* RPAREN (CHARACTER_SYM SET_SYM CHARSET_NAME)? (COLLATE_SYM COLLATION_NAME)? (null_or_notnull)? (DEFAULT TEXT_STRING)? ) //| ( spatial_type (null_or_notnull)? (DEFAULT default_value)? ) ; index_COLUMN_NAME: COLUMN_NAME (LPAREN INTEGER_NUM RPAREN)? (ASC | DESC)? ; reference_definition: REFERENCES TABLE_NAME LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN ( (MATCH FULL) | (MATCH PARTIAL) | (MATCH SIMPLE_SYM) )? (ON DELETE_SYM reference_option)? (ON UPDATE reference_option)? ; reference_option: (RESTRICT) | (CASCADE) | (SET_SYM NULL_SYM) | (NO_SYM ACTION) ; table_options: table_option (( COMMA )? table_option)* ; table_option: ( ENGINE_SYM (EQ_SYM)? ENGINE_NAME ) | ( AUTO_INCREMENT (EQ_SYM)? INTEGER_NUM ) | ( AVG_ROW_LENGTH (EQ_SYM)? INTEGER_NUM ) | ( (DEFAULT)? CHARACTER_SYM SET_SYM (EQ_SYM)? CHARSET_NAME ) | ( CHECKSUM_SYM (EQ_SYM)? INTEGER_NUM ) | ( (DEFAULT)? COLLATE_SYM (EQ_SYM)? COLLATION_NAME ) | ( COMMENT_SYM (EQ_SYM)? TEXT_STRING ) | ( CONNECTION_SYM (EQ_SYM)? TEXT_STRING ) | ( DATA_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING ) | ( DELAY_KEY_WRITE_SYM (EQ_SYM)? INTEGER_NUM ) | ( INDEX_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING ) | ( INSERT_METHOD (EQ_SYM)? ( NO_SYM | FIRST_SYM | LAST_SYM ) ) | ( KEY_BLOCK_SIZE (EQ_SYM)? INTEGER_NUM ) | ( MAX_ROWS (EQ_SYM)? INTEGER_NUM ) | ( MIN_ROWS (EQ_SYM)? INTEGER_NUM ) | ( PACK_KEYS_SYM (EQ_SYM)? (INTEGER_NUM | DEFAULT) ) | ( PASSWORD (EQ_SYM)? TEXT_STRING ) | ( ROW_FORMAT_SYM (EQ_SYM)? (DEFAULT|DYNAMIC_SYM|FIXED_SYM|COMPRESSED_SYM|REDUNDANT_SYM|COMPACT_SYM) ) | ( STATS_AUTO_RECALC (EQ_SYM)? (DEFAULT | INTEGER_NUM) ) | ( STATS_PERSISTENT (EQ_SYM)? (DEFAULT | INTEGER_NUM) ) | ( UNION_SYM (EQ_SYM)? LPAREN TABLE_NAME( COMMA TABLE_NAME)* RPAREN ) ; partition_options: PARTITION_SYM BY_SYM ( ( (LINEAR_SYM)? HASH_SYM LPAREN expression RPAREN ) | ( (LINEAR_SYM)? KEY_SYM LPAREN column_list RPAREN ) | ( RANGE_SYM(LPAREN expression RPAREN | COLUMNS_SYM LPAREN column_list RPAREN) ) | ( LIST_SYM(LPAREN expression RPAREN | COLUMNS_SYM LPAREN column_list RPAREN) ) ) (PARTITIONS_SYM INTEGER_NUM)? ( SUBPARTITION_SYM BY_SYM ( ( (LINEAR_SYM)? HASH_SYM LPAREN expression RPAREN ) | ( (LINEAR_SYM)? KEY_SYM LPAREN column_list RPAREN ) ) (SUBPARTITIONS_SYM INTEGER_NUM)? )? (LPAREN partition_definition ( COMMA partition_definition)* RPAREN)? ; partition_definition: PARTITION_SYM PARTITION_NAME ( VALUES ( (LESS_SYM THAN_SYM ( (LPAREN expression_list RPAREN) | MAXVALUE_SYM )) | (IN_SYM LPAREN expression_list RPAREN) ) )? ((STORAGE_SYM)? ENGINE_SYM (EQ_SYM)? ENGINE_NAME)? (COMMENT_SYM (EQ_SYM)? TEXT_STRING )? (DATA_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING)? (INDEX_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING)? (MAX_ROWS (EQ_SYM)? INTEGER_NUM)? (MIN_ROWS (EQ_SYM)? INTEGER_NUM)? (LPAREN subpartition_definition (COMMA subpartition_definition)* RPAREN)? ; subpartition_definition: SUBPARTITION_SYM PARTITION_LOGICAL_NAME ((STORAGE_SYM)? ENGINE_SYM (EQ_SYM)? ENGINE_NAME)? (COMMENT_SYM (EQ_SYM)? TEXT_STRING )? (DATA_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING)? (INDEX_SYM DIRECTORY_SYM (EQ_SYM)? TEXT_STRING)? (MAX_ROWS (EQ_SYM)? INTEGER_NUM)? (MIN_ROWS (EQ_SYM)? INTEGER_NUM)? ; length : INTEGER_NUM; // http://dev.mysql.com/doc/refman/5.6/en/alter-table.html alter_table_statement: ALTER (IGNORE_SYM)? TABLE TABLE_NAME ( alter_table_specification (COMMA alter_table_specification)* )? ( partition_options )? ; alter_table_specification: table_options | ( ADD_SYM (COLUMN_SYM)? COLUMN_NAME column_definition ( (FIRST_SYM|AFTER_SYM) COLUMN_NAME )? ) | ( ADD_SYM (COLUMN_SYM)? LPAREN column_definitions RPAREN ) | ( ADD_SYM (INDEX_SYM|KEY_SYM) (INDEX_NAME)? (index_type)? LPAREN index_COLUMN_NAMEs RPAREN (index_option)* ) | ( ADD_SYM (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? PRIMARY_SYM KEY_SYM (index_type)? LPAREN index_COLUMN_NAMEs RPAREN (index_option)* ) | ( ADD_SYM (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? UNIQUE_SYM (INDEX_SYM|KEY_SYM)? (INDEX_NAME)? (index_type)? LPAREN index_COLUMN_NAME (COMMA index_COLUMN_NAME)* RPAREN (index_option)* ) | ( ADD_SYM FULLTEXT_SYM (INDEX_SYM|KEY_SYM)? (INDEX_NAME)? LPAREN index_COLUMN_NAMEs RPAREN (index_option)* ) | ( ADD_SYM SPATIAL_SYM (INDEX_SYM|KEY_SYM)? (INDEX_NAME)? LPAREN index_COLUMN_NAMEs RPAREN (index_option)* ) | ( ADD_SYM (CONSTRAINT (CONSTRAINT_SYMBOL_NAME)?)? FOREIGN KEY_SYM (INDEX_NAME)? LPAREN index_COLUMN_NAMEs RPAREN reference_definition ) | ( ALGORITHM_SYM (EQ_SYM)? (DEFAULT|INPLACE_SYM|COPY_SYM) ) | ( ALTER (COLUMN_SYM)? COLUMN_NAME ((SET_SYM DEFAULT LITERAL_VALUE) | (DROP DEFAULT)) ) | ( CHANGE (COLUMN_SYM)? COLUMN_NAME COLUMN_NAME column_definition (FIRST_SYM|AFTER_SYM COLUMN_NAME)? ) | ( LOCK (EQ_SYM)? (DEFAULT|NONE_SYM|SHARED_SYM|EXCLUSIVE_SYM) ) | ( MODIFY_SYM (COLUMN_SYM)? COLUMN_NAME column_definition (FIRST_SYM | AFTER_SYM COLUMN_NAME)? ) | ( DROP (COLUMN_SYM)? COLUMN_NAME ) | ( DROP PRIMARY_SYM KEY_SYM ) | ( DROP (INDEX_SYM|KEY_SYM) INDEX_NAME ) | ( DROP FOREIGN KEY_SYM FOREIGN_KEY_SYMBOL_NAME ) | ( DISABLE_SYM KEYS ) | ( ENABLE_SYM KEYS ) | ( RENAME (TO_SYM|AS_SYM)? TABLE_NAME ) | ( ORDER_SYM BY_SYM COLUMN_NAME (COMMA COLUMN_NAME)* ) | ( CONVERT_SYM TO_SYM CHARACTER_SYM SET_SYM CHARSET_NAME (COLLATE_SYM COLLATION_NAME)? ) | ( (DEFAULT)? CHARACTER_SYM SET_SYM (EQ_SYM)? CHARSET_NAME (COLLATE_SYM (EQ_SYM)? COLLATION_NAME)? ) | ( DISCARD TABLESPACE ) | ( IMPORT TABLESPACE ) | ( FORCE_SYM ) | ( ADD_SYM PARTITION_SYM LPAREN partition_definition RPAREN ) | ( DROP PARTITION_SYM partition_names ) | ( TRUNCATE PARTITION_SYM (partition_names | ALL) ) | ( COALESCE PARTITION_SYM INTEGER_NUM ) | ( REORGANIZE_SYM PARTITION_SYM partition_names INTO LPAREN partition_definition (COMMA partition_definition)* RPAREN ) | ( EXCHANGE_SYM PARTITION_SYM PARTITION_NAME WITH TABLE TABLE_NAME ) | ( ANALYZE_SYM PARTITION_SYM (partition_names | ALL) ) | ( CHECK_SYM PARTITION_SYM (partition_names | ALL) ) | ( OPTIMIZE PARTITION_SYM (partition_names | ALL) ) | ( REBUILD_SYM PARTITION_SYM (partition_names | ALL) ) | ( REPAIR PARTITION_SYM (partition_names | ALL) ) | ( REMOVE_SYM PARTITIONING_SYM ) ; index_COLUMN_NAMEs: index_COLUMN_NAME (COMMA index_COLUMN_NAME)*; index_type: USING_SYM (BTREE_SYM | HASH_SYM) ; index_option: ( KEY_BLOCK_SIZE (EQ_SYM)? INTEGER_NUM ) | index_type | ( WITH PARSER_SYM PARSER_NAME ) | ( COMMENT_SYM TEXT_STRING ) ; column_definitions: COLUMN_NAME column_definition (COMMA COLUMN_NAME column_definition)* ; // http://dev.mysql.com/doc/refman/5.6/en/rename-table.html rename_table_statement: RENAME TABLE TABLE_NAME TO_SYM TABLE_NAME (COMMA TABLE_NAME TO_SYM TABLE_NAME)* ; // http://dev.mysql.com/doc/refman/5.6/en/drop-table.html drop_table_statement: DROP (TEMPORARY)? TABLE (IF EXISTS)? TABLE_NAME (COMMA TABLE_NAME)* (RESTRICT | CASCADE)? ; // http://dev.mysql.com/doc/refman/5.6/en/truncate-table.html truncate_table_statement: TRUNCATE (TABLE)? TABLE_NAME ; /* // http://dev.mysql.com/doc/refman/5.6/en/create-trigger.html create_trigger_statement: CREATE (DEFINER EQ_SYM (USER_NAME | CURRENT_USER))? // ... ; // http://dev.mysql.com/doc/refman/5.6/en/drop-trigger.html drop_trigger_statement: ; */ // http://dev.mysql.com/doc/refman/5.6/en/create-view.html create_view_statement: CREATE (OR_SYM REPLACE)? create_view_body ; create_view_body: (ALGORITHM_SYM EQ_SYM (UNDEFINED_SYM | MERGE_SYM | TEMPTABLE_SYM))? (DEFINER EQ_SYM (USER_NAME | CURRENT_USER) )? (SQL_SYM SECURITY_SYM ( DEFINER | INVOKER_SYM ))? VIEW_SYM VIEW_NAME (LPAREN column_list RPAREN)? AS_SYM select_statement (WITH (CASCADED | LOCAL_SYM)? CHECK_SYM OPTION)? ; // http://dev.mysql.com/doc/refman/5.6/en/alter-view.html alter_view_statement: ALTER create_view_body ; // http://dev.mysql.com/doc/refman/5.6/en/drop-view.html drop_view_statement: DROP VIEW_SYM (IF EXISTS)? VIEW_NAME (COMMA VIEW_NAME)* (RESTRICT | CASCADE)? ;
Packaging/DS_Store.scpt
ValentinCamus/SparkEngine
0
197
<reponame>ValentinCamus/SparkEngine on run argv -- Constants set X_POS to 400 set Y_POS to 100 set BG_W to 650 set BG_H to 400 set TITLE_BAR_H to 15 set diskImage to item 1 of argv tell application "Finder" tell disk diskImage -- Setup background and icon arrangement open set current view of container window to icon view set theViewOptions to the icon view options of container window -- set background picture of theViewOptions to file ".background:dmg_background.png" set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 72 delay 5 close -- Setup window decoration and icon positions open update without registering applications tell container window set sidebar width to 0 set statusbar visible to false set toolbar visible to false set the bounds to {X_POS, Y_POS, X_POS + BG_W, Y_POS + BG_H + TITLE_BAR_H} -- Move the icons; this is really finicky, the coordinates don't seem -- to make much sense and if you go too far then ugly scrollbars will appear set position of item "SparkEngine.app" to {230, 115} set position of item "Applications" to {530, 115} -- Move these out of the way for users with Finder configured to show all files set position of item ".background" to {161, 500} set position of item ".fseventsd" to {332, 500} end tell update without registering applications delay 5 close -- Show window one more time for a final check open delay 5 close end tell delay 1 end tell end run
source/jni/u2/visu/adata.asm
Falken42/SecondReality
9
176257
<filename>source/jni/u2/visu/adata.asm ;/**************************************************************************** ;** MODULE: adata.asm ;** AUTHOR: <NAME> / Fennosoftec OY ;** DOCUMENT: ? ;** VERSION: 1.0 ;** REFERENCE: - ;** REVISED BY: - ;***************************************************************************** ;** ;** Assembler / Data ;** ;****************************************************************************/ include a.inc asm_data SEGMENT para public use16 'DATA' _datanull dd 12345678h ;offsets to rows in vram _rows LABEL WORD dw MAXROWS dup(0) _rowlen dw 0 _cdataseg dw 0 ;segment to video memory _vramseg dw 0 ALIGN 4 ;projection clip window _projclipx dd 0,319 ;(xmin,xmax) _projclipy dd 0,199 ;(ymin,ymax) _projclipz dd 256,1000000000 ;(zmin,zmax) ;projection variables _projmulx dd 250 _projmuly dd 220 _projaddx dd 160 _projaddy dd 100 _projaspect dw 256 ;aspect ratio (ratio=256*ypitch/xpitch) _projoversampleshr dw 0 ;video driver routine pointers vr LABEL WORD dw VRSIZE dup(0) _polydrw LABEL WORD dw 1024 dup(0) _sintable LABEL WORD include adatasin.inc _avistan LABEL WORD include avistan.inc _afilldiv LABEL WORD include afilldiv.inc asm_data ENDS END
agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-00-internal-verification.agda
haroldcarr/learn-haskell-coq-ml-etc
36
16234
<filename>agda/book/2015-Verified_Functional_programming_in_Agda-Stump/ial/z05-00-internal-verification.agda module z05-00-internal-verification where open import bool open import eq open import nat open import nat-thms open import product open import sum {- ------------------------------------------------------------------------------ so far: EXTERNAL VERIFICATION - written programs (e.g., 'length') - proved properties (e.g., 'length-reverse') This style of verification in type theory is called external verification - proofs are external to programs - proofs are distinct artifacts about some pre-existing programs INTERNAL VERIFICATION write functions with semantically expressive types write datatypes that put restrictions on data may require embedding proofs in code ------------------------------------------------------------------------------ -- p 99 VECTORS - length of vector included in type : vector is INDEXED by its length -- vector.agda -} data 𝕍 {ℓ} (A : Set ℓ) : ℕ → Set ℓ where [] : 𝕍 A 0 _::_ : {n : ℕ} (x : A) (xs : 𝕍 A n) → 𝕍 A (suc n) -- compare to list (overloaded constructors OK) data L {ℓ} (A : Set ℓ) : Set ℓ where [] : L A _::_ : (x : A) (xs : L A) → L A infixr 6 _::_ _++𝕍_ -- p 101 [_]𝕍 : ∀ {ℓ} {A : Set ℓ} → A → 𝕍 A 1 [ x ]𝕍 = x :: [] -- type level addition on length _++𝕍_ : ∀ {ℓ} {A : Set ℓ}{n m : ℕ} → 𝕍 A n → 𝕍 A m → 𝕍 A (n + m) [] ++𝕍 ys = ys (x :: xs) ++𝕍 ys = x :: xs ++𝕍 ys -- p 102 -- no 'nil' list corner case head𝕍 : ∀ {ℓ} {A : Set ℓ} {n : ℕ} → 𝕍 A (suc n) → A head𝕍 (x :: _) = x -- type level subtraction tail𝕍 : ∀ {ℓ} {A : Set ℓ} {n : ℕ} → 𝕍 A n → 𝕍 A (pred n) tail𝕍 [] = [] tail𝕍 (_ :: xs) = xs -- p 103 -- length preserving (for lists, length preservation is separate proof) map𝕍 : ∀ {ℓ ℓ'} {A : Set ℓ} {B : Set ℓ'} {n : ℕ} → (A → B) → 𝕍 A n → 𝕍 B n map𝕍 f [] = [] map𝕍 f (x :: xs) = f x :: map𝕍 f xs -- p 104 -- takes a vector of length m -- each element is vector of length n -- concats into single vector of length m * n concat𝕍 : ∀{ℓ} {A : Set ℓ} {n m : ℕ} → 𝕍 (𝕍 A n) m → 𝕍 A (m * n) concat𝕍 [] = [] concat𝕍 (x :: xs) = x ++𝕍 (concat𝕍 xs) -- p 104 -- no need for maybe result as in lists by requiring n < m nth𝕍 : ∀ {ℓ} {A : Set ℓ} {m : ℕ} → (n : ℕ) → n < m ≡ tt → 𝕍 A m → A nth𝕍 0 _ (x :: _) = x -- Proof p (that index is less than length of vector) reused in recursive call. -- index is suc n -- length of list is suc m, for implicit m -- Agda implicitly introduces .m with suc .m -- p proves suc n < suc m ≡ tt -- def/eq to n < m ≡ tt -- so p has correct type to make the recursive call nth𝕍 (suc n) p (_ :: xs) = nth𝕍 n p xs -- us absurd pattern for the proof in last two cases -- length of list is zero, so no index can be smaller than that length -- must case-split on the index so Agda can the absurdity -- because the definition of _<_ splits on both inputs -- - returns ff separately for when the first input is is 0 and the second is 0 -- - and for the first input being suc n and second is 0 nth𝕍 (suc n) () [] nth𝕍 0 () [] -- p 105 repeat𝕍 : ∀ {ℓ} {A : Set ℓ} → (a : A) (n : ℕ) → 𝕍 A n repeat𝕍 a 0 = [] repeat𝕍 a (suc n) = a :: (repeat𝕍 a n) {- ------------------------------------------------------------------------------ -- p 106 BRAUN TREES : balanced binary heaps either empty or node consisting of some data x and a left and a right subtree data may be stored so that x is smaller than all data in left and right subtrees if such an ordering property is desired BRAUN TREE PROPERTY (BTP) : crucial property : sizes of left and right trees: for each node in the tree - either size (left) = size ( right ) or size (left) = size ( right ) + 1 ensures depth of the trees is ≤ log₂(N), where N is the number of nodes property maintained (via types) during insert make the type A and ordering on that type be parameters of the module braun-tree.adga -} module braun-tree {ℓ} (A : Set ℓ) (_<A_ : A → A → 𝔹) where -- index n is size (number of elements of type A) of the tree data braun-tree : (n : ℕ) → Set ℓ where bt-empty : braun-tree 0 bt-node : ∀ {n m : ℕ} → A → braun-tree n → braun-tree m → n ≡ m ∨ n ≡ suc m -- 'v' defined in sum.agda for disjunction of two types → braun-tree (suc (n + m)) {- -- p 107 sum.agda -- types A and B, possibly at different levels, accounted via ⊔ in return type -- ⊔ part of Agda’s primitive level system : imported from Agda.Primitive module in level.agda -- use this in code that intended to be run data _⊎_ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') : Set (ℓ ⊔ ℓ') where inj₁ : (x : A) → A ⊎ B -- built from an A inj₂ : (y : B) → A ⊎ B -- built from an B -- use this to represent a logical proposition _∨_ : ∀ {ℓ ℓ'} (A : Set ℓ) (B : Set ℓ') → Set (ℓ ⊔ ℓ') _∨_ = _⊎_ NO SEMANTIC DIFFERENCE - just different notation to help understanding code -} {- -------------------------------------------------- -- p 107-108 INSERTION -- this version keeps smaller (_<A_) elements closer to root when inserting -} -- type says given BT of size n, returns BT of size suc n bt-insert : ∀ {n : ℕ} → A → braun-tree n → braun-tree (suc n) -- insert into empty -- Create node with element and empty subtrees (both with size 0). -- 4th arg to BT constructor is BTP proof -- - both 0 so 'refl' -- - wrap in inj₁ to say 0 ≡ 0 (not n ≡ suc n) bt-insert a bt-empty = bt-node a bt-empty bt-empty (inj₁ refl) -- insert info non empty: tree has left and right satisfying BTP -- left of size n; right of size m -- p is BTP proof -- inferred type of return is BT (suc (suc (n + m))) -- because type before insert is BT (suc (n + m)) - left plus node element plus right -- insert adds ONE, so BT (suc (suc (m + n))) bt-insert a (bt-node{n}{m} a' l r p) -- regardless of what happens, left and right will be swapped, so size sum will have m first -- do rewrite before case splitting on which disjunct of BTP holds (n ≡ m or n ≡ suc m) -- does not change structure of tree -- will change what proof is used for BTP for new node returned. -- case split via WITH on P -- could split on p directly in pattern for input BT, -- but here rewrite is factored to be done once -- could do WITH on an if_then_else_ term, to put the min of element being inserted (a) -- and element at current root (a') as 1st component pair (a1), max as 2nd (a2) -- want min (a1) to be data at root of new BT -- want to insert max (a2) recursively into right rewrite +comm n m with p | if a <A a' then (a , a') else (a' , a) -- inj₁ case -- case where p is inj₁ for NEW new pattern variable 'p' -- underscore in place of original proof/p -- because considering case where original is 'inj₁ p' -- p : n ≡ m -- so new node -- with smaller element a1 at root and then swapped left and update right -- has type 'inj₂ refl' -- BTP for new node is suc m ≡ n v suc m ≡ suc n -- because size of new left is suc m, since it is the updated version of old right -- case has proof n ≡ m -- rewrite with that proof changes that to suc m ≡ suc n -- 'inj 2 refl' proves it bt-insert a (bt-node{n}{m} a' l r _) | inj₁ p | (a1 , a2) rewrite p = (bt-node a1 (bt-insert a2 r) l (inj₂ refl)) -- inj₂ case : n ≡ suc m -- so need proof suc m ≡ n v suc m ≡ suc n -- 'sym p' gives 'suc m ≡ n' -- wrap in 'inj₁' bt-insert a (bt-node{n}{m} a' l r _) | inj₂ p | (a1 , a2) = (bt-node a1 (bt-insert a2 r) l (inj₁ (sym p))) {- -------------------------------------------------- -- p 110 REMOVE MIN ELEMENT -} -- input has at least one element; returns pair of element and a BT one smaller bt-remove-min : ∀ {p : ℕ} → braun-tree (suc p) → A × braun-tree p -- no need for case of empty input -- because size would be 0, but input is 'suc p' -- removing sole node; return data and bt-empty bt-remove-min (bt-node a bt-empty bt-empty u) = a , bt-empty -- next two equations for left is empty and right subtree is a node -- IMPOSSIBLE by BTP -- still need to handle both proves with absurd bt-remove-min (bt-node a bt-empty (bt-node _ _ _ _) (inj₁ ())) bt-remove-min (bt-node a bt-empty (bt-node _ _ _ _) (inj₂ ())) -- right empty, left node (implies left size is 1, but not needed) -- return data left -- need to confirm size relationships satisfied, because -- size of input is suc (suc (n’ + m’) + 0) -- size of output is suc (n’ + m’) -- use +0 to drop the '+ 0' bt-remove-min (bt-node a (bt-node{n’}{m’} a’ l’ r’ u’) bt-empty u) rewrite +0 (n’ + m’) = a , bt-node a’ l’ r’ u’ -- left and right of input both nodes (not empty) -- return data input (the min data) -- reassemble output BT: remove min from left: bt-remove-min (bt-node a (bt-node a1 l1 r1 u1) (bt-node a2 l2 r2 u2) u) with bt-remove-min (bt-node a1 l1 r1 u1) -- then match on result of recursive call to bt-remove-min. -- produces min a1’ of left and updated left l’ -- then WITH to pick smaller of a1’ (minimum of left) and a2, minimum of right -- similar to the bt-insert with an if_then_else_ term. bt-remove-min (bt-node a (bt-node a1 l1 r1 u1) (bt-node a2 l2 r2 u2) u) | a1’ , l’ with if a1’ <A a2 then (a1’ , a2) else (a2 , a1’) -- p 113 first words TODO bt-remove-min (bt-node a (bt-node{n1}{m1} a1 l1 r1 u1) (bt-node{n2}{m2} _ l2 r2 u2) u) | _ , l’ | smaller , other rewrite +suc (n1 + m1) (n2 + m2) | +comm (n1 + m1) (n2 + m2) = a , bt-node smaller (bt-node other l2 r2 u2) l’ (lem u) where lem : ∀ {x y} → suc x ≡ y ∨ suc x ≡ suc y → y ≡ x ∨ y ≡ suc x lem (inj₁ p) = inj₂ (sym p) lem (inj₂ p) = inj₁ (sym (suc-inj p)) {- ------------------------------------------------------------------------------ -- p 114 Sigma Types Above expresses invariant properties of data using internally verified datatypes. Any data constructed via the constructors are guaranteed to satisfy the property, due to restrictions enforced by the constructors. Different case: state that a property holds of an existing data type. done using Σ-types (“sigma”) similar to Cartesian product type A × B (elements of A × B are pairs (a, b)) - but generalization where type of 2nd element can depend on type of 1st - aka "dependent product type" (though the notation comes from sum types, see below) see nat-nonzero.agda : type for nonzero natural numbers: -- a nat 'n' AND a proof 'iszero n ≡ ff' ℕ⁺ : Set ℕ⁺ = Σ ℕ (λ n → iszero n ≡ ff) conceptually similar to Cartesian product : N × (iszero n ≡ ff) - pair of number and equality proof - in Cartesian product version, 'n' is free - Σ-types enable referring to 1st of pair see product.agda : def of Σ parametrized by - type A - function B - input : type A - returns a type - types can be at different levels - Like sum types, Σ type is then at level ℓ ⊔ ℓ' (least upper bound of the two levels) data Σ {ℓ ℓ'} (A : Set ℓ) (B : A → Set ℓ') : Set (ℓ ⊔ ℓ') where _,_ : (a : A) → (b : B a) → Σ A B ^ B depends on ------------------------------------------------------------------------------ -- p 115 example: addition on nonzero nats -} open import nat-nonzero hiding (_+⁺_) _+⁺_ : ℕ⁺ → ℕ⁺ → ℕ⁺ (zero , ()) +⁺ n2 -- cannot happen, so uses absurd pattern (1 , p1) +⁺ y = suc⁺ y (suc (suc n1) , p1) +⁺ y = suc⁺ ((suc n1 , refl) +⁺ y) -- recursive call {- -- p 115 5.3.1 Why Sigma and Pi? why Σ symbol for type of dependent pairs? - because Σ-types generalize disjoint unions - in math, a disjoint union is union of two sets - where elements are tagged to indicate from which set they have come - cardinality of A ⊎ B, is sum of cardinalities of A and B even if they have a nonempty intersection. - This is where we get the notation for sum types in Figure 5.2. - The disjoint union can be defined mathematically as ({0} × A) ∪ ({1} × B) - each element of union looks like (n, x) where if the tag n is 0, then x P A, and if n is 1, then x P B. ------------------------------------------------------------------------------ -- p 116 Binary Search Trees for some type A and an ordering relation on that type values in left subtree always ≤ value at node ℕ values in right subtree always > value at node ℕ see z05-01-bst-test.agda z05-01-bst.agda -- p 117-120 TODO : read/understand discussion of bool-relations.agda relations.agda ------------------------------------------------------------------------------ -- p 123 Internal vs. External Verification internal verification : datatypes defined with invariants; functions take proofs of preconditions - Datatypes with essential invariants : enforce via internal - Complex programs - doing external of complex will cause reasoning about complexity not relevant to property being proved - internal weaves proofs thru code and datatype external verification : theorems about functions proved separately - Algebraic Properties e.g., proving associativity - Functions used in an internal verification's specification -- e.g., min/max used in bst - need to externally prove properties about min/max ------------------------------------------------------------------------------ -- p 126 Exercises 1. Nested vector type. Fill in the hole to define a type for matrices of nats where the type lists the dimensions of the matrix: -} -- inner vector is a row _by_matrix : ℕ → ℕ → Set rows by cols matrix = 𝕍 (𝕍 ℕ cols) rows matrix-to-vec-vec : ∀ {rows cols : ℕ} → rows by cols matrix → 𝕍 (𝕍 ℕ cols) rows matrix-to-vec-vec 𝕞 = 𝕞 -- 2a zero-matrix : (rows cols : ℕ) → rows by cols matrix zero-matrix rows cols = repeat𝕍 (repeat𝕍 0 cols) rows _ : zero-matrix 2 3 ≡ (0 :: 0 :: 0 :: []) :: (0 :: 0 :: 0 :: []) :: [] _ = refl _ : zero-matrix 0 0 ≡ [] _ = refl _ : zero-matrix 0 1 ≡ [] _ = refl _ : zero-matrix 1 0 ≡ [] :: [] _ = refl _ : zero-matrix 1 1 ≡ (0 :: []) :: [] _ = refl -- 2b matrix-elt : ∀ {rows cols : ℕ} → rows by cols matrix → (r : ℕ) → (c : ℕ) → r < rows ≡ tt → c < cols ≡ tt → ℕ matrix-elt 𝕞 r c r<rows c<cols = nth𝕍 c c<cols (nth𝕍 r r<rows (matrix-to-vec-vec 𝕞)) -- 2c diagonal-matrix : ℕ → (n : ℕ) → n by n matrix diagonal-matrix d n = mkRows n n n where -- when constructing rows/cols -- - row/col param corresponds to row/col - rows/cols -- - e.g., for 2 x 3 matrix -- row param 2 corresponds 2 - 2 = 0 mkElt : ℕ → ℕ → ℕ mkElt i col = if i =ℕ col then d else zero mkCols : (ℕ → ℕ) → (cols : ℕ) → 𝕍 ℕ cols mkCols _ zero = [] mkCols f sc@(suc c) = f sc :: mkCols f c mkRows : ℕ → (rows : ℕ) → (cols : ℕ) → 𝕍 (𝕍 ℕ cols) rows mkRows _ zero _ = [] mkRows i (suc r) c = mkCols (mkElt i) c :: mkRows (i ∸ 1) r c identity-matrix : (n : ℕ) → n by n matrix identity-matrix = diagonal-matrix 1 idm5 : 5 by 5 matrix idm5 = identity-matrix 5 _ : idm5 ≡ (1 :: 0 :: 0 :: 0 :: 0 :: []) :: (0 :: 1 :: 0 :: 0 :: 0 :: []) :: (0 :: 0 :: 1 :: 0 :: 0 :: []) :: (0 :: 0 :: 0 :: 1 :: 0 :: []) :: (0 :: 0 :: 0 :: 0 :: 1 :: []) :: [] _ = refl _ : matrix-elt idm5 0 0 refl refl ≡ 1 _ = refl _ : matrix-elt idm5 1 1 refl refl ≡ 1 _ = refl _ : matrix-elt idm5 0 1 refl refl ≡ 0 _ = refl -- 2d -- BEGIN https://typeslogicscats.gitlab.io/posts/agda-matrix.lagda.html prepend-column : ∀ {m n : ℕ} → 𝕍 ℕ n -- a column → n by m matrix → n by suc m matrix -- prepends the given column to the matrix prepend-column [] [] = [] prepend-column (x :: xs) (vec :: vecs) = (x :: vec) :: (prepend-column xs vecs) -- inverse of prepend-column (NOT USED) unprepend-column : ∀ {m n : ℕ} → n by suc m matrix → (𝕍 ℕ n) × (n by m matrix) unprepend-column [] = ([] , []) unprepend-column ((x :: vec) :: matrix) = let xs-vecs = unprepend-column matrix in x :: fst xs-vecs , vec :: snd xs-vecs fill-empty : (n : ℕ) → n by 0 matrix fill-empty 0 = [] fill-empty (suc n) = [] :: fill-empty n transpose : ∀ {i : ℕ} {j : ℕ} → i by j matrix → j by i matrix transpose {0} {j} [] = fill-empty j transpose {suc _} {_} (row :: rows) = prepend-column row (transpose rows) -- END https://typeslogicscats.gitlab.io/posts/agda-matrix.lagda.html ex2x3 : 2 by 3 matrix ex2x3 = (1 :: 2 :: 3 :: []) :: (0 :: 6 :: 7 :: []) :: [] _ : transpose ex2x3 ≡ (1 :: 0 :: []) :: (2 :: 6 :: []) :: (3 :: 7 :: []) :: [] _ = refl -- BEGIN https://www.cs.nott.ac.uk/~psztxa/g53cfr/solutions/ex02.agda vreturn : {A : Set} {n : ℕ} → A → 𝕍 A n vreturn {n = zero} a = [] vreturn {n = suc m} a = a :: vreturn {n = m} a vapp : {A B : Set} {n : ℕ} → 𝕍 (A → B) n → 𝕍 A n → 𝕍 B n vapp [] [] = [] vapp (f :: fs) (a :: as) = f a :: vapp fs as transposeX : {m n : ℕ} → m by n matrix → n by m matrix transposeX [] = vreturn [] transposeX (as :: ass) = vapp (vapp (vreturn _::_ ) as) (transposeX ass) _ : transposeX ex2x3 ≡ (1 :: 0 :: []) :: (2 :: 6 :: []) :: (3 :: 7 :: []) :: [] _ = refl -- END https://www.cs.nott.ac.uk/~psztxa/g53cfr/solutions/ex02.agda -- BEGIN HORRIBLE HACKY TRY postulate yyy : (n : ℕ) → (rc : ℕ) → rc < n ≡ tt xx : ∀ {x y : ℕ} → x =ℕ 0 ≡ ff → y =ℕ 0 ≡ ff → x ∸ y < x ≡ tt xx {x} {suc y} x≠0 y≠0 rewrite ∸< {x} {y} x≠0 = refl transpose' : ∀ {n m : ℕ} → n by m matrix → m by n matrix transpose' {0} {m} _ = zero-matrix m 0 transpose' {1} {m} _ = zero-matrix m 1 transpose' n@{suc (suc _)} {zero} 𝕞 = zero-matrix zero n transpose' n@{suc (suc _)} m@{suc _} 𝕞 = mkRows m n where mkElt : (newRow : ℕ) → newRow =ℕ 0 ≡ ff → (newCol : ℕ) → newCol =ℕ 0 ≡ ff → ℕ mkElt newRow rp newCol cp = matrix-elt 𝕞 (n ∸ newCol) (m ∸ newRow) -- (xx cp refl) (xx rp refl) -- (yyy (n ∸ newCol) n) (yyy (m ∸ newRow) m) {!!} {!!} mkCols : (∀ (new : ℕ) → new =ℕ 0 ≡ ff → ℕ) → (cols : ℕ) → 𝕍 ℕ cols mkCols _ zero = [] mkCols f sc@(suc c) = f sc refl :: mkCols f c mkRows : (rows : ℕ) → (cols : ℕ) → 𝕍 (𝕍 ℕ cols) rows mkRows zero _ = [] mkRows sr@(suc r) c = mkCols (mkElt sr refl) c :: mkRows r c _ : transpose' ex2x3 ≡ (1 :: 0 :: []) :: (2 :: 6 :: []) :: (3 :: 7 :: []) :: [] _ = refl -- END HORRIBLE HACKY TRY -- 2e dotProduct𝕍 : ∀ {n : ℕ} → 𝕍 ℕ n → 𝕍 ℕ n → ℕ dotProduct𝕍 [] [] = 0 dotProduct𝕍 (a :: as) (b :: bs) = a * b + (dotProduct𝕍 as bs) _ : dotProduct𝕍 (1 :: 3 :: 5 :: []) (4 :: 2 :: 1 :: []) ≡ 15 _ = refl foldr : ∀ {A B : Set} {n : ℕ} → (A → B → B) → B → 𝕍 A n → B foldr f z [] = z foldr f z (x :: xs) = f x (foldr f z xs) zipWith : ∀ {A B C : Set} {n : ℕ} → (A → B → C) → 𝕍 A n → 𝕍 B n → 𝕍 C n zipWith _ [] [] = [] zipWith f (x :: xs) (y :: ys) = f x y :: zipWith f xs ys dotProduct𝕍' : ∀ {n : ℕ} → 𝕍 ℕ n → 𝕍 ℕ n → ℕ dotProduct𝕍' as bs = foldr _+_ 0 (zipWith _*_ as bs) _ : dotProduct𝕍' (1 :: 3 :: 5 :: []) (4 :: 2 :: 1 :: []) ≡ 15 _ = refl -- 2f matrix-* : ∀ {m n p : ℕ} → m by n matrix → n by p matrix → m by p matrix matrix-* [] _ = [] matrix-* {m} {n} {p} (a :: as) bs = doRow {n} {p} a (transpose bs) :: matrix-* as bs where doRow : ∀ {n p : ℕ} → 𝕍 ℕ n → p by n matrix → 𝕍 ℕ p doRow a [] = [] doRow {n} {p} a (b :: bs) = dotProduct𝕍 a b :: doRow a bs ma : 2 by 3 matrix ma = (2 :: 3 :: 4 :: []) :: (1 :: 0 :: 0 :: []) :: [] mb : 3 by 2 matrix mb = (0 :: 1000 :: []) :: (1 :: 100 :: []) :: (0 :: 10 :: []) :: [] _ : matrix-* ma mb ≡ (3 :: 2340 :: []) :: (0 :: 1000 :: []) :: [] _ = refl identity-2 : 2 by 2 matrix identity-2 = identity-matrix 2 some-mat : 2 by 2 matrix some-mat = (1 :: 2 :: []) :: (3 :: 4 :: []) :: [] some-mat-trans : 2 by 2 matrix some-mat-trans = (1 :: 3 :: []) :: (2 :: 4 :: []) :: [] _ : matrix-* some-mat identity-2 ≡ some-mat _ = refl _ : transpose some-mat ≡ some-mat-trans _ = refl left-mat : 2 by 3 matrix left-mat = (1 :: 2 :: 3 :: []) :: (4 :: 5 :: 6 :: []) :: [] right-mat : 3 by 2 matrix right-mat = ( 7 :: 8 :: []) :: ( 9 :: 10 :: []) :: (11 :: 12 :: []) :: [] product : 2 by 2 matrix product = ( 58 :: 64 :: []) :: (139 :: 154 :: []) :: [] _ : matrix-* left-mat right-mat ≡ product _ = refl -- TODO https://www.cs.nott.ac.uk/~psztxa/g53cfr/solutions/ex02.agda -- 3 -- from list.agda data 𝕃 {ℓ} (A : Set ℓ) : Set ℓ where [] : 𝕃 A _::_ : (x : A) (xs : 𝕃 A) → 𝕃 A -- from vector.agda 𝕍-to-𝕃 : ∀ {ℓ} {A : Set ℓ} {n : ℕ} → 𝕍 A n → 𝕃 A 𝕍-to-𝕃 [] = [] 𝕍-to-𝕃 (x :: xs) = x :: (𝕍-to-𝕃 xs) 𝕃-to-𝕍 : ∀ {ℓ} {A : Set ℓ} → 𝕃 A → Σ ℕ (λ n → 𝕍 A n) 𝕃-to-𝕍 [] = (0 , []) 𝕃-to-𝕍 (x :: xs) with 𝕃-to-𝕍 xs ... | (n , v) = (suc n , x :: v) e3 : ∀ {ℓ} {A : Set ℓ} {n : ℕ} → (v : 𝕍 A n) → 𝕃-to-𝕍 (𝕍-to-𝕃 v) ≡ n , v e3 [] = refl e3 (x :: v) with e3 v ... | zz rewrite zz = refl -- 4. fun takes V (A × B) n ; returns pair V A n and V B n -- similar to Haskell unzip unzip : ∀ {ℓ} {A B : Set ℓ} {n : ℕ} → 𝕍 (A × B) n → 𝕍 A n × 𝕍 B n unzip [] = [] , [] unzip ((a , b) :: v) = let rest = unzip v in a :: fst rest , b :: snd rest _ : unzip ((1 , 10) :: (2 , 20) :: (3 , 30) :: []) ≡ ( 1 :: 2 :: 3 :: []) , (10 :: 20 :: 30 :: []) _ = refl {- TODO -- 5. Implement remove-min / remove-max functions for bst. type. Using remove-min, define a general remove function - finds first value isomorphic to given one - returns bst without that value. If node holding that value has two (non-leaf) nodes as left and right sub-trees, then necessary to replace the removed element with its successor. This is the minimum value in the right subtree. -- 6. In list-merge-sort.agda : merge-sort using Braun trees. State and prove theorems about merge-sort. E.g., prove length of input list and length of returned sorted list are the same. -}
Source/Levels/L0315.asm
AbePralle/FGB
0
4804
<gh_stars>0 ; L0315.asm ; Generated 07.30.2000 by mlevel ; Modified 07.30.2000 by <NAME> INCLUDE "Source/Defs.inc" INCLUDE "Source/Levels.inc" ;--------------------------------------------------------------------- SECTION "Level0315Section",ROMX ;--------------------------------------------------------------------- L0315_Contents:: DW L0315_Load DW L0315_Init DW L0315_Check DW L0315_Map ;--------------------------------------------------------------------- ; Load ;--------------------------------------------------------------------- L0315_Load: DW ((L0315_LoadFinished - L0315_Load2)) ;size L0315_Load2: call ParseMap ret L0315_LoadFinished: ;--------------------------------------------------------------------- ; Map ;--------------------------------------------------------------------- L0315_Map: INCBIN "Data/Levels/L0315_intro_bs4.lvl" ;--------------------------------------------------------------------- ; Init ;--------------------------------------------------------------------- L0315_Init: DW ((L0315_InitFinished - L0315_Init2)) ;size L0315_Init2: ret L0315_InitFinished: ;--------------------------------------------------------------------- ; Check ;--------------------------------------------------------------------- L0315_Check: DW ((L0315_CheckFinished - L0315_Check2)) ;size L0315_Check2: ret L0315_CheckFinished: PRINT "0315 Script Sizes (Load/Init/Check) (of $500): " PRINT (L0315_LoadFinished - L0315_Load2) PRINT " / " PRINT (L0315_InitFinished - L0315_Init2) PRINT " / " PRINT (L0315_CheckFinished - L0315_Check2) PRINT "\n"
model-sets/2021-05-06-10-28-11-watform/ctlfc.als
WatForm/catalyst
0
3905
<filename>model-sets/2021-05-06-10-28-11-watform/ctlfc.als /* * Copyright (c) 2017, <NAME>, <NAME>, <NAME>, <NAME> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * 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. */ module ctl[S] //********************KRIPKE STRUCTURE DEF*************************// one sig TS{ S0: some S, sigma: S -> S, } //********************MODEL SET UP FUNCTIONS*************************// // set by users in their model files fun initialState: S {TS.S0} fun nextState: S -> S {TS.sigma} //********************HELPER FUNCTIONS*************************// private fun domainRes[R: S -> S, X: S]: S -> S{X <: R} private fun id[X:S]: S->S{domainRes[iden,X]} //********************LOGICAL OPERATORS*************************// fun not_[phi: S]: S {S - phi} fun and_[phi, si: S]: S {phi & si} fun or_[phi, si: S]: S {phi + si} fun imp_[phi, si: S]: S {not_[phi] + si} //********************TEMPORAL OPERATORS*************************// fun ex[phi: S]: S {TS.sigma.phi} fun ax[phi:S]:S {not_[ex[not_[phi]]]} fun ef[phi: S]: S {(*(TS.sigma)).phi } fun eg[phi: S]: S { let R= domainRes[TS.sigma,phi]| *R.((^R & id[S]).S) } fun af[phi: S]: S {not_[eg[not_[phi]]]} fun ag[phi: S]: S {not_[ef[not_[phi]]]} fun eu[phi, si: S]: S {(*(domainRes[TS.sigma, phi])).si} //********************MODEL CHECKING CONSTRAINT*************************// // called by users for mc in their model file pred ctl_mc[phi: S]{TS.S0 in phi}
Cubical/Algebra/Group/Subgroup.agda
bijan2005/univalent-foundations
0
15162
<reponame>bijan2005/univalent-foundations<gh_stars>0 {-# OPTIONS --cubical --no-import-sorts --safe #-} module Cubical.Algebra.Group.Subgroup where open import Cubical.Core.Everything open import Cubical.Foundations.Prelude open import Cubical.Foundations.HLevels open import Cubical.Data.Sigma open import Cubical.Algebra open import Cubical.Algebra.Group.Morphism open import Cubical.Algebra.Monoid.Submonoid open import Cubical.Relation.Unary open import Cubical.Relation.Unary.Subtype open import Cubical.HITs.PropositionalTruncation record IsSubgroup {c ℓ} (G : Group c) (Member : Pred ⟨ G ⟩ ℓ) : Type (ℓ-max c ℓ) where constructor issubgroup private module G = Group G field preservesOp : G._•_ Preserves₂ Member preservesInv : G._⁻¹ Preserves Member preservesId : G.ε ∈ Member isSubmonoid : IsSubmonoid G.monoid Member isSubmonoid = record { preservesOp = preservesOp ; preservesId = preservesId } open IsSubmonoid isSubmonoid hiding (preservesOp; preservesId; _^_) public _⁻¹ : Op₁ Carrier (x , subx) ⁻¹ = x G.⁻¹ , preservesInv subx inverseˡ : LeftInverse ε _⁻¹ _•_ inverseˡ _ = ΣPathTransport→PathΣ _ _ (G.inverseˡ _ , isProp[ Member ] _ _ _) inverseʳ : RightInverse ε _⁻¹ _•_ inverseʳ _ = ΣPathTransport→PathΣ _ _ (G.inverseʳ _ , isProp[ Member ] _ _ _) inverse : Inverse ε _⁻¹ _•_ inverse = inverseˡ , inverseʳ isGroup : IsGroup Carrier _•_ ε _⁻¹ isGroup = record { isMonoid = isMonoid ; inverse = inverse } group : Group _ group = record { isGroup = isGroup } open Group group using ( _^_ ; _/_ ; _/ˡ_ ; inv-uniqueˡ ; inv-uniqueʳ ; cancelˡ ; cancelʳ ) public record Subgroup {c} (G : Group c) ℓ : Type (ℓ-max c (ℓ-suc ℓ)) where constructor mksubgroup private module G = Group G field Member : Pred ⟨ G ⟩ ℓ isSubgroup : IsSubgroup G Member open IsSubgroup isSubgroup public submonoid : Submonoid G.monoid ℓ submonoid = record { isSubmonoid = isSubmonoid } open Submonoid submonoid using (submagma; subsemigroup) instance SubgroupCarrier : ∀ {c ℓ} {G : Group c} → HasCarrier (Subgroup G ℓ) _ SubgroupCarrier = record { ⟨_⟩ = Subgroup.Carrier } private variable c ℓ : Level G : Group c module _ {G : Group c} where open Group G ε-isSubgroup : IsSubgroup G { ε } ε-isSubgroup = record { preservesOp = map2 λ p q → cong₂ _•_ p q ∙ identityʳ ε ; preservesInv = map λ p → cong _⁻¹ p ∙ cancelʳ ε (inverseˡ ε ∙ sym (identityʳ ε)) ; preservesId = ∣ refl ∣ } ε-subgroup : Subgroup G _ ε-subgroup = record { isSubgroup = ε-isSubgroup } U-isSubgroup : IsSubgroup G U U-isSubgroup = record {} -- trivial U-subgroup : Subgroup G _ U-subgroup = record { isSubgroup = U-isSubgroup } IsNormal : Subgroup G ℓ → Type _ IsNormal {G = G} N = ∀ ((n , _) : ⟨ N ⟩) (g : ⟨ G ⟩) → g • n • g ⁻¹ ∈ Subgroup.Member N where open Group G NormalSubgroup : Group c → (ℓ : Level) → Type _ NormalSubgroup G ℓ = Σ (Subgroup G ℓ) IsNormal
.build/ada/asis.ads
faelys/gela-asis
4
16426
------------------------------------------------------------------------------ -- G E L A A S I S -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of this file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- 3 package Asis ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- with Gela.Source_Buffers; use Gela; ------------------------------------------------------------------------------- package Asis is pragma Preelaborate; ------------------------------------------------------------------------------- -- Package Asis encapsulates implementation-specific declarations, which are -- made available to ASIS and its client applications in an -- implementation-independent manner. -- -- Package ASIS is the root of the ASIS interface. -- ------------------------------------------------------------------------------- -- Abstract -- -- The Ada Semantic Interface Specification (ASIS) is an interface between an -- Ada environment as defined by ISO/IEC 8652:1995 (the Ada Reference Manual) -- and any tool requiring information from this environment. An Ada -- environment includes valuable semantic and syntactic information. ASIS is -- an open and published callable interface which gives CASE tool and -- application developers access to this information. ASIS has been designed -- to be independent of underlying Ada environment implementations, thus -- supporting portability of software engineering tools while relieving tool -- developers from having to understand the complexities of an Ada -- environment's proprietary internal representation. -- ------------------------------------------------------------------------------- -- Package ASIS Types: -- -- The following types are made visible directly through package Asis: -- type ASIS_Integer -- type ASIS_Natural -- type ASIS_Positive -- type List_Index -- type Context -- type Element -- type Element_List -- Element subtypes -- Element Kinds (set of enumeration types) -- type Compilation_Unit -- type Compilation_Unit_List -- Unit Kinds (set of enumeration types) -- type Traverse_Control -- subtype Program_Text -- -- The ASIS interface uses string parameters for many procedure and function -- calls. Wide_String is used to convey ASIS environment information. -- Program_Text, a subtype of Wide_String, is used to convey program text. -- The Ada type String is not used in the ASIS interface. Neither the Ada -- types Character nor Wide_Character are used in the ASIS interface. -- -- Implementation_Defined types and values -- -- A number of implementation-defined types and constants are used. To make -- the ASIS specification compile, the following types and constants are -- provided: type Implementation_Defined_Integer_Type is range -(2**31-1) .. 2**31-1; Implementation_Defined_Integer_Constant : constant := 2**31-1; -- In addition, there are several implementation-defined private types. -- For compilation convenience these types have been represented as -- enumeration types with the single value of "Implementation_Defined". -- An implementation may define reasonable types and constants. -- Please refer to commentary where each is used. -- ------------------------------------------------------------------------------- -- 3.1 type ASIS_Integer ------------------------------------------------------------------------------- subtype ASIS_Integer is Implementation_Defined_Integer_Type; ------------------------------------------------------------------------------- -- -- A numeric subtype that allows each ASIS implementation to place constraints -- on the lower and upper bounds. Whenever possible, the range of this type -- should meet or exceed -(2**31-1) .. 2**31-1. -- ------------------------------------------------------------------------------- -- 3.2 type ASIS_Natural ------------------------------------------------------------------------------- subtype ASIS_Natural is ASIS_Integer range 0 .. ASIS_Integer'Last; ------------------------------------------------------------------------------- -- 3.3 type ASIS_Positive ------------------------------------------------------------------------------- subtype ASIS_Positive is ASIS_Integer range 1 .. ASIS_Integer'Last; ------------------------------------------------------------------------------- -- 3.4 type List_Index ------------------------------------------------------------------------------- List_Index_Implementation_Upper : constant ASIS_Positive := Implementation_Defined_Integer_Constant; subtype List_Index is ASIS_Positive range 1 .. List_Index_Implementation_Upper; ------------------------------------------------------------------------------- -- List_Index is a numeric subtype used to establish the upper bound for list -- size. ------------------------------------------------------------------------------- -- 3.5 type Context ------------------------------------------------------------------------------- -- The ASIS Context is a view of a particular implementation of an Ada -- environment. ASIS requires an application to identify that view of -- the Ada environment. An ASIS Context identifies an Ada environment -- as defined by ISO/IEC 8652:1995. The Ada environment is well -- defined for Ada implementations. ISO/IEC 8652:1995 provides for an -- implementation-defined method to enter compilation units into the -- Ada environment. Implementation permissions allow for illegal and -- inconsistent units to be in the environment. The use of ASIS may -- result in the exception ASIS_Failed being raised if the Ada -- environment includes such units. -- -- Defined by the implementation, an ASIS context is a way to identify -- a set of Compilation Units to be processed by an ASIS application. -- This may include things such as the pathname, search rules, etc., -- which are attributes of the Ada environment and consequently -- becomes part of the ASIS Context only because it is a "view" of -- the Ada environment. -- -- Because the contents of the Ada environment are (Ada-)implementation -- defined, the ASIS context may contain illegal compilation units. -- An ASIS Context is a handle to a set of compilation units accessible -- by an ASIS application. The set of compilation units available -- from an ASIS context may be inconsistent, and may contain illegal -- compilation units. The contents are selected from the Ada -- environment as defined by the corresponding Ada Implementation. -- ASIS should allow multiple open contexts. -- -- In the Context abstraction, a logical handle is associated with Name and -- Parameters values that are used by the implementation to identify and -- connect to the information in the Ada environment. -- -- An ASIS Context is associated with some set of Ada compilation units -- maintained by an underlying Ada implementation or a stand-alone ASIS -- implementation. After this association has been made, this set of units -- is considered to be part of the compile-time Ada environment, which forms -- the outermost context of any compilation, as specified in section 10.1.4 of -- the Ada Reference Manual. This same environment context provides the -- implicit outermost anonymous task during program execution. -- -- Some implementations might not need explicit Name and/or Parameters values -- to identify their Ada environment. Other implementations might choose to -- implement the Ada environment as a single external file in which case the -- name and parameters values might simply supply the Name, Form, and any -- other values needed to open such a file. -- ------------------------------------------------------------------------------- -- Context shall be an undiscriminated limited private. ------------------------------------------------------------------------------- type Context is limited private; Nil_Context : constant Context; function "=" (Left : in Context; Right : in Context) return Boolean is abstract; ------------------------------------------------------------------------------- -- -- |IR Implementation Requirement -- |IR -- |IR The concrete mechanism of this association is implementation-specific: -- |IR -- |IR Each ASIS implementation provides the means to construct an ASIS -- |IR Context value that defines the environment declarative_part or -- |IR "context" from which ASIS can obtain library units. -- ------------------------------------------------------------------------------- -- 3.6 type Element ------------------------------------------------------------------------------- -- The Ada lexical element abstraction (a private type). -- -- The Element type is a distinct abstract type representing handles for the -- lexical elements that form the text of compilation units. Elements deal -- with the internal or "textual" view of compilation units. -- -- Operations are provided that split a Compilation_Unit object into one -- Element and two Element lists: -- -- a) A context clause represented by an Element_List containing -- with clauses, use clauses, and pragmas. -- -- b) An Element associated with the declaration. -- -- c) A list of pragmas, that are not part of the context clause but which -- nonetheless affect the compilation of the unit. -- ------------------------------------------------------------------------------- -- ASIS Elements are representations of the syntactic and semantic information -- available from most Ada environments. -- -- The ASIS Element type shall be an undiscriminated private type. ------------------------------------------------------------------------------- type Element is private; Nil_Element : constant Element; function "=" (Left : in Element; Right : in Element) return Boolean is abstract; ------------------------------------------------------------------------------- -- 3.7 type Element_List ------------------------------------------------------------------------------- type Element_List is array (List_Index range <>) of Element; Nil_Element_List : constant Element_List; ------------------------------------------------------------------------------- -- 3.8 subtypes of Element and Element_List ------------------------------------------------------------------------------- subtype Access_Type_Definition is Element; subtype Association is Element; subtype Association_List is Element_List; subtype Case_Statement_Alternative is Element; subtype Clause is Element; subtype Component_Clause is Element; subtype Component_Clause_List is Element_List; subtype Component_Declaration is Element; subtype Component_Definition is Element; subtype Constraint is Element; subtype Context_Clause is Element; subtype Context_Clause_List is Element_List; subtype Declaration is Element; subtype Declaration_List is Element_List; subtype Declarative_Item_List is Element_List; subtype Definition is Element; subtype Definition_List is Element_List; subtype Discrete_Range is Element; subtype Discrete_Range_List is Element_List; subtype Discrete_Subtype_Definition is Element; subtype Discriminant_Association is Element; subtype Discriminant_Association_List is Element_List; subtype Discriminant_Specification_List is Element_List; subtype Defining_Name is Element; subtype Defining_Name_List is Element_List; subtype Exception_Handler is Element; subtype Exception_Handler_List is Element_List; subtype Expression is Element; subtype Expression_List is Element_List; subtype Formal_Type_Definition is Element; subtype Generic_Formal_Parameter is Element; subtype Generic_Formal_Parameter_List is Element_List; subtype Identifier is Element; subtype Identifier_List is Element_List; subtype Name is Element; subtype Name_List is Element_List; subtype Parameter_Specification is Element; subtype Parameter_Specification_List is Element_List; subtype Path is Element; subtype Path_List is Element_List; subtype Pragma_Element is Element; subtype Pragma_Element_List is Element_List; subtype Range_Constraint is Element; subtype Record_Component is Element; subtype Record_Component_List is Element_List; subtype Record_Definition is Element; subtype Representation_Clause is Element; subtype Representation_Clause_List is Element_List; subtype Root_Type_Definition is Element; subtype Select_Alternative is Element; subtype Statement is Element; subtype Statement_List is Element_List; subtype Subtype_Indication is Element; subtype Subtype_Mark is Element; subtype Type_Definition is Element; subtype Variant is Element; subtype Variant_Component_List is Element_List; subtype Variant_List is Element_List; -- ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- 3.9 Element Kinds ------------------------------------------------------------------------------- -- Element Kinds are enumeration types describing various kinds of elements. -- These element kinds are only used by package Asis.Elements. ------------------------------------------------------------------------------- -- 3.9.1 type Element_Kinds ------------------------------------------------------------------------------- -- Element_Kinds Hierarchy -- -- ASIS offers hierarchical classification of elements. At the highest -- level, the Element_Kinds type provides literals that define "kinds" or -- classes listed below into which all non-nil elements are grouped. Elements -- in each of the Element_Kinds classes, with the exception of -- An_Exception_Handler, can be further classified by a subordinate kind at -- the next level in the hierarchy. Several subordinate kinds also have -- additional subordinate kinds. -- -- For example, Element_Kinds'A_Declaration might be classified into -- Declaration_Kinds'A_Parameter_Specification which might be further -- classified into Mode_Kinds'An_In_Mode. -- This fully identifies the syntax of an element such as: -- -- (Who : in Person) -- -- All Element_Kinds and subordinate kinds Queries are in Asis.Elements. -- -- It is not necessary to strictly follow the hierarchy; any element can be -- classified by any subordinate kind from any level. However, meaningful -- results will only be obtained from subordinate kinds that are appropriate. -- These are designated within the hierarchy shown below: -- -- Element_Kinds -> Subordinate Kinds ------------------------------------------------------------------------------- -- Key: Read "->" as "is further classified by its" -- -- A_Pragma -> Pragma_Kinds -- -- A_Defining_Name -> Defining_Name_Kinds -- -> Operator_Kinds -- -- A_Declaration -> Declaration_Kinds -- -> Declaration_Origins -- -> Mode_Kinds -- -> Subprogram_Default_Kinds -- -- A_Definition -> Definition_Kinds -- -> Type_Kinds -- -> Formal_Type_Kinds -- -> Access_Type_Kinds -- -> Root_Type_Kinds -- -> Constraint_Kinds -- -> Discrete_Range_Kinds -- -- An_Expression -> Expression_Kinds -- -> Operator_Kinds -- -> Attribute_Kinds -- -- An_Association -> Association_Kinds -- -- A_Statement -> Statement_Kinds -- -- A_Path -> Path_Kinds -- -- A_Clause -> Clause_Kinds -- -> Representation_Clause_Kinds -- -- An_Exception_Handler -- ------------------------------------------------------------------------------- -- Element_Kinds - general element classifications -- Literals -- ASIS package with queries for these kinds ------------------------------------------------------------------------------- type Element_Kinds is ( Not_An_Element, -- Nil_Element A_Pragma, -- Asis.Elements A_Defining_Name, -- Asis.Declarations A_Declaration, -- Asis.Declarations A_Definition, -- Asis.Definitions An_Expression, -- Asis.Expressions An_Association, -- Asis.Expressions A_Statement, -- Asis.Statements A_Path, -- Asis.Statements A_Clause, -- Asis.Clauses An_Exception_Handler); -- Asis.Statements ------------------------------------------------------------------------------- -- 3.9.2 type Pragma_Kinds ------------------------------------------------------------------------------- -- Pragma_Kinds - classifications for pragmas -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Pragma_Kinds is ( Not_A_Pragma, -- An unexpected element An_All_Calls_Remote_Pragma, -- E.2.3(5) An_Assert_Pragma, -- 11.4.2 (3) An_Assertion_Policy_Pragma, -- 11.4.2 (6) An_Asynchronous_Pragma, -- E.4.1(3) An_Atomic_Pragma, -- C.6(3) An_Atomic_Components_Pragma, -- C.6(5) An_Attach_Handler_Pragma, -- C.3.1(4) A_Controlled_Pragma, -- 13.11.3(3) A_Convention_Pragma, -- B.1(7), M.1(5) A_Detect_Blocking_Pragma, -- D.13 (4) A_Discard_Names_Pragma, -- C.5(3) An_Elaborate_Pragma, -- 10.2.1(20) An_Elaborate_All_Pragma, -- 10.2.1(21) An_Elaborate_Body_Pragma, -- 10.2.1(22) An_Export_Pragma, -- B.1(5), M.1(5) An_Import_Pragma, -- B.1(6), M.1(5) An_Inline_Pragma, -- 6.3.2(3) An_Inspection_Point_Pragma, -- H.3.2(3) An_Interrupt_Handler_Pragma, -- C.3.1(2) An_Interrupt_Priority_Pragma, -- D.1(5) A_Linker_Options_Pragma, -- B.1(8) A_List_Pragma, -- 2.8(21) A_Locking_Policy_Pragma, -- D.3(3) A_No_Return_Pragma, -- 6.5.1 (3) A_Normalize_Scalars_Pragma, -- H.1(3) An_Optimize_Pragma, -- 2.8(23) A_Pack_Pragma, -- 13.2(3) A_Page_Pragma, -- 2.8(22) A_Partition_Elaboration_Policy_Pragma, -- H.6 (3) A_Preelaborable_Initialization_Pragma, -- 7.6 (5) A_Preelaborate_Pragma, -- 10.2.1(3) A_Priority_Pragma, -- D.1(3) A_Priority_Specific_Dispatching_Pragma, -- D.2.2 (2.2) A_Profile_Pragma, -- D.13 (2) A_Pure_Pragma, -- 10.2.1(14) A_Queuing_Policy_Pragma, -- D.4(3) A_Relative_Deadline_Pragma, -- D.2.6 (2.2) A_Remote_Call_Interface_Pragma, -- E.2.3(3) A_Remote_Types_Pragma, -- E.2.2(3) A_Restrictions_Pragma, -- 13.12(3) A_Reviewable_Pragma, -- H.3.1(3) A_Shared_Passive_Pragma, -- E.2.1(3) A_Storage_Size_Pragma, -- 13.3(63) A_Suppress_Pragma, -- 11.5(4) A_Task_Dispatching_Policy_Pragma, -- D.2.2(2) An_Unchecked_Union_Pragma, -- B.3.3 (3) An_Unsuppress_Pragma, -- 11.5 (4.1) A_Volatile_Pragma, -- C.6(4) A_Volatile_Components_Pragma, -- C.6(6) An_Implementation_Defined_Pragma, -- 2.8(14) An_Unknown_Pragma); -- Unknown to ASIS ------------------------------------------------------------------------------- -- 3.9.3 type Defining_Name_Kinds ------------------------------------------------------------------------------- -- Defining_Name_Kinds - names defined by declarations and specifications. -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Defining_Name_Kinds is ( Not_A_Defining_Name, -- An unexpected element A_Defining_Identifier, -- 3.1(4) A_Defining_Character_Literal, -- 3.5.1(4) A_Defining_Enumeration_Literal, -- 3.5.1(3) A_Defining_Operator_Symbol, -- 6.1(9) A_Defining_Expanded_Name); -- 6.1(7) -- program unit name defining_identifier ------------------------------------------------------------------------------- -- 3.9.4 type Declaration_Kinds ------------------------------------------------------------------------------- -- Declaration_Kinds - declarations and specifications having defining -- name literals. -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Declaration_Kinds is ( Not_A_Declaration, -- An unexpected element An_Ordinary_Type_Declaration, -- 3.2.1(3) -- a full_type_declaration of the form: -- type defining_identifier [known_discriminant_part] -- is type_definition; A_Task_Type_Declaration, -- 9.1(2) A_Protected_Type_Declaration, -- 9.4(2) An_Incomplete_Type_Declaration, -- 3.2.1(2),3.10(2) A_Private_Type_Declaration, -- 3.2.1(2),7.3(2) A_Private_Extension_Declaration, -- 3.2.1(2),7.3(3) A_Subtype_Declaration, -- 3.2.2(2) A_Variable_Declaration, -- 3.3.1(2) A_Constant_Declaration, -- 3.3.1(4) A_Deferred_Constant_Declaration, -- 3.3.1(6),7.4(2) A_Single_Task_Declaration, -- 3.3.1(2),9.1(3) A_Single_Protected_Declaration, -- 3.3.1(2),9.4(2) An_Integer_Number_Declaration, -- 3.3.2(2) A_Real_Number_Declaration, -- 3.5.6(2) An_Enumeration_Literal_Specification, -- 3.5.1(3) A_Discriminant_Specification, -- 3.7(5) A_Component_Declaration, -- 3.8(6) A_Return_Object_Specification, -- 6.5(2) A_Loop_Parameter_Specification, -- 5.5(4) A_Procedure_Declaration, -- 6.1(4) A_Function_Declaration, -- 6.1(4) A_Parameter_Specification, -- 6.1(15) -> Mode_Kinds A_Procedure_Body_Declaration, -- 6.3(2) A_Function_Body_Declaration, -- 6.3(2) A_Package_Declaration, -- 7.1(2) A_Package_Body_Declaration, -- 7.2(2) An_Object_Renaming_Declaration, -- 8.5.1(2) An_Exception_Renaming_Declaration, -- 8.5.2(2) A_Package_Renaming_Declaration, -- 8.5.3(2) A_Procedure_Renaming_Declaration, -- 8.5.4(2) A_Function_Renaming_Declaration, -- 8.5.4(2) A_Generic_Package_Renaming_Declaration, -- 8.5.5(2) A_Generic_Procedure_Renaming_Declaration, -- 8.5.5(2) A_Generic_Function_Renaming_Declaration, -- 8.5.5(2) A_Task_Body_Declaration, -- 9.1(6) A_Protected_Body_Declaration, -- 9.4(7) An_Entry_Declaration, -- 9.5.2(2) An_Entry_Body_Declaration, -- 9.5.2(5) An_Entry_Index_Specification, -- 9.5.2(2) A_Procedure_Body_Stub, -- 10.1.3(3) A_Function_Body_Stub, -- 10.1.3(3) A_Package_Body_Stub, -- 10.1.3(4) A_Task_Body_Stub, -- 10.1.3(5) A_Protected_Body_Stub, -- 10.1.3(6) An_Exception_Declaration, -- 11.1(2) A_Choice_Parameter_Specification, -- 11.2(4) A_Generic_Procedure_Declaration, -- 12.1(2) A_Generic_Function_Declaration, -- 12.1(2) A_Generic_Package_Declaration, -- 12.1(2) A_Package_Instantiation, -- 12.3(2) A_Procedure_Instantiation, -- 12.3(2) A_Function_Instantiation, -- 12.3(2) A_Formal_Object_Declaration, -- 12.4(2) -> Mode_Kinds A_Formal_Type_Declaration, -- 12.5(2) A_Formal_Procedure_Declaration, -- 12.6(2) -- -- -> Subprogram_Default_Kinds A_Formal_Function_Declaration, -- 12.6(2) -- -- -> Subprogram_Default_Kinds A_Formal_Package_Declaration, -- 12.7(2) A_Formal_Package_Declaration_With_Box); -- 12.7(3) -- The following Declaration_Kinds subtypes are not used by ASIS but are -- provided for the convenience of the ASIS implementor: subtype A_Type_Declaration is Declaration_Kinds range An_Ordinary_Type_Declaration .. A_Private_Extension_Declaration; subtype A_Full_Type_Declaration is Declaration_Kinds range An_Ordinary_Type_Declaration .. A_Protected_Type_Declaration; subtype An_Object_Declaration is Declaration_Kinds range A_Variable_Declaration .. A_Single_Protected_Declaration; subtype A_Number_Declaration is Declaration_Kinds range An_Integer_Number_Declaration .. A_Real_Number_Declaration; subtype A_Renaming_Declaration is Declaration_Kinds range An_Object_Renaming_Declaration .. A_Generic_Function_Renaming_Declaration; subtype A_Body_Stub is Declaration_Kinds range A_Procedure_Body_Stub .. A_Protected_Body_Stub; subtype A_Generic_Declaration is Declaration_Kinds range A_Generic_Procedure_Declaration .. A_Generic_Package_Declaration; subtype A_Generic_Instantiation is Declaration_Kinds range A_Package_Instantiation .. A_Function_Instantiation; subtype A_Formal_Declaration is Declaration_Kinds range A_Formal_Object_Declaration .. A_Formal_Package_Declaration_With_Box; ------------------------------------------------------------------------------- -- 3.9.x type Overriding_Indicator_Kinds ------------------------------------------------------------------------------- -- -- Type Overriding_Indicator_Kinds classifies declarations and specifications -- having an overrriding indicator. -- ------------------------------------------------------------------------------- -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Overriding_Indicator_Kinds is ( Not_An_Overriding_Indicator, No_Overriding_Indicator, -- 8.3.1 (2) An_Indicator_of_Overriding, -- 8.3.1 (2) An_Indicator_of_Not_Overriding); -- 8.3.1 (2) ------------------------------------------------------------------------------- -- 3.9.5 type Trait_Kinds (Obsolescent) - see clause X ------------------------------------------------------------------------------- -- -- Trait_Kinds provide a means of further classifying the syntactic structure -- or "trait" of certain A_Declaration and A_Definition elements. -- Trait_Kinds are determined only by the presence (or absence) of certain -- syntactic constructs. The semantics of an element are not considered. -- -- The syntax of interest here are the reserved words "abstract", "aliased", -- "limited", "private", "reverse", whereever they appear, and the reserved -- word "access" when it qualifies a definition defining an anonymous type -- (an access_definition). -- Trait_Kinds enumerates all combinations useful in this classification. -- -- For example, A_Variable_Declaration element that is semantically a -- limited type because its components are of a limited type is -- An_Ordinary_Trait, not A_Limited_Trait, since the reserved word "limited" -- does not appear in its declaration or definition. -- -- The subordinate Trait_Kinds allow Declaration_Kinds and Definition_Kinds -- to enumerate fewer higher level elements, and be less cluttered by all -- possible permutations of syntactic possibilities. For example, in the case -- of a record_type_definition, Definition_Kinds can provide just two literals -- that differentiate between ordinary record types and tagged record types: -- -- A_Record_Type_Definition, -- 3.8(2) -> Trait_Kinds -- A_Tagged_Record_Type_Definition, -- 3.8(2) -> Trait_Kinds -- -- The remaining classification can be accomplished, if desired, using -- Trait_Kinds to determine if the definition is abstract, or limited, -- or both. Without Trait_Kinds, Definition_Kinds needs six literals to -- identify all the syntactic combinations for a record_type_definition. -- -- Elements expected by the Trait_Kind query are any Declaration_Kinds or -- Definition_Kinds for which Trait_Kinds is a subordinate kind: the literal -- definition has "-> Trait_Kinds" following it. For example, the -- definitions of: -- -- A_Discriminant_Specification, -- 3.7(5) -> Trait_Kinds -- A_Component_Declaration, -- 3.8(6) -- -- indicate A_Discriminant_Specification is an expected kind while -- A_Component_Declaration is unexpected. -- -- All Declaration_Kinds and Definition_Kinds for which Trait_Kinds is not a -- subordinate kind, and all other Element_Kinds, are unexpected and are -- Not_A_Trait. -- -- An_Ordinary_Trait is any expected element whose syntax does not explicitly -- contain any of the reserved words listed above. -- ------------------------------------------------------------------------------- -- Trait_Kinds -- Literals ------------------------------------------------------------------------------- type Trait_Kinds is ( Not_A_Trait, -- An unexpected element An_Ordinary_Trait, -- The declaration or definition -- does not have any of the -- following traits An_Aliased_Trait, -- "aliased" is present An_Access_Definition_Trait, -- The definition defines an -- anonymous access type A_Reverse_Trait, -- "reverse" is present A_Private_Trait, -- Only "private" is present A_Limited_Trait, -- Only "limited" is present A_Limited_Private_Trait, -- "limited" and "private" are -- present An_Abstract_Trait, -- Only "abstract" is present An_Abstract_Private_Trait, -- "abstract" and "private" are -- present An_Abstract_Limited_Trait, -- "abstract" and "limited" are -- present An_Abstract_Limited_Private_Trait); -- "abstract", "limited", and -- "private" are present ------------------------------------------------------------------------------- -- 3.9.6 type Declaration_Origins ------------------------------------------------------------------------------- -- Declaration_Origins -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Declaration_Origins is ( Not_A_Declaration_Origin, -- An unexpected element An_Explicit_Declaration, -- 3.1(5) explicitly declared in -- the text of a program, or within -- an expanded generic template An_Implicit_Predefined_Declaration, -- 3.1(5), 3.2.3(1), A.1(2) An_Implicit_Inherited_Declaration); -- 3.1(5), 3.4(6-35) ------------------------------------------------------------------------------- -- 3.9.7 type Mode_Kinds ------------------------------------------------------------------------------- -- Mode_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Mode_Kinds is ( -- 6.1 Not_A_Mode, -- An unexpected element A_Default_In_Mode, -- procedure A(B : C); An_In_Mode, -- procedure A(B : IN C); An_Out_Mode, -- procedure A(B : OUT C); An_In_Out_Mode); -- procedure A(B : IN OUT C); ------------------------------------------------------------------------------- -- 3.9.8 type Subprogram_Default_Kinds ------------------------------------------------------------------------------- -- Subprogram_Default_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Subprogram_Default_Kinds is ( -- 12.6 Not_A_Default, -- An unexpected element A_Name_Default, -- with subprogram_specification is default_name; A_Box_Default, -- with subprogram_specification is <>; A_Nil_Default); -- with subprogram_specification; ------------------------------------------------------------------------------- -- 3.9.9 type Definition_Kinds ------------------------------------------------------------------------------- -- Definition_Kinds -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Definition_Kinds is ( Not_A_Definition, -- An unexpected element A_Type_Definition, -- 3.2.1(4) A_Subtype_Indication, -- 3.2.2(3) A_Constraint, -- 3.2.2(5) -> Constraint_Kinds A_Component_Definition, -- 3.6(7) A_Discrete_Subtype_Definition, -- 3.6(6) -> Discrete_Range_Kinds A_Discrete_Range, -- 3.6.1(3) -> Discrete_Range_Kinds An_Unknown_Discriminant_Part, -- 3.7(3) A_Known_Discriminant_Part, -- 3.7(2) A_Record_Definition, -- 3.8(3) A_Null_Record_Definition, -- 3.8(3) A_Null_Component, -- 3.8(4) A_Variant_Part, -- 3.8.1(2) A_Variant, -- 3.8.1(3) An_Others_Choice, -- 3.8.1(5), 4.3.1(5), 4.3.3(5),11.2(5) An_Access_Definition, -- 3.10(6) An_Incomplete_Type_Definition, -- 3.10.1(1) A_Tagged_Incomplete_Type_Definition, -- 3.10.1(2) A_Private_Type_Definition, -- 7.3(2) A_Tagged_Private_Type_Definition, -- 7.3(2) A_Private_Extension_Definition, -- 7.3(3) A_Task_Definition, -- 9.1(4) A_Protected_Definition, -- 9.4(4) A_Formal_Type_Definition); -- 12.5(3) -> Formal_Type_Kinds ------------------------------------------------------------------------------- -- 3.9.10 type Type_Kinds ------------------------------------------------------------------------------- -- Type_Kinds -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Type_Kinds is ( Not_A_Type_Definition, -- An unexpected element A_Derived_Type_Definition, -- 3.4(2) A_Derived_Record_Extension_Definition, -- 3.4(2) An_Enumeration_Type_Definition, -- 3.5.1(2) A_Signed_Integer_Type_Definition, -- 3.5.4(3) A_Modular_Type_Definition, -- 3.5.4(4) A_Root_Type_Definition, -- 3.5.4(14), 3.5.6(3) -- -> Root_Type_Kinds A_Floating_Point_Definition, -- 3.5.7(2) An_Ordinary_Fixed_Point_Definition, -- 3.5.9(3) A_Decimal_Fixed_Point_Definition, -- 3.5.9(6) An_Unconstrained_Array_Definition, -- 3.6(2) A_Constrained_Array_Definition, -- 3.6(2) A_Record_Type_Definition, -- 3.8(2) A_Tagged_Record_Type_Definition, -- 3.8(2) An_Interface_Type_Definition, -- 3.9.4 (2) -> Interface_Kinds An_Access_Type_Definition); -- 3.10(2) -> Access_Type_Kinds ------------------------------------------------------------------------------- -- 3.9.11 type Formal_Type_Kinds ------------------------------------------------------------------------------- -- Formal_Type_Kinds -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Formal_Type_Kinds is ( Not_A_Formal_Type_Definition, -- An unexpected element A_Formal_Private_Type_Definition, -- 12.5.1(2) A_Formal_Tagged_Private_Type_Definition, -- 12.5.1(2) A_Formal_Derived_Type_Definition, -- 12.5.1(3) A_Formal_Discrete_Type_Definition, -- 12.5.2(2) A_Formal_Signed_Integer_Type_Definition, -- 12.5.2(3) A_Formal_Modular_Type_Definition, -- 12.5.2(4) A_Formal_Floating_Point_Definition, -- 12.5.2(5) A_Formal_Ordinary_Fixed_Point_Definition, -- 12.5.2(6) A_Formal_Decimal_Fixed_Point_Definition, -- 12.5.2(7) A_Formal_Unconstrained_Array_Definition, -- 12.5.3(2), 3.6(3) A_Formal_Constrained_Array_Definition, -- 12.5.3(2), 3.6(5) A_Formal_Access_Type_Definition, -- 12.5.4(2) -- -> Access_Type_Kinds A_Formal_Interface_Type_Definition); -- 12.5.5 (2) -- -> Interface_Kinds ------------------------------------------------------------------------------- -- 3.9.12 type Access_Type_Kinds ------------------------------------------------------------------------------- -- Access_Type_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Access_Type_Kinds is ( -- 3.10 Not_An_Access_Type_Definition, -- An unexpected element A_Pool_Specific_Access_To_Variable, -- access subtype_indication An_Access_To_Variable, -- access all subtype_indication An_Access_To_Constant, -- access constant subtype_indication An_Access_To_Procedure, -- access procedure An_Access_To_Protected_Procedure, -- access protected procedure An_Access_To_Function, -- access function An_Access_To_Protected_Function); -- access protected function -- The following Access_Type_Kinds subtypes are not used by ASIS but are -- provided for the convenience of the ASIS implementor: subtype Access_To_Object_Definition is Access_Type_Kinds range A_Pool_Specific_Access_To_Variable .. An_Access_To_Constant; subtype Access_To_Subprogram_Definition is Access_Type_Kinds range An_Access_To_Procedure .. An_Access_To_Protected_Function; ------------------------------------------------------------------------------- -- 3.9.xx type Access_Definition_Kinds ------------------------------------------------------------------------------- type Access_Definition_Kinds is ( -- 3.3.1(2) / 3.10(6) Not_An_Access_Definition, -- An unexpected element An_Anonymous_Access_To_Variable, -- 3.3.1(2) access -- subtype_mark An_Anonymous_Access_To_Constant, -- 3.3.1(2) / 3.10(6) -- access constant -- subtype_mark An_Anonymous_Access_To_Procedure, -- 3.10(6) access procedure An_Anonymous_Access_To_Protected_Procedure, -- 3.10(6) access protected -- procedure An_Anonymous_Access_To_Function, -- 3.10(6) access function An_Anonymous_Access_To_Protected_Function); -- 3.10(6) access protected -- function subtype An_Anonymous_Access_to_Object_Definition is Access_Definition_Kinds range An_Anonymous_Access_To_Variable .. An_Anonymous_Access_To_Constant; subtype An_Anonymous_Access_to_Subprogram_Definition is Access_Definition_Kinds range An_Anonymous_Access_To_Procedure .. An_Anonymous_Access_To_Protected_Function; ------------------------------------------------------------------------------- -- 3.9.13 type Root_Type_Kinds ------------------------------------------------------------------------------- -- Root_Type_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Root_Type_Kinds is ( Not_A_Root_Type_Definition, -- An unexpected element A_Root_Integer_Definition, -- 3.4.1(8) A_Root_Real_Definition, -- 3.4.1(8) A_Universal_Integer_Definition, -- 3.4.1(6) A_Universal_Real_Definition, -- 3.4.1(6) A_Universal_Fixed_Definition, -- 3.4.1(6) A_Universal_Access_Definition); -- 3.4.1(6) ------------------------------------------------------------------------------- -- 3.9.14 type Constraint_Kinds ------------------------------------------------------------------------------- -- Constraint_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Constraint_Kinds is ( Not_A_Constraint, -- An unexpected element A_Range_Attribute_Reference, -- 3.5(2) A_Simple_Expression_Range, -- 3.2.2, 3.5(3) A_Digits_Constraint, -- 3.2.2, 3.5.9 A_Delta_Constraint, -- 3.2.2, J.3 An_Index_Constraint, -- 3.2.2, 3.6.1 A_Discriminant_Constraint); -- 3.2.2 ------------------------------------------------------------------------------- -- 3.9.15 type Discrete_Range_Kinds ------------------------------------------------------------------------------- -- Discrete_Range_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Discrete_Range_Kinds is ( Not_A_Discrete_Range, -- An unexpected element A_Discrete_Subtype_Indication, -- 3.6.1(6), 3.2.2 A_Discrete_Range_Attribute_Reference, -- 3.6.1, 3.5 A_Discrete_Simple_Expression_Range); -- 3.6.1, 3.5 ------------------------------------------------------------------------------- -- 3.9.xx type Interface_Types ------------------------------------------------------------------------------- type Interface_Kinds is ( -- 3.9.4 (2) Not_An_Interface, -- An unexpected element An_Ordinary_Interface, -- 3.9.4(2) interface ... A_Limited_Interface, -- 3.9.4(2) limited interface ... A_Task_Interface, -- 3.9.4(2) task interface ... A_Protected_Interface, -- 3.9.4(2) protected interface ... A_Synchronized_Interface); -- 3.9.4(2) synchronized interface ... ------------------------------------------------------------------------------- -- 3.9.16 type Association_Kinds ------------------------------------------------------------------------------- -- Association_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Association_Kinds is ( Not_An_Association, -- An unexpected element A_Pragma_Argument_Association, -- 2.8 A_Discriminant_Association, -- 3.7.1 A_Record_Component_Association, -- 4.3.1 An_Array_Component_Association, -- 4.3.3 A_Parameter_Association, -- 6.4 A_Generic_Association); -- 12.3 ------------------------------------------------------------------------------- -- 3.9.17 type Expression_Kinds ------------------------------------------------------------------------------- ------------------------------------------------------------------------------- -- Expression_Kinds - general expression classifications -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Expression_Kinds is ( Not_An_Expression, -- An unexpected element A_Box_Expression, -- 4.3.1(4), 4.3.3(3,6) An_Integer_Literal, -- 2.4 A_Real_Literal, -- 2.4.1 A_String_Literal, -- 2.6 An_Identifier, -- 4.1 An_Operator_Symbol, -- 4.1 A_Character_Literal, -- 4.1 An_Enumeration_Literal, -- 4.1 An_Explicit_Dereference, -- 4.1 A_Function_Call, -- 4.1 An_Indexed_Component, -- 4.1.1 A_Slice, -- 4.1.2 A_Selected_Component, -- 4.1.3 An_Attribute_Reference, -- 4.1.4 -> Attribute_Kinds A_Record_Aggregate, -- 4.3 An_Extension_Aggregate, -- 4.3 A_Positional_Array_Aggregate, -- 4.3 A_Named_Array_Aggregate, -- 4.3 An_And_Then_Short_Circuit, -- 4.4 An_Or_Else_Short_Circuit, -- 4.4 An_In_Range_Membership_Test, -- 4.4 A_Not_In_Range_Membership_Test, -- 4.4 An_In_Type_Membership_Test, -- 4.4 A_Not_In_Type_Membership_Test, -- 4.4 A_Null_Literal, -- 4.4 A_Parenthesized_Expression, -- 4.4 A_Type_Conversion, -- 4.6 A_Qualified_Expression, -- 4.7 An_Allocation_From_Subtype, -- 4.8 An_Allocation_From_Qualified_Expression); -- 4.8 ------------------------------------------------------------------------------- -- 3.9.18 type Operator_Kinds ------------------------------------------------------------------------------- -- Operator_Kinds - classification of the various Ada predefined operators -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Operator_Kinds is ( -- 4.5 Not_An_Operator, -- An unexpected element An_And_Operator, -- and An_Or_Operator, -- or An_Xor_Operator, -- xor An_Equal_Operator, -- = A_Not_Equal_Operator, -- /= A_Less_Than_Operator, -- < A_Less_Than_Or_Equal_Operator, -- <= A_Greater_Than_Operator, -- > A_Greater_Than_Or_Equal_Operator, -- >= A_Plus_Operator, -- + A_Minus_Operator, -- - A_Concatenate_Operator, -- & A_Unary_Plus_Operator, -- + A_Unary_Minus_Operator, -- - A_Multiply_Operator, -- * A_Divide_Operator, -- / A_Mod_Operator, -- mod A_Rem_Operator, -- rem An_Exponentiate_Operator, -- ** An_Abs_Operator, -- abs A_Not_Operator); -- not ------------------------------------------------------------------------------- -- 3.9.19 type Attribute_Kinds ------------------------------------------------------------------------------- -- Attribute_Kinds - classifications for all known Ada attributes -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Attribute_Kinds is ( Not_An_Attribute, -- An unexpected element An_Access_Attribute, -- 3.10.2(24), 3.10.2(32), K(2), K(4) An_Address_Attribute, -- 13.3(11), J.7.1(5), K(6) An_Adjacent_Attribute, -- A.5.3(48), K(8) An_Aft_Attribute, -- 3.5.10(5), K(12) An_Alignment_Attribute, -- 13.3(23), K(14) A_Base_Attribute, -- 3.5(15), K(17) A_Bit_Order_Attribute, -- 13.5.3(4), K(19) A_Body_Version_Attribute, -- E.3(4), K(21) A_Callable_Attribute, -- 9.9(2), K(23) A_Caller_Attribute, -- C.7.1(14), K(25) A_Ceiling_Attribute, -- A.5.3(33), K(27) A_Class_Attribute, -- 3.9(14), 7.3.1(9), K(31), K(34) A_Component_Size_Attribute, -- 13.3(69), K(36) A_Compose_Attribute, -- A.5.3(24), K(38) A_Constrained_Attribute, -- 3.7.2(3), J.4(2), K(42) A_Copy_Sign_Attribute, -- A.5.3(51), K(44) A_Count_Attribute, -- 9.9(5), K(48) A_Definite_Attribute, -- 12.5.1(23), K(50) A_Delta_Attribute, -- 3.5.10(3), K(52) A_Denorm_Attribute, -- A.5.3(9), K(54) A_Digits_Attribute, -- 3.5.8(2), 3.5.10(7), K(56), K(58) An_Exponent_Attribute, -- A.5.3(18), K(60) An_External_Tag_Attribute, -- 13.3(75), K(64) A_First_Attribute, -- 3.5(12), 3.6.2(3), K(68), K(70) A_First_Bit_Attribute, -- 13.5.2(3), K(72) A_Floor_Attribute, -- A.5.3(30), K(74) A_Fore_Attribute, -- 3.5.10(4), K(78) A_Fraction_Attribute, -- A.5.3(21), K(80) An_Identity_Attribute, -- 11.4.1(9), C.7.1(12), K(84), K(86) An_Image_Attribute, -- 3.5(35), K(88) An_Input_Attribute, -- 13.13.2(22), 13.13.2(32), K(92), K(96) A_Last_Attribute, -- 3.5(13), 3.6.2(5), K(102), K(104) A_Last_Bit_Attribute, -- 13.5.2(4), K(106) A_Leading_Part_Attribute, -- A.5.3(54), K(108) A_Length_Attribute, -- 3.6.2(9), K(117) A_Machine_Attribute, -- A.5.3(60), K(119) A_Machine_Emax_Attribute, -- A.5.3(8), K(123) A_Machine_Emin_Attribute, -- A.5.3(7), K(125) A_Machine_Mantissa_Attribute, -- A.5.3(6), K(127) A_Machine_Overflows_Attribute, -- A.5.3(12), A.5.4(4), K(129), K(131) A_Machine_Radix_Attribute, -- A.5.3(2), A.5.4(2), K(133), K(135) A_Machine_Rounding_Attribute, -- A.5.3 (41.1/2), K(135.1/2) A_Machine_Rounds_Attribute, -- A.5.3(11), A.5.4(3), K(137), K(139) A_Max_Attribute, -- 3.5(19), K(141) A_Max_Size_In_Storage_Elements_Attribute, -- 13.11.1(3), K(145) A_Min_Attribute, -- 3.5(16), K(147) A_Mod_Attribute, -- 3.5.4 (16.3/2), K(150.1/2) A_Model_Attribute, -- A.5.3(68), G.2.2(7), K(151) A_Model_Emin_Attribute, -- A.5.3(65), G.2.2(4), K(155) A_Model_Epsilon_Attribute, -- A.5.3(66), K(157) A_Model_Mantissa_Attribute, -- A.5.3(64), G.2.2(3), K(159) A_Model_Small_Attribute, -- A.5.3(67), K(161) A_Modulus_Attribute, -- 3.5.4(17), K(163) An_Output_Attribute, -- 13.13.2(19), 13.13.2(29), K(165), K(169) A_Partition_ID_Attribute, -- E.1(9), K(173) A_Pos_Attribute, -- 3.5.5(2), K(175) A_Position_Attribute, -- 13.5.2(2), K(179) A_Pred_Attribute, -- 3.5(25), K(181) A_Priority_Attribute, -- D.2.6 (27/2), K(184.1/2) A_Range_Attribute, -- 3.5(14), 3.6.2(7), K(187), K(189) A_Read_Attribute, -- 13.13.2(6), 13.13.2(14), K(191), K(195) A_Remainder_Attribute, -- A.5.3(45), K(199) A_Round_Attribute, -- 3.5.10(12), K(203) A_Rounding_Attribute, -- A.5.3(36), K(207) A_Safe_First_Attribute, -- A.5.3(71), G.2.2(5), K(211) A_Safe_Last_Attribute, -- A.5.3(72), G.2.2(6), K(213) A_Scale_Attribute, -- 3.5.10(11), K(215) A_Scaling_Attribute, -- A.5.3(27), K(217) A_Signed_Zeros_Attribute, -- A.5.3(13), K(221) A_Size_Attribute, -- 13.3(40), 13.3(45), K(223), K(228) A_Small_Attribute, -- 3.5.10(2), K(230) A_Storage_Pool_Attribute, -- 13.11(13), K(232) A_Storage_Size_Attribute, -- 13.3(60), 13.11(14), J.9(2), K(234), -- K(236) A_Stream_Size_Attribute, -- 13.13.2 (1.2/2), K(237.1/2) A_Succ_Attribute, -- 3.5(22), K(238) A_Tag_Attribute, -- 3.9(16), 3.9(18), K(242), K(244) A_Terminated_Attribute, -- 9.9(3), K(246) A_Truncation_Attribute, -- A.5.3(42), K(248) An_Unbiased_Rounding_Attribute, -- A.5.3(39), K(252) An_Unchecked_Access_Attribute, -- 13.10(3), H.4(18), K(256) A_Val_Attribute, -- 3.5.5(5), K(258) A_Valid_Attribute, -- 13.9.2(3), H(6), K(262) A_Value_Attribute, -- 3.5(52), K(264) A_Version_Attribute, -- E.3(3), K(268) A_Wide_Image_Attribute, -- 3.5(28), K(270) A_Wide_Value_Attribute, -- 3.5(40), K(274) A_Wide_Wide_Image_Attribute, -- 3.5 (27.1/2), K(277.1/2) A_Wide_Wide_Value_Attribute, -- 3.5 (39.1/2), K(277.5/2) A_Wide_Wide_Width_Attribute, -- 3.5 (37.1/2), K(277.9/2) A_Wide_Width_Attribute, -- 3.5(38), K(278) A_Width_Attribute, -- 3.5(39), K(280) A_Write_Attribute, -- 13.13.2(3), 13.13.2(11), K(282), K(286) An_Implementation_Defined_Attribute, -- Reference Manual, Annex M An_Unknown_Attribute); -- Unknown to ASIS ------------------------------------------------------------------------------- -- 3.9.20 type Statement_Kinds ------------------------------------------------------------------------------- -- Statement_Kinds - classifications of Ada statements -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Statement_Kinds is ( Not_A_Statement, -- An unexpected element A_Null_Statement, -- 5.1 An_Assignment_Statement, -- 5.2 An_If_Statement, -- 5.3 A_Case_Statement, -- 5.4 A_Loop_Statement, -- 5.5 A_While_Loop_Statement, -- 5.5 A_For_Loop_Statement, -- 5.5 A_Block_Statement, -- 5.6 An_Exit_Statement, -- 5.7 A_Goto_Statement, -- 5.8 A_Procedure_Call_Statement, -- 6.4 A_Simple_Return_Statement, -- 6.5 An_Extended_Return_Statement, -- 6.5 An_Accept_Statement, -- 9.5.2 An_Entry_Call_Statement, -- 9.5.3 A_Requeue_Statement, -- 9.5.4 A_Requeue_Statement_With_Abort, -- 9.5.4 A_Delay_Until_Statement, -- 9.6 A_Delay_Relative_Statement, -- 9.6 A_Terminate_Alternative_Statement, -- 9.7.1 A_Selective_Accept_Statement, -- 9.7.1 A_Timed_Entry_Call_Statement, -- 9.7.2 A_Conditional_Entry_Call_Statement, -- 9.7.3 An_Asynchronous_Select_Statement, -- 9.7.4 An_Abort_Statement, -- 9.8 A_Raise_Statement, -- 11.3 A_Code_Statement); -- 13.8 A_Return_Statement : Statement_Kinds renames A_Simple_Return_Statement; -- For compatibility with a prior version of this Standard ------------------------------------------------------------------------------- -- 3.9.21 type Path_Kinds ------------------------------------------------------------------------------- -- -- A_Path elements represent execution path alternatives presented by the -- if_statement, case_statement, and the four forms of select_statement. -- Each statement path alternative encloses component elements that -- represent a sequence_of_statements. Some forms of A_Path elements also -- have as a component elements that represent a condition, an optional -- guard, or a discrete_choice_list. -- -- ASIS treats the select_alternative, entry_call_alternative, and -- triggering_alternative, as the syntactic equivalent of a -- sequence_of_statements. -- Specifically, the terminate_alternative (terminate;) -- is treated as the syntactical equivalent of a single statement and are -- represented as Statement_Kinds'A_Terminate_Alternative_Statement. -- This allows queries to directly provide the sequence_of_statements enclosed -- by A_Path elements, avoiding the extra step of returning an element -- representing such an alternative. -- -- For example, -- -- select -- A_Select_Path enclosing a sequence of two statements -- -- accept Next_Work_Item(WI : in Work_Item) do -- Current_Work_Item := WI; -- end; -- Process_Work_Item(Current_Work_Item); -- -- or -- An_Or_Path enclosing a guard and -- -- a sequence of two statements -- -- when Done_Early => -- accept Shut_Down; -- exit; -- -- or -- An_Or_Path enclosing a sequence with only a single statement -- -- terminate; -- -- end select; -- ------------------------------------------------------------------------------- -- Path_Kinds -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Path_Kinds is ( Not_A_Path, -- An unexpected element An_If_Path, -- 5.3: -- if condition then -- sequence_of_statements An_Elsif_Path, -- 5.3: -- elsif condition then -- sequence_of_statements An_Else_Path, -- 5.3, 9.7.1, 9.7.3: -- else sequence_of_statements A_Case_Path, -- 5.4: -- when discrete_choice_list => -- sequence_of_statements A_Select_Path, -- 9.7.1: -- select [guard] select_alternative -- 9.7.2, 9.7.3: -- select entry_call_alternative -- 9.7.4: -- select triggering_alternative An_Or_Path, -- 9.7.1: -- or [guard] select_alternative -- 9.7.2: -- or delay_alternative A_Then_Abort_Path); -- 9.7.4 -- then abort sequence_of_statements ------------------------------------------------------------------------------- -- 3.9.22 type Clause_Kinds ------------------------------------------------------------------------------- -- Clause_Kinds -- Literals -- Reference Manual -> Subordinate Kinds ------------------------------------------------------------------------------- type Clause_Kinds is ( Not_A_Clause, -- An unexpected element A_Use_Package_Clause, -- 8.4 A_Use_Type_Clause, -- 8.4 A_With_Clause, -- 10.1.2 A_Representation_Clause, -- 13.1 -> Representation_Clause_Kinds A_Component_Clause); -- 13.5.1 ------------------------------------------------------------------------------- -- 3.9.23 type Representation_Clause_Kinds ------------------------------------------------------------------------------- -- Representation_Clause_Kinds - varieties of representation clauses -- Literals -- Reference Manual ------------------------------------------------------------------------------- type Representation_Clause_Kinds is ( Not_A_Representation_Clause, -- An unexpected element An_Attribute_Definition_Clause, -- 13.3 An_Enumeration_Representation_Clause, -- 13.4 A_Record_Representation_Clause, -- 13.5.1 An_At_Clause); -- J.7 ------------------------------------------------------------------------------- -- 3.10 type Compilation_Unit ------------------------------------------------------------------------------- -- The Ada Compilation Unit abstraction: -- -- The text of a program is submitted to the compiler in one or more -- compilations. Each compilation is a succession of compilation units. -- -- Compilation units are composed of three distinct parts: -- -- a) A context clause. -- -- b) The declaration of a library_item or unit. -- -- c) Pragmas that apply to the compilation, of which the unit is a part. -- -- The context clause contains zero or more with clauses, use clauses, -- pragma elaborates, and possibly other pragmas. -- -- ASIS treats Pragmas that appear immediately after the context clause and -- before the subsequent declaration part as belonging to the context -- clause part. -- -- The declaration associated with a compilation unit is one of: a -- package, a procedure, a function, a generic, or a subunit for normal units. -- The associated declaration is a Nil_Element for An_Unknown_Unit and -- Nonexistent units. -- -- The abstract type Compilation_Unit is a handle for compilation units as a -- whole. An object of the type Compilation_Unit deals with the external view -- of compilation units such as their relationships with other units or their -- compilation attributes. -- -- Compilation_Unit shall be an undiscriminated private type. ------------------------------------------------------------------------------- type Compilation_Unit is private; Nil_Compilation_Unit : constant Compilation_Unit; function "=" (Left : in Compilation_Unit; Right : in Compilation_Unit) return Boolean is abstract; ------------------------------------------------------------------------------- -- 3.11 type Compilation_Unit_List ------------------------------------------------------------------------------- type Compilation_Unit_List is array (List_Index range <>) of Compilation_Unit; Nil_Compilation_Unit_List : constant Compilation_Unit_List; ------------------------------------------------------------------------------- -- 3.12 Unit Kinds ------------------------------------------------------------------------------- -- Unit Kinds are enumeration types describing the various kinds of units. -- These element kinds are only used by package Asis.Compilation_Units. ------------------------------------------------------------------------------- -- 3.12.1 type Unit_Kinds ------------------------------------------------------------------------------- -- Unit_Kinds - the varieties of compilation units of compilations, -- including compilations having no compilation units but consisting of -- configuration pragmas or comments. ------------------------------------------------------------------------------- type Unit_Kinds is ( Not_A_Unit, -- A Nil_Compilation_Unit A_Procedure, A_Function, A_Package, A_Generic_Procedure, A_Generic_Function, A_Generic_Package, A_Procedure_Instance, A_Function_Instance, A_Package_Instance, A_Procedure_Renaming, A_Function_Renaming, A_Package_Renaming, A_Generic_Procedure_Renaming, A_Generic_Function_Renaming, A_Generic_Package_Renaming, A_Procedure_Body, -- A unit interpreted only as the completion -- of a procedure, or a unit interpreted as -- both the declaration and body of a library -- procedure. Reference Manual 10.1.4(4) A_Function_Body, -- A unit interpreted only as the completion -- of a function, or a unit interpreted as -- both the declaration and body of a library -- function. Reference Manual 10.1.4(4) A_Package_Body, A_Procedure_Body_Subunit, A_Function_Body_Subunit, A_Package_Body_Subunit, A_Task_Body_Subunit, A_Protected_Body_Subunit, A_Nonexistent_Declaration, -- A unit that does not exist but is: -- 1) mentioned in a with clause of -- another unit or, -- 2) a required corresponding -- library_unit_declaration A_Nonexistent_Body, -- A unit that does not exist but is: -- 1) known to be a corresponding -- subunit or, -- 2) a required corresponding -- library_unit_body A_Configuration_Compilation, -- Corresponds to the whole content of a -- compilation with no compilation_unit, -- but possibly containing comments, -- configuration pragmas, or both. -- A Context is not limited to the number -- of units of A_Configuration_Compilation -- kind. A unit of -- A_Configuration_Compilation does not -- have a name. This unit -- represents configuration pragmas that -- are "in effect". The only interface -- that returns this unit kind is -- Enclosing_Compilation_Unit when given -- A_Pragma element obtained from -- Configuration_Pragmas. An_Unknown_Unit); -- An indeterminable or proprietary unit subtype A_Subprogram_Declaration is Unit_Kinds range A_Procedure .. A_Function; subtype A_Subprogram_Renaming is Unit_Kinds range A_Procedure_Renaming .. A_Function_Renaming; subtype A_Generic_Unit_Declaration is Unit_Kinds range A_Generic_Procedure .. A_Generic_Package; subtype A_Generic_Unit_Instance is Unit_Kinds range A_Procedure_Instance .. A_Package_Instance; subtype A_Subprogram_Body is Unit_Kinds range A_Procedure_Body .. A_Function_Body; subtype A_Library_Unit_Body is Unit_Kinds range A_Procedure_Body .. A_Package_Body; subtype A_Generic_Renaming is Unit_Kinds range A_Generic_Procedure_Renaming .. A_Generic_Package_Renaming; subtype A_Renaming is Unit_Kinds range A_Procedure_Renaming .. A_Generic_Package_Renaming; subtype A_Subunit is Unit_Kinds range A_Procedure_Body_Subunit .. A_Protected_Body_Subunit; ------------------------------------------------------------------------------- -- 3.12.2 type Unit_Classes ------------------------------------------------------------------------------- -- Unit_Classes - classification of public, private, body, and subunit. ------------------------------------------------------------------------------- type Unit_Classes is ( -- Reference Manual 10.1.1(12), 10.1.3 Not_A_Class, -- A nil, nonexistent, unknown, -- or configuration compilation unit class. A_Public_Declaration, -- library_unit_declaration or -- library_unit_renaming_declaration. A_Public_Body, -- library_unit_body interpreted only as a -- completion. Its declaration is public. A_Public_Declaration_And_Body, -- subprogram_body interpreted as both a -- declaration and body of a library -- subprogram - Reference Manual 10.1.4(4). A_Private_Declaration, -- private library_unit_declaration or -- private library_unit_renaming_declaration. A_Private_Body, -- library_unit_body interpreted only as a -- completion. Its declaration is private. A_Separate_Body); -- separate (parent_unit_name) proper_body. ------------------------------------------------------------------------------- -- 3.12.3 type Unit_Origins ------------------------------------------------------------------------------- -- Unit_Origins - classification of possible unit origination ------------------------------------------------------------------------------- type Unit_Origins is ( Not_An_Origin, -- A nil or nonexistent unit origin -- An_Unknown_Unit can be any origin A_Predefined_Unit, -- Ada predefined language environment units -- listed in Annex A(2). These include -- Standard and the three root library -- units: Ada, Interfaces, and System, -- and their descendants. i.e., Ada.Text_Io, -- Ada.Calendar, Interfaces.C, etc. An_Implementation_Unit, -- Implementation specific library units, -- e.g., runtime support packages, utility -- libraries, etc. It is not required -- that any implementation supplied units -- have this origin. This is a suggestion. -- Implementations might provide, for -- example, precompiled versions of public -- domain software that could have -- An_Application_Unit origin. An_Application_Unit); -- Neither A_Predefined_Unit or -- An_Implementation_Unit ------------------------------------------------------------------------------- -- 3.12.4 type Relation_Kinds ------------------------------------------------------------------------------- -- Relation_Kinds - classification of unit relationships type Relation_Kinds is ( Ancestors, Descendants, ------------------------------------------------------------------------------- -- Definition: ANCESTORS of a unit; DESCENDANTS of a unit -- -- Ancestors of a library unit are itself, its parent, its parent's -- parent, and so on. (Standard is an ancestor of every library unit). -- -- The Descendants relation is the inverse of the ancestor relation. -- Reference Manual 10.1.1(11). ------------------------------------------------------------------------------- Supporters, ------------------------------------------------------------------------------- -- Definition: SUPPORTERS of a unit -- -- Supporters of a compilation unit are units on which it semantically -- depends. Reference Manual 10.1.1(26). -- -- The Supporters relation is transitive; units that are supporters of library -- units mentioned in a with clause of a compilation unit are also supporters -- of that compilation unit. -- -- A parent declaration is a Supporter of its descendant units. -- -- Each library unit mentioned in the with clauses of a compilation unit -- is a Supporter of that compilation unit and (recursively) any -- completion, child units, or subunits that are included in the declarative -- region of that compilation unit. Reference Manual 8.1(7-10). -- -- A library_unit_body has as a Supporter, its corresponding -- library_unit_declaration, if any. -- -- The parent body of a subunit is a Supporter of the subunit. -- ------------------------------------------------------------------------------- Dependents, ------------------------------------------------------------------------------- -- Definition: DEPENDENTS of a unit -- -- Dependents of a compilation unit are all the compilation units that -- depend semantically on it. -- -- The Dependents relation is transitive; Dependents of a unit include the -- unit's Dependents, each dependent unit's Dependents, and so on. A unit -- that is a dependent of a compilation unit also is a dependent -- of the compilation unit's Supporters. -- -- Child units are Dependents of their ancestor units. -- -- A compilation unit that mentions other library units in its with -- clauses is one of the Dependents of those library units. -- -- A library_unit_body is a Dependent of its corresponding -- library_unit_declaration, if any. -- -- A subunit is a Dependent of its parent body. -- -- A compilation unit that contains an attribute_reference of a type defined -- in another compilation unit is a Dependent of the other unit. -- -- For example: -- -- If A withs B and B withs C -- then A directly depends on A, B directly depends on C, -- A indirectly depends on C, and -- both A and B are dependents of C. -- -- Dependencies between compilation units may also be introduced by -- inline inclusions (Reference Manual 10.1.4(7)) and for certain other -- compiler optimizations. These relations are intended to reflect all -- of these considerations. -- ------------------------------------------------------------------------------- Family, ------------------------------------------------------------------------------- -- Definition: FAMILY of a unit -- -- The family of a given unit is defined as the set of compilation -- units that comprise the given unit's declaration, body, descendants, -- and subunits (and subunits of subunits and descendants, etc.). ------------------------------------------------------------------------------- Needed_Units); ------------------------------------------------------------------------------- -- Definition: NEEDED UNITS of a unit; CLOSURE of a unit -- -- The needed units of a given unit is defined as the set of all -- the Ada units ultimately needed by that unit to form a partition. -- Reference Manual 10.2(2-7). -- -- The term closure is commonly used with similar meaning. -- -- For example: -- Assume the body of C has a subunit C.S and the declaration of C has -- child units C.Y and C.Z. -- -- If A withs B, B withs C, B withs C.Y, and C does not with a library -- unit. Then the needed units of A are: -- library unit declaration C -- child library unit declaration C.Y -- child library unit body C.Y, if any -- library unit body C -- subunit C.S -- library unit declaration B -- library unit body B, if any -- library unit declaration A -- library unit body A, if any -- -- Child unit C.Z is only part of the Needed_Units if it is needed. -- ------------------------------------------------------------------------------- -- 3.13 type Traverse_Control ------------------------------------------------------------------------------- -- Traverse_Control - controls for the traversal generic provided in package -- Asis.Iterator. It is defined in package Asis to facilitate automatic -- translation to IDL (See Annex C for details). ------------------------------------------------------------------------------- type Traverse_Control is ( Continue, -- Continues the normal depth-first traversal. Abandon_Children, -- Prevents traversal of the current element's -- children. Abandon_Siblings, -- Prevents traversal of the current element's -- children and remaining siblings. Terminate_Immediately); -- Does exactly that. ------------------------------------------------------------------------------- -- 3.14 type Program_Text ------------------------------------------------------------------------------- subtype Program_Text is Wide_String; ------------------------------------------------------------------------------- private -- Private part of this Unimplemented : exception; Internal_Error : exception; ------------------- -- Text_Position -- ------------------- type Text_Position is record Line : Natural := 0; Column : Natural := 0; end record; function "<" (Left, Right : Text_Position) return Boolean; function To_Wide_String (Item : Text_Position) return Wide_String; Nil_Text_Position : constant Text_Position := (0, 0); type Gela_String is record From, To : Source_Buffers.Cursor; end record; ----------------- -- Error_Level -- ----------------- type Error_Level is (Success, Warning, Error, Fatal); type Element_Access is access all Asis.Element; type Traverse_List_Item (Is_List : Boolean := False) is record case Is_List is when True => List : Asis.Element; when False => Item : Element_Access; end case; end record; type Traverse_List is array (Positive range <>) of Traverse_List_Item; function Without_Pragmas (List : Element_List) return Element_List; function Is_Equal (Left, Right : Element) return Boolean; pragma Inline (Is_Equal); procedure Raise_Inappropriate_Element (Raiser : Wide_String := ""); procedure Check_Context (The_Context : Asis.Context); procedure Check_Nil_Element (Element : Asis.Element; Raiser : Wide_String := ""); procedure Check_Nil_Unit (Unit : Asis.Compilation_Unit; Raiser : Wide_String := ""); ------------- -- Context -- ------------- type Context_Node is abstract tagged limited null record; type Context is access all Context_Node'Class; procedure Associate (The_Context : access Context_Node; Name : in Wide_String; Parameters : in Wide_String) is abstract; procedure Open (The_Context : in out Context_Node) is abstract; procedure Close (The_Context : in out Context_Node) is abstract; procedure Dissociate (The_Context : in out Context_Node) is abstract; function Is_Open (The_Context : Context_Node) return Boolean is abstract; function Is_Equal (Left : in Context_Node; Right : in Context_Node) return Boolean is abstract; function Has_Associations (The_Context : Context_Node) return Boolean is abstract; function Context_Name (The_Context : Context_Node) return Wide_String is abstract; function Parameters (The_Context : Context_Node) return Wide_String is abstract; function Debug_Image (The_Context : Context_Node) return Wide_String is abstract; function Configuration_Pragmas (The_Context : in Context_Node) return Asis.Pragma_Element_List is abstract; function Library_Unit_Declaration (Name : in Wide_String; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Compilation_Unit_Body (Name : in Wide_String; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Library_Unit_Declarations (The_Context : in Context_Node) return Asis.Compilation_Unit_List is abstract; function Compilation_Unit_Bodies (The_Context : in Context_Node) return Asis.Compilation_Unit_List is abstract; function Context_Compilation_Units (The_Context : in Context_Node) return Asis.Compilation_Unit_List is abstract; function Corresponding_Children (Library_Unit : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit_List is abstract; function Corresponding_Parent_Declaration (Library_Unit : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Declaration (Library_Item : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Body (Library_Item : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Subunits (Parent_Body : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit_List is abstract; function Corresponding_Subunit_Parent_Body (Subunit : in Asis.Compilation_Unit; The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Body (Declaration : in Asis.Declaration; The_Context : in Context_Node) return Asis.Declaration is abstract; function Corresponding_Body_Stub (Subunit : in Asis.Declaration; The_Context : in Context_Node) return Asis.Declaration is abstract; function Corresponding_Declaration (Declaration : in Asis.Declaration; The_Context : in Context_Node) return Asis.Declaration is abstract; function Corresponding_Subunit (Body_Stub : in Asis.Declaration; The_Context : in Context_Node) return Asis.Declaration is abstract; function Corresponding_Type_Declaration (Declaration : in Asis.Declaration; The_Context : in Context_Node) return Asis.Declaration is abstract; function Current_Unit (The_Context : in Context_Node) return Asis.Compilation_Unit is abstract; function Current_File (The_Context : in Context_Node) return Wide_String is abstract; function New_Compilation_Unit (The_Context : access Context_Node) return Asis.Compilation_Unit is abstract; procedure Report_Error (The_Context : in out Context_Node; The_Unit : in Compilation_Unit; Where : in Text_Position; Text : in Wide_String; Level : in Error_Level) is abstract; function Check_Appropriate (The_Context : in Context_Node) return Boolean is abstract; procedure Set_Check_Appropriate (The_Context : in out Context_Node; Value : in Boolean) is abstract; Nil_Context : constant Context := null; ------------ -- Cloner -- ------------ type Cloner is tagged limited null record; function Clone (Object : Cloner; Item : Element; Parent : Element) return Element; subtype Cloner_Class is Cloner'Class; function Deep_Copy (Cloner : in Cloner_Class; Source : in Element; Parent : in Element) return Element; function Copy (Cloner : in Cloner_Class; Source : in Element; Parent : in Element) return Element; ------------------ -- Element_Node -- ------------------ type Element_Node; type Element is access all Element_Node'Class; for Element'Storage_Size use 0; type Element_Node_Ptr is access all Element_Node'Class; for Element_Node_Ptr'Storage_Size use 0; type Element_Node is abstract tagged limited record Next : Element; end record; procedure Set_Next_Element (Item : in out Element_Node; Next : in Element); function Children (Item : access Element_Node) return Traverse_List; function Is_List (Item : Element_Node) return Boolean; function Clone (Item : Element_Node; Parent : Element) return Element is abstract; procedure Copy (Source : in Element; Target : access Element_Node; Cloner : in Cloner_Class; Parent : in Element); function Aborted_Tasks (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Accept_Body_Exception_Handlers (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Accept_Body_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Accept_Entry_Direct_Name (Element : Element_Node) return Asis.Name; function Accept_Entry_Index (Element : Element_Node) return Asis.Expression; function Accept_Parameters (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Access_To_Function_Result_Subtype (Element : Element_Node) return Asis.Definition; function Get_Access_To_Object_Definition (Element : Element_Node) return Asis.Subtype_Indication; function Access_To_Subprogram_Parameter_Profile (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Access_Type_Kind (Element : Element_Node) return Asis.Access_Type_Kinds; function Actual_Parameter (Element : Element_Node) return Asis.Expression; function Allocator_Qualified_Expression (Element : Element_Node) return Asis.Expression; function Allocator_Subtype_Indication (Element : Element_Node) return Asis.Subtype_Indication; function Ancestor_Subtype_Indication (Element : Element_Node) return Asis.Subtype_Indication; function Anonymous_Access_To_Object_Subtype_Mark (Element : Element_Node) return Asis.Name; function Array_Component_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Array_Component_Choices (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Array_Component_Definition (Element : Element_Node) return Asis.Component_Definition; function Assignment_Expression (Element : Element_Node) return Asis.Expression; function Assignment_Variable_Name (Element : Element_Node) return Asis.Expression; function Attribute_Designator_Expressions (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Attribute_Designator_Identifier (Element : Element_Node) return Asis.Expression; function Attribute_Kind (Element : Element_Node) return Asis.Attribute_Kinds; function Block_Declarative_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Block_Exception_Handlers (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Block_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Body_Declarative_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Body_Exception_Handlers (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Body_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Call_Statement_Parameters (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Called_Name (Element : Element_Node) return Asis.Expression; function Case_Expression (Element : Element_Node) return Asis.Expression; function Case_Statement_Alternative_Choices (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Choice_Parameter_Specification (Element : Element_Node) return Asis.Element; function Clause_Names (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Component_Clause_Position (Element : Element_Node) return Asis.Expression; function Component_Clause_Range (Element : Element_Node) return Asis.Discrete_Range; function Component_Clauses (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Component_Expression (Element : Element_Node) return Asis.Expression; function Component_Subtype_Indication (Element : Element_Node) return Asis.Subtype_Indication; function Condition_Expression (Element : Element_Node) return Asis.Expression; function Converted_Or_Qualified_Expression (Element : Element_Node) return Asis.Expression; function Converted_Or_Qualified_Subtype_Mark (Element : Element_Node) return Asis.Expression; function Corresponding_Base_Entity (Element : Element_Node) return Asis.Expression; function Corresponding_Body (Element : Element_Node) return Asis.Declaration; function Corresponding_Body_Stub (Element : Element_Node) return Asis.Declaration; function Corresponding_Called_Entity (Element : Element_Node) return Asis.Declaration; function Corresponding_Called_Function (Element : Element_Node) return Asis.Declaration; function Corresponding_Constant_Declaration (Element : Element_Node) return Asis.Element; function Corresponding_Declaration (Element : Element_Node) return Asis.Declaration; function Corresponding_Destination_Statement (Element : Element_Node) return Asis.Statement; function Corresponding_Entry (Element : Element_Node) return Asis.Declaration; function Corresponding_Equality_Operator (Element : Element_Node) return Asis.Declaration; function Corresponding_Expression_Type (Element : Element_Node) return Asis.Element; function Corresponding_First_Subtype (Element : Element_Node) return Asis.Declaration; function Corresponding_Generic_Element (Element : Element_Node) return Asis.Defining_Name; function Corresponding_Last_Constraint (Element : Element_Node) return Asis.Declaration; function Corresponding_Last_Subtype (Element : Element_Node) return Asis.Declaration; function Corresponding_Loop_Exited (Element : Element_Node) return Asis.Statement; function Corresponding_Name_Declaration (Element : Element_Node) return Asis.Declaration; function Corresponding_Name_Definition_List (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Corresponding_Parent_Subtype (Element : Element_Node) return Asis.Declaration; function Corresponding_Pragmas (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Corresponding_Representation_Clauses (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Corresponding_Root_Type (Element : Element_Node) return Asis.Declaration; function Corresponding_Subprogram_Derivation (Element : Element_Node) return Asis.Declaration; function Corresponding_Subunit (Element : Element_Node) return Asis.Declaration; function Corresponding_Type (Element : Element_Node) return Asis.Type_Definition; function Corresponding_Type_Declaration (Element : Element_Node) return Asis.Declaration; function Corresponding_Type_Operators (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Corresponding_Type_Structure (Element : Element_Node) return Asis.Declaration; function Declaration_Origin (Element : Element_Node) return Asis.Declaration_Origins; function Default_Kind (Element : Element_Node) return Asis.Subprogram_Default_Kinds; function Defining_Name_Image (Element : Element_Node) return Wide_String; function Defining_Prefix (Element : Element_Node) return Asis.Name; function Defining_Selector (Element : Element_Node) return Asis.Defining_Name; function Delay_Expression (Element : Element_Node) return Asis.Expression; function Delta_Expression (Element : Element_Node) return Asis.Expression; function Digits_Expression (Element : Element_Node) return Asis.Expression; function Discrete_Ranges (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Discrete_Subtype_Definitions (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Discriminant_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Discriminant_Direct_Name (Element : Element_Node) return Asis.Name; function Discriminant_Expression (Element : Element_Node) return Asis.Expression; function Discriminant_Part (Element : Element_Node) return Asis.Definition; function Discriminant_Selector_Name (Element : Element_Node) return Asis.Expression; function Discriminant_Selector_Names (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Discriminants (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Enclosing_Compilation_Unit (Element : Element_Node) return Asis.Compilation_Unit; function Enclosing_Element (Element : Element_Node) return Asis.Element; function End_Position (Element : Element_Node) return Asis.Text_Position; function Entry_Barrier (Element : Element_Node) return Asis.Expression; function Entry_Family_Definition (Element : Element_Node) return Asis.Discrete_Subtype_Definition; function Entry_Index_Specification (Element : Element_Node) return Asis.Declaration; function Enumeration_Literal_Declarations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Exception_Choices (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Exception_Handlers (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Exit_Condition (Element : Element_Node) return Asis.Expression; function Exit_Loop_Name (Element : Element_Node) return Asis.Expression; function Expression_Parenthesized (Element : Element_Node) return Asis.Expression; function Extended_Return_Exception_Handlers (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Extended_Return_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Extension_Aggregate_Expression (Element : Element_Node) return Asis.Expression; function Formal_Parameter (Element : Element_Node) return Asis.Identifier; function Formal_Subprogram_Default (Element : Element_Node) return Asis.Expression; function Function_Call_Parameters (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Generic_Actual_Part (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Generic_Formal_Part (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Generic_Unit_Name (Element : Element_Node) return Asis.Expression; function Goto_Label (Element : Element_Node) return Asis.Expression; function Guard (Element : Element_Node) return Asis.Expression; function Handler_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Has_Abstract (Element : Element_Node) return Boolean; function Has_Limited (Element : Element_Node) return Boolean; function Has_Null_Exclusion (Element : Element_Node) return Boolean; function Has_Private (Element : Element_Node) return Boolean; function Has_Protected (Element : Element_Node) return Boolean; function Has_Synchronized (Element : Element_Node) return Boolean; function Has_Tagged (Element : Element_Node) return Boolean; function Has_Task (Element : Element_Node) return Boolean; function Hash (Element : Element_Node) return Asis.ASIS_Integer; function Implicit_Components (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Implicit_Inherited_Declarations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Implicit_Inherited_Subprograms (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Index_Expressions (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Index_Subtype_Definitions (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Initialization_Expression (Element : Element_Node) return Asis.Expression; function Integer_Constraint (Element : Element_Node) return Asis.Range_Constraint; function Interface_Kind (Element : Element_Node) return Asis.Interface_Kinds; function Is_Call_On_Dispatching_Operation (Element : Element_Node) return Boolean; function Is_Declare_Block (Element : Element_Node) return Boolean; function Is_Defaulted_Association (Element : Element_Node) return Boolean; function Is_Dispatching_Call (Element : Element_Node) return Boolean; function Is_Dispatching_Operation (Element : Element_Node) return Boolean; function Is_Name_Repeated (Element : Element_Node) return Boolean; function Is_Normalized (Element : Element_Node) return Boolean; function Is_Null_Procedure (Element : Element_Node) return Boolean; function Is_Part_Of_Implicit (Element : Element_Node) return Boolean; function Is_Part_Of_Inherited (Element : Element_Node) return Boolean; function Is_Part_Of_Instance (Element : Element_Node) return Boolean; function Is_Prefix_Call (Element : Element_Node) return Boolean; function Is_Private_Present (Element : Element_Node) return Boolean; function Is_Task_Definition_Present (Element : Element_Node) return Boolean; function Label_Names (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Loop_Parameter_Specification (Element : Element_Node) return Asis.Declaration; function Loop_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Lower_Bound (Element : Element_Node) return Asis.Expression; function Membership_Test_Expression (Element : Element_Node) return Asis.Expression; function Membership_Test_Range (Element : Element_Node) return Asis.Range_Constraint; function Membership_Test_Subtype_Mark (Element : Element_Node) return Asis.Expression; function Mod_Clause_Expression (Element : Element_Node) return Asis.Expression; function Mod_Static_Expression (Element : Element_Node) return Asis.Expression; function Mode_Kind (Element : Element_Node) return Asis.Mode_Kinds; function Name_Image (Element : Element_Node) return Wide_String; function Names (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Next_Element (Element : Element_Node) return Asis.Element; function Normalized_Call_Statement_Parameters (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Normalized_Discriminant_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Normalized_Function_Call_Parameters (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Normalized_Generic_Actual_Part (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Normalized_Record_Component_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Object_Declaration_Subtype (Element : Element_Node) return Asis.Definition; function Operator_Kind (Element : Element_Node) return Asis.Operator_Kinds; function Overriding_Indicator_Kind (Element : Element_Node) return Asis.Overriding_Indicator_Kinds; function Parameter_Profile (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Parent_Subtype_Indication (Element : Element_Node) return Asis.Subtype_Indication; function Position_Number_Image (Element : Element_Node) return Wide_String; function Pragma_Argument_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Pragma_Kind (Element : Element_Node) return Asis.Pragma_Kinds; function Pragma_Name_Image (Element : Element_Node) return Wide_String; function Pragmas (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Prefix (Element : Element_Node) return Asis.Expression; function Private_Part_Declarative_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Private_Part_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Profile (Element : Element_Node) return Asis.Element; function Progenitor_List (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Protected_Operation_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Qualified_Expression (Element : Element_Node) return Asis.Expression; function Raise_Statement_Message (Element : Element_Node) return Asis.Expression; function Raised_Exception (Element : Element_Node) return Asis.Expression; function Range_Attribute (Element : Element_Node) return Asis.Expression; function Raw_Image (Element : Element_Node) return Gela_String; function Real_Range_Constraint (Element : Element_Node) return Asis.Range_Constraint; function Record_Component_Associations (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Record_Component_Choice (Element : Element_Node) return Asis.Defining_Name; function Record_Component_Choices (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Record_Components (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Get_Record_Definition (Element : Element_Node) return Asis.Definition; function References (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Renamed_Entity (Element : Element_Node) return Asis.Expression; function Representation_Clause_Expression (Element : Element_Node) return Asis.Expression; function Representation_Clause_Name (Element : Element_Node) return Asis.Name; function Representation_Value_Image (Element : Element_Node) return Wide_String; function Requeue_Entry_Name (Element : Element_Node) return Asis.Name; function Result_Subtype (Element : Element_Node) return Asis.Definition; function Return_Expression (Element : Element_Node) return Asis.Expression; function Return_Object_Specification (Element : Element_Node) return Asis.Declaration; function Root_Type_Kind (Element : Element_Node) return Asis.Root_Type_Kinds; function Selector (Element : Element_Node) return Asis.Expression; function Sequence_Of_Statements (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Short_Circuit_Operation_Left_Expression (Element : Element_Node) return Asis.Expression; function Short_Circuit_Operation_Right_Expression (Element : Element_Node) return Asis.Expression; function Slice_Range (Element : Element_Node) return Asis.Discrete_Range; function Specification_Subtype_Definition (Element : Element_Node) return Asis.Discrete_Subtype_Definition; function Start_Position (Element : Element_Node) return Asis.Text_Position; function Statement_Identifier (Element : Element_Node) return Asis.Defining_Name; function Statement_Paths (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Subtype_Constraint (Element : Element_Node) return Asis.Constraint; function Get_Subtype_Mark (Element : Element_Node) return Asis.Expression; function Trait_Kind (Element : Element_Node) return Asis.Trait_Kinds; function Type_Declaration_View (Element : Element_Node) return Asis.Definition; function Upper_Bound (Element : Element_Node) return Asis.Expression; function Value_Image (Element : Element_Node) return Wide_String; function Variant_Choices (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Variants (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Visible_Part_Declarative_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function Visible_Part_Items (Element : Element_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List; function While_Condition (Element : Element_Node) return Asis.Expression; function Access_Definition_Kind (Element : Element_Node) return Asis.Access_Definition_Kinds; function Association_Kind (Element : Element_Node) return Asis.Association_Kinds; function Clause_Kind (Element : Element_Node) return Asis.Clause_Kinds; function Constraint_Kind (Element : Element_Node) return Asis.Constraint_Kinds; function Declaration_Kind (Element : Element_Node) return Asis.Declaration_Kinds; function Defining_Name_Kind (Element : Element_Node) return Asis.Defining_Name_Kinds; function Definition_Kind (Element : Element_Node) return Asis.Definition_Kinds; function Discrete_Range_Kind (Element : Element_Node) return Asis.Discrete_Range_Kinds; function Element_Kind (Element : Element_Node) return Asis.Element_Kinds; function Expression_Kind (Element : Element_Node) return Asis.Expression_Kinds; function Formal_Type_Definition_Kind (Element : Element_Node) return Asis.Formal_Type_Kinds; function Path_Kind (Element : Element_Node) return Asis.Path_Kinds; function Representation_Clause_Kind (Element : Element_Node) return Asis.Representation_Clause_Kinds; function Statement_Kind (Element : Element_Node) return Asis.Statement_Kinds; function Type_Definition_Kind (Element : Element_Node) return Asis.Type_Kinds; Nil_Element : constant Element := null; Nil_Element_List : constant Element_List (1 .. 0) := (1 .. 0 => null); ---------------------- -- Compilation_Unit -- ---------------------- type Compilation_Unit_Node is abstract new Element_Node with null record; type Compilation_Unit is access all Compilation_Unit_Node'Class; for Compilation_Unit'Storage_Size use 0; function Can_Be_Main_Program (Element : Compilation_Unit_Node) return Boolean is abstract; function Compilation_Command_Line_Options (Element : Compilation_Unit_Node) return Wide_String is abstract; function Compilation_Pragmas (Element : Compilation_Unit_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is abstract; function Context_Clause_Elements (Element : Compilation_Unit_Node; Include_Pragmas : in Boolean := False) return Asis.Element_List is abstract; function Corresponding_Body (Element : Compilation_Unit_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Children (Element : Compilation_Unit_Node) return Asis.Compilation_Unit_List is abstract; function Corresponding_Declaration (Element : Compilation_Unit_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Parent_Declaration (Element : Compilation_Unit_Node) return Asis.Compilation_Unit is abstract; function Corresponding_Subunit_Parent_Body (Element : Compilation_Unit_Node) return Asis.Compilation_Unit is abstract; function Enclosing_Context (Element : Compilation_Unit_Node) return Asis.Context is abstract; function End_Position (Element : Compilation_Unit_Node) return Asis.Text_Position is abstract; function Hash (Element : Compilation_Unit_Node) return Asis.ASIS_Integer is abstract; function Is_Body_Required (Element : Compilation_Unit_Node) return Boolean is abstract; function Next_Element (Element : Compilation_Unit_Node) return Asis.Element is abstract; function Object_Form (Element : Compilation_Unit_Node) return Wide_String is abstract; function Object_Name (Element : Compilation_Unit_Node) return Wide_String is abstract; function Separate_Name_Image (Element : Compilation_Unit_Node) return Wide_String is abstract; function Start_Position (Element : Compilation_Unit_Node) return Asis.Text_Position is abstract; function Subunits (Element : Compilation_Unit_Node) return Asis.Compilation_Unit_List is abstract; function Text_Form (Element : Compilation_Unit_Node) return Wide_String is abstract; function Text_Name (Element : Compilation_Unit_Node) return Wide_String is abstract; function Unique_Name (Element : Compilation_Unit_Node) return Wide_String is abstract; function Unit_Class (Element : Compilation_Unit_Node) return Asis.Unit_Classes is abstract; function Unit_Declaration (Element : Compilation_Unit_Node) return Asis.Element is abstract; function Unit_Full_Name (Element : Compilation_Unit_Node) return Wide_String is abstract; function Unit_Kind (Element : Compilation_Unit_Node) return Asis.Unit_Kinds is abstract; function Unit_Origin (Element : Compilation_Unit_Node) return Asis.Unit_Origins is abstract; Nil_Compilation_Unit : constant Compilation_Unit := null; Nil_Compilation_Unit_List : constant Compilation_Unit_List (1 .. 0) := (1 .. 0 => null); function Assigned (Item : in Context) return Boolean; function Assigned (Item : in Compilation_Unit) return Boolean; function Assigned (Item : in Element) return Boolean; pragma Inline (Assigned); end Asis; ------------------------------------------------------------------------------ -- Copyright (c) 2006-2013, <NAME> -- All rights reserved. -- -- Redistribution and use in source and binary forms, with or without -- modification, are permitted provided that the following conditions are met: -- -- * Redistributions of source code must retain the above copyright notice, -- this list of conditions and the following disclaimer. -- * Redistributions in binary form must reproduce the above copyright -- notice, this list of conditions and the following disclaimer in the -- documentation and/or other materials provided with the distribution. -- * Neither the name of the <NAME>, IE nor the names of its -- contributors may be used to endorse or promote products derived from -- this software without specific prior written permission. -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -- POSSIBILITY OF SUCH DAMAGE. ------------------------------------------------------------------------------
pkgs/tools/yasm/src/libyasm/tests/opt-circular2-err.asm
manggoguy/parsec-modified
2,151
4542
<filename>pkgs/tools/yasm/src/libyasm/tests/opt-circular2-err.asm times (label-$+1) db 0 label: db 'NOW where am I?'
src/gnat/fname.ads
My-Colaborations/dynamo
15
1381
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- F N A M E -- -- -- -- S p e c -- -- -- -- Copyright (C) 1992-2014, 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. -- -- -- ------------------------------------------------------------------------------ -- This package, together with its child package Fname.UF define the -- association between source file names and unit names as defined -- (see package Uname for definition of format of unit names). with Namet; use Namet; package Fname is -- Note: this package spec does not depend on the Uname spec in the Ada -- sense, but the comments and description of the semantics do depend on -- the conventions established by Uname. --------------------------- -- File Name Conventions -- --------------------------- -- GNAT requires that there be a one to one correspondence between source -- file names (as used in the Osint package interface) and unit names as -- defined by the Uname package. This correspondence is defined by the -- two subprograms defined here in the Fname package. -- For full rules of file naming, see GNAT User's Guide. Note that the -- naming rules are affected by the presence of Source_File_Name pragmas -- that have been previously processed. -- Note that the file name does *not* include the directory name. The -- management of directories is provided by Osint, and full file names -- are used only for error message purposes within GNAT itself. ----------------- -- Subprograms -- ----------------- function Is_Predefined_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean; -- This function determines if the given file name (which must be a simple -- file name with no directory information) is the file name for one of the -- predefined library units (i.e. part of the Ada, System, or Interface -- hierarchies). Note that units in the GNAT hierarchy are not considered -- predefined (see Is_Internal_File_Name below). On return, Name_Buffer -- contains the file name. The Renamings_Included parameter indicates -- whether annex J renamings such as Text_IO are to be considered as -- predefined. If Renamings_Included is True, then Text_IO will return -- True, otherwise only children of Ada, Interfaces and System return True. function Is_Predefined_File_Name (Renamings_Included : Boolean := True) return Boolean; -- This version is called with the file name already in Name_Buffer function Is_Internal_File_Name (Fname : File_Name_Type; Renamings_Included : Boolean := True) return Boolean; -- Similar to Is_Predefined_File_Name. The internal file set is a superset -- of the predefined file set including children of GNAT. procedure Tree_Read; -- Dummy procedure (reads dummy table values from tree file) procedure Tree_Write; -- Writes out internal tables to current tree file using Tree_Write -- This is actually a dummy routine, since the relevant table is -- no longer used, but we retain it for now, to avoid a tree file -- incompatibility with the 3.13 compiler. Should be removed for -- the 3.14a release ??? end Fname;
other.7z/SFC.7z/SFC/ソースデータ/ヨッシーアイランド/日本_Ver1/sfc/ys_w48.asm
prismotizm/gigaleak
0
245049
<reponame>prismotizm/gigaleak Name: ys_w48.asm Type: file Size: 26780 Last-Modified: '2016-05-13T04:51:15Z' SHA-1: 35D6FA96CBE4A48AEB8640FEA97AE91568735771 Description: null
Agda/Copattern.agda
Brethland/LEARNING-STUFF
2
2305
<gh_stars>1-10 {-# OPTIONS --copattern --safe --no-sized-types --guardedness #-} module Copattern where open import Data.Nat open import Relation.Binary.PropositionalEquality record Stream (A : Set) : Set where coinductive field head : A tail : Stream A open Stream public -- | Bisimulation as equality record _==_ {A : Set} (x : Stream A) (y : Stream A) : Set where coinductive field refl-head : head x ≡ head y refl-tail : tail x == tail y open _==_ public module Introduction where ones : Stream ℕ head ones = suc zero tail ones = ones repeat : {A : Set} -> A -> Stream A repeat {A} a = P where P : Stream A head P = a tail P = repeat a even : ∀ {A} -> Stream A -> Stream A even {A} a = P where P : Stream A head P = head a tail P = even (tail (tail a)) odd : ∀ {A} -> Stream A -> Stream A odd {A} a = P where P : Stream A head P = head (tail a) tail P = odd (tail (tail a)) module Bisimulation where open Introduction refl′ : ∀ {A} -> (a : Stream A) -> a == a refl′ a = f where f : a == a refl-head f = refl refl-tail f = refl′ (tail a) oddEven : ∀ {A} -> (a : Stream A) -> odd a == even (tail a) oddEven a = f where f : odd a == even (tail a) refl-head f = refl refl-tail f = oddEven ((tail (tail a))) module Merge where open Bisimulation open Introduction merge : ∀ {A} -> Stream A -> Stream A -> Stream A merge {A} a b = ma where ma : Stream A head ma = head a tail ma = merge b (tail a) -- Merge! Even! Odd! moe : ∀ {A} -> (a : Stream A) -> (merge (even a) (odd a) == a) moe a = f where f : merge (even a) (odd a) == a refl-head f = refl refl-head (refl-tail f) = refl refl-tail (refl-tail f) = moe (tail (tail a))
tools/spt-generator/src/com/ibm/ai4code/parser/c_multi/C11_lexer_common.g4
yingkitw/Project_CodeNet
1,156
5684
/* [The "BSD licence"] Copyright (c) 2013 <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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. */ /* Partially extracted from the original C.g4. - added recognition of $ as a NonDigit in Identifier - better line continuation handling - fixed bugs in pre-processor directives Copyright (c) 2020 International Business Machines Corporation Prepared by: <NAME> <<EMAIL>> */ /** C 2011 grammar built from the C11 Spec */ lexer grammar C11_lexer_common; // always imported; name does not really matter // (GCC) Extension keywords: Extension__ : '__extension__'; Builtin_va_arg: '__builtin_va_arg'; Builtin_offsetof: '__builtin_offsetof'; M128: '__m128'; M128d: '__m128d'; M128i: '__m128i'; Typeof__: '__typeof__'; Inline__: '__inline__'; Stdcall: '__stdcall'; Declspec: '__declspec'; Attribute__: '__attribute__'; Asm: '__asm'; Asm__: '__asm__'; Volatile__: '__volatile__'; //A.1.2 Keywords AUTO: 'auto'; BREAK: 'break'; CASE: 'case'; CHAR: 'char'; CONST: 'const'; CONTINUE: 'continue'; DEFAULT: 'default'; DO: 'do'; DOUBLE: 'double'; ELSE: 'else'; ENUM: 'enum'; EXTERN: 'extern'; FLOAT: 'float'; FOR: 'for'; GOTO: 'goto'; IF: 'if'; INLINE: 'inline'; INT: 'int'; LONG: 'long'; REGISTER: 'register'; RESTRICT: 'restrict'; RETURN: 'return'; SHORT: 'short'; SIGNED: 'signed'; SIZEOF: 'sizeof'; STATIC: 'static'; STRUCT: 'struct'; SWITCH: 'switch'; TYPEDEF: 'typedef'; UNION: 'union'; UNSIGNED: 'unsigned'; VOID: 'void'; VOLATILE: 'volatile'; WHILE: 'while'; ALIGNAS: '_Alignas'; ALIGNOF: '_Alignof'; ATOMIC: '_Atomic'; BOOL: '_Bool'; COMPLEX: '_Complex'; GENERIC: '_Generic'; IMAGINARY: '_Imaginary'; NORETURN: '_Noreturn'; STATIC_ASSERT: '_Static_assert'; THREAD_LOCAL: '_Thread_local'; //A.1.3 Identifiers Identifier : IdentifierNondigit ( IdentifierNondigit | Digit )* ; fragment IdentifierNondigit : Nondigit | UniversalCharacterName //| // other implementation-defined characters... ; // GJ20: extend to allow $ fragment Nondigit : [a-zA-Z_$] ; fragment Digit : [0-9] ; fragment UniversalCharacterName : '\\u' HexQuad | '\\U' HexQuad HexQuad ; fragment HexQuad : HexadecimalDigit HexadecimalDigit HexadecimalDigit HexadecimalDigit ; //A.1.5 Constants // rule for Constant moved to parser; constituents unfragmented. /* Constant : IntegerConstant | FloatingConstant //| EnumerationConstant | CharacterConstant ; */ IntegerConstant : DecimalConstant IntegerSuffix? | OctalConstant IntegerSuffix? | HexadecimalConstant IntegerSuffix? | BinaryConstant ; fragment BinaryConstant : '0' [bB] [0-1]+ ; fragment DecimalConstant : NonzeroDigit Digit* ; fragment OctalConstant : '0' OctalDigit* ; fragment HexadecimalConstant : HexadecimalPrefix HexadecimalDigit+ ; fragment HexadecimalPrefix : '0' [xX] ; fragment NonzeroDigit : [1-9] ; fragment OctalDigit : [0-7] ; fragment HexadecimalDigit : [0-9a-fA-F] ; fragment IntegerSuffix : UnsignedSuffix LongSuffix? | UnsignedSuffix LongLongSuffix | LongSuffix UnsignedSuffix? | LongLongSuffix UnsignedSuffix? ; fragment UnsignedSuffix : [uU] ; fragment LongSuffix : [lL] ; fragment LongLongSuffix : 'll' | 'LL' ; FloatingConstant : DecimalFloatingConstant | HexadecimalFloatingConstant ; fragment DecimalFloatingConstant : FractionalConstant ExponentPart? FloatingSuffix? | DigitSequence ExponentPart FloatingSuffix? ; fragment HexadecimalFloatingConstant : HexadecimalPrefix HexadecimalFractionalConstant BinaryExponentPart FloatingSuffix? | HexadecimalPrefix HexadecimalDigitSequence BinaryExponentPart FloatingSuffix? ; fragment FractionalConstant : DigitSequence? '.' DigitSequence | DigitSequence '.' ; fragment ExponentPart : 'e' Sign? DigitSequence | 'E' Sign? DigitSequence ; fragment Sign : '+' | '-' ; DigitSequence : Digit+ ; fragment HexadecimalFractionalConstant : HexadecimalDigitSequence? '.' HexadecimalDigitSequence | HexadecimalDigitSequence '.' ; fragment BinaryExponentPart : 'p' Sign? DigitSequence | 'P' Sign? DigitSequence ; fragment HexadecimalDigitSequence : HexadecimalDigit+ ; fragment FloatingSuffix : 'f' | 'l' | 'F' | 'L' ; CharacterConstant : '\'' CCharSequence '\'' | 'L\'' CCharSequence '\'' | 'u\'' CCharSequence '\'' | 'U\'' CCharSequence '\'' ; fragment CCharSequence : CChar+ ; fragment CChar : ~['\\\r\n] // GJ20: approximation | EscapeSequence ; fragment EscapeSequence : SimpleEscapeSequence | OctalEscapeSequence | HexadecimalEscapeSequence | UniversalCharacterName ; // GJ20: allow any character to be escaped fragment SimpleEscapeSequence // : '\\' ['"?abfnrtv\\] : '\\' . ; fragment OctalEscapeSequence : '\\' OctalDigit | '\\' OctalDigit OctalDigit | '\\' OctalDigit OctalDigit OctalDigit ; fragment HexadecimalEscapeSequence : '\\x' HexadecimalDigit+ ; //A.1.6 StringLiteral : EncodingPrefix? '"' SCharSequence? '"' ; fragment EncodingPrefix : 'u8' | 'u' | 'U' | 'L' ; fragment SCharSequence : SChar+ ; // GJ20: Handling of \ Newline is incorrect, but works somewhat. fragment SChar : ~["\\\r\n] // GJ20: approximation | EscapeSequence | EscapeNewline ; //A.1.7 Punctuators // Operator and punctuation: // Enclosing brackets: LeftParen: '('; RightParen: ')'; LeftBracket: '['; RightBracket: ']'; LeftBrace: '{'; RightBrace: '}'; // Preprocessor-related symbols: HashMark: '#'; HashMarkHashMark: '##'; // Alternatives: LessColon: '<:'; // alt [ ColonGreater: ':>'; // alt ] LessPercent: '<%'; // alt { PrecentGreater: '%>'; // alt } PrecentColon: '%:'; // alt # PercentColonPercentColon: '%:%:'; // alt ## // Punctuators: Semi: ';'; Colon: ':'; Ellipsis: '...'; Comma: ','; Dot: '.'; // Operators: Question: '?'; Plus: '+'; Minus: '-'; Star: '*'; Div: '/'; Mod: '%'; Caret: '^'; And: '&'; Or: '|'; Tilde: '~'; Not: '!'; Assign: '='; Less: '<'; Greater: '>'; PlusAssign: '+='; MinusAssign: '-='; StarAssign: '*='; DivAssign: '/='; ModAssign: '%='; XorAssign: '^='; AndAssign: '&='; OrAssign: '|='; LeftShift: '<<'; RightShift: '>>'; RightShiftAssign: '>>='; LeftShiftAssign: '<<='; Equal: '=='; NotEqual: '!='; LessEqual: '<='; GreaterEqual: '>='; AndAnd: '&&'; OrOr: '||'; PlusPlus: '++'; MinusMinus: '--'; Arrow: '->'; // GJ20: completely bogus; will skip everything till next # /* ComplexDefine : '#' Whitespace? 'define' ~[#]* -> skip ; */ // GJ20: covered by Directive; see below. /* IncludeDirective : '#' Whitespace? 'include' Whitespace? (('"' ~[\n"]+ '"') | ('<' ~[\n>]+ '>' )) -> skip ; */ // ignore the following asm blocks: /* asm { mfspr x, 286; } */ AsmBlock : 'asm' ~'{'* '{' ~'}'* '}' -> skip ; // GJ20: covered by Directive; see below. // ignore the lines generated by c preprocessor // sample line: '#line 1 "/home/dm/files/dk1.h" 1' /* LineAfterPreprocessing : '#line' Whitespace* ~[\r\n]* -> skip ; */ // GJ20: covered by Directive; see below. /* LineDirective : '#' Whitespace? DecimalConstant Whitespace? StringLiteral ~[\r\n]* -> skip ; */ // GJ20: covered by Directive; see below. /* PragmaDirective : '#' Whitespace? 'pragma' Whitespace ~[\r\n]* -> skip ; */ // GJ20: every preprocessor directive is treated a line comment. Directive: '#' (~[\\\r\n]* EscapeNewline)* ~[\r\n]* -> channel(HIDDEN); // GJ20: added vertical tab \v (^K) and formfeed \f (^L) Whitespace : [ \t\u000B\f]+ -> skip ; Newline : ( '\r' '\n'? | '\n' ) -> skip ; // GJ20: this will create logical lines. EscapeNewline : '\\' Newline -> skip ; // GJ20: anticipate \ Newline BlockComment : '/*' .*? '*/' -> channel(HIDDEN) ; // GJ20: anticipate \ Newline LineComment : '//' (~[\\\r\n]* EscapeNewline)* ~[\r\n]* -> channel(HIDDEN) ;
3-mid/opengl/source/lean/renderer/opengl-impostorer.adb
charlie5/lace
20
24183
with openGL.Camera, openGL.Impostor.simple, openGL.Impostor.terrain, ada.Containers.generic_Array_sort, ada.unchecked_Deallocation; package body openGL.Impostorer is --------- --- Forge -- procedure define (Self : in out Item) is begin Self.impostor_size_Min.Value_is (0.0625); end define; procedure destruct (Self : in out Item) is procedure deallocate is new ada.unchecked_Deallocation (impostor_load_Balancer.Slots, impostor_load_Balancer.Slots_view); begin deallocate (Self.impostor_load_Slots); declare use Impostor, visual_Maps_of_impostor; the_Impostor : Impostor.view; Cursor : visual_Maps_of_impostor.Cursor := Self.visual_Map_of_imposter.First; begin while has_Element (Cursor) loop the_Impostor := Element (Cursor); Self.Renderer.free (the_Impostor); next (Cursor); end loop; end; end destruct; -------------- --- Attributes -- function impostor_Count (Self : in Item) return Natural is begin return Natural (Self.visual_Map_of_imposter.Length); end impostor_Count; function impostor_size_Min (Self : in Item'Class) return Real is begin return Self.impostor_size_Min.Value; end impostor_size_Min; procedure impostor_size_Min_is (Self : in out Item'Class; Now : in Real) is begin Self.impostor_size_Min.Value_is (Now); end impostor_size_Min_is; function Camera (Self : in Item'Class) return access openGL.Camera.item'Class is begin return Self.Camera; end Camera; procedure Camera_is (Self : in out Item'Class; Now : access openGL.Camera.item'Class) is begin Self.Camera := Camera_view (Now); end Camera_is; function Renderer (Self : in Item'Class) return openGL.Renderer.lean.view is begin return openGL.Renderer.lean.view (Self.Renderer); end Renderer; procedure Renderer_is (Self : in out Item'Class; Now : in openGL.Renderer.lean.view) is begin Self.Renderer := Renderer_view (Now); end Renderer_is; -------------- -- Operations -- procedure substitute (Self : in out Item; the_Visuals : in out openGL.Visual.views; Camera : access openGL.Camera.item'Class) is begin -- Find whether visual or imposter is used, for each object. -- declare transposed_camera_Attitude : constant Matrix_3x3 := Transpose (Camera.Spin); Impostor_updates : openGL.Renderer.lean.impostor_Updates (1 .. 20_000); impostor_updates_Last : Natural := 0; procedure add (the_Impostor : in Impostor.view) is begin impostor_updates_Last := impostor_updates_Last + 1; Impostor_updates (impostor_updates_Last) := (Impostor => the_Impostor, current_Width_pixels => the_Impostor.current_Width_pixels, current_Height_pixels => the_Impostor.current_Height_pixels, current_copy_x_Offset => the_Impostor.current_copy_X_Offset, current_copy_y_Offset => the_Impostor.current_copy_Y_Offset, current_copy_X => the_Impostor.current_copy_X, current_copy_Y => the_Impostor.current_copy_Y, current_copy_Width => the_Impostor.current_copy_Width, current_copy_Height => the_Impostor.current_copy_Height, current_Camera_look_at_Rotation => the_Impostor.current_Camera_look_at_Rotation); the_Impostor.freshen_Count := 0; the_Impostor.never_Updated := False; end add; the_impostor_size_Min : constant Real := Self.impostor_size_Min.Value; begin for Each in Self.impostor_load_Slots'Range loop Self.impostor_load_Slots (Each).impostors_Count := 0; -- Empty each slot's contents. end loop; for i in the_Visuals'Range loop declare the_Visual : Visual .view renames the_Visuals (i); the_Impostor : Impostor.view; begin -- Replace the visual with the impostors visual, if the visuals apparent size is small enough. -- if the_Visual.apparent_Size < the_impostor_size_Min then -- Use impostor. -- Find or create the impostor for the visual. -- declare use visual_Maps_of_impostor; begin the_Impostor := Self.visual_Map_of_imposter.Element (the_Visual); exception when constraint_Error => -- No impostor exists for this visual yet, so create one. if the_Visual.is_Terrain then the_Impostor := new Impostor.terrain.item; else the_Impostor := new Impostor.simple.item; the_Impostor.set_size_update_trigger_Delta (to => 10); the_Impostor.set_freshen_count_update_trigger_Mod (to => 250); end if; the_Impostor.set_Target (the_Visual); Self.visual_Map_of_imposter.insert (the_Visual, the_Impostor); end; declare use Visual; impostor_Target : Visual.view renames the_Visual; Impostor_update_required : constant Boolean := the_Impostor.update_Required (Camera); Impostor_is_valid : constant Boolean := the_Impostor.is_Valid; Impostor_never_updated : constant Boolean := the_Impostor.never_Updated; begin if Impostor_is_valid then if Impostor_update_required then the_Impostor.target_camera_Distance_less_frame_Count := the_Impostor.target_camera_Distance - Real (the_Impostor.frame_Count_since_last_update); if Impostor_never_updated then add (the_Impostor); else declare -- Add impostor to appropriate load balancing slot. target_face_Count : constant Positive := impostor_Target.face_Count; function Slot_Id return Positive is begin for Each in Self.impostor_load_Slots'Range loop if target_face_Count <= Self.impostor_load_Slots (Each).max_Faces then return Each; end if; end loop; raise Program_Error; end Slot_Id; the_Slot : impostor_load_Balancer.Slot renames Self.impostor_load_Slots (Slot_Id); begin the_Slot.impostors_Count := the_Slot.impostors_Count + 1; the_Slot.Impostors (the_Slot.impostors_Count) := the_Impostor; end; end if; end if; the_Impostor.Visual.Site_is (Site_of (the_Visual.all)); the_Impostor.Visual.Spin_is (transposed_camera_Attitude); the_Visuals (i) := the_Impostor.Visual; -- Replace the visual with the impostor. end if; end; else -- Don't use impostor. null; end if; end; end loop; -- Add the load balanced impostor updates. -- for i in Self.impostor_load_Slots'Range loop declare the_Slot : impostor_load_Balancer.Slot renames Self.impostor_load_Slots (i); num_Updates : constant Natural := Natural'Min (the_Slot.max_Updates, the_Slot.impostors_Count); function "<" (Left, Right : in Impostor.view) return Boolean is begin return Left .target_camera_Distance_less_frame_Count -- Subtracting 'frame count' allows distant targets a chance of < Right.target_camera_Distance_less_frame_Count; -- update. (TODO: Need some sort of user-settable scale parameter end "<"; -- to allow for very large scales such as space). procedure sort is new ada.Containers.generic_Array_sort (Positive, Impostor.view, Impostor.views); begin sort (the_Slot.Impostors (1 .. the_Slot.impostors_Count)); for Each in 1 .. num_Updates loop add (the_Slot.Impostors (Each)); end loop; end; end loop; Self.Renderer.queue_Impostor_updates (Impostor_updates (1 .. impostor_updates_Last), Camera); end; end substitute; end openGL.Impostorer;
oeis/117/A117968.asm
neoneye/loda-programs
11
23112
<filename>oeis/117/A117968.asm<gh_stars>10-100 ; A117968: Negative part of inverse of A117966; write -n in balanced ternary and then replace (-1)'s with 2's. ; Submitted by <NAME> ; 2,7,6,8,22,21,23,19,18,20,25,24,26,67,66,68,64,63,65,70,69,71,58,57,59,55,54,56,61,60,62,76,75,77,73,72,74,79,78,80,202,201,203,199,198,200,205,204,206,193,192,194,190,189,191,196,195,197,211,210,212,208,207,209,214,213,215,175,174,176,172,171,173,178,177,179,166,165,167,163,162,164,169,168,170,184,183,185,181,180,182,187,186,188,229,228,230,226,225,227 mov $1,$0 add $0,1 mov $2,3 lpb $0 mov $3,$0 add $0,1 div $0,3 add $3,$0 mod $3,2 mul $3,$2 add $1,$3 mul $2,3 lpe mov $0,$1 sub $0,3 div $0,2 add $0,2
programs/oeis/010/A010914.asm
jmorken/loda
1
89293
<filename>programs/oeis/010/A010914.asm ; A010914: Pisot sequence E(5,17), a(n) = floor(a(n-1)^2 / a(n-2) + 1/2). ; 5,17,58,198,676,2308,7880,26904,91856,313616,1070752,3655776,12481600,42614848,145496192,496755072,1696027904,5790601472,19770350080,67500197376,230460089344,786839962624,2686439671808,9172078761984,31315435704320,106917585293312,365039469764608,1246322708471808,4255211894358016 mov $1,5 mov $2,2 lpb $0 sub $0,1 add $2,$1 mul $1,2 add $1,$2 lpe
alloy4fun_models/trashltl/models/4/YxR5GzJfGKbg8Jee2.als
Kaixi26/org.alloytools.alloy
0
220
<filename>alloy4fun_models/trashltl/models/4/YxR5GzJfGKbg8Jee2.als open main pred idYxR5GzJfGKbg8Jee2_prop5 { some f : File | eventually f not in File } pred __repair { idYxR5GzJfGKbg8Jee2_prop5 } check __repair { idYxR5GzJfGKbg8Jee2_prop5 <=> prop5o }
src/Categories/Functor/Power.agda
MirceaS/agda-categories
0
2725
{-# OPTIONS --without-K --safe #-} open import Categories.Category -- Power Functors, Exponentials over a Category C -- Mainly categories where the objects are functions (Fin n -> Obj) considered pointwise -- and then upgraded to Functors. module Categories.Functor.Power {o ℓ e} (C : Category o ℓ e) where open Category C open HomReasoning open import Level using (Level; _⊔_) open import Data.Nat using (ℕ; _+_; zero; suc; _<_) open import Data.Product using (_,_) open import Data.Fin using (Fin; inject+; raise; zero; suc; fromℕ<) open import Data.Sum using (_⊎_; inj₁; inj₂; map) renaming ([_,_] to ⟦_,_⟧; [_,_]′ to ⟦_,_⟧′) open import Data.Vec.N-ary hiding (curryⁿ) open import Function as Fun using (flip; _$_) renaming (_∘_ to _∙_; id to idf) open import Categories.Category.Product using (Product; _⁂_) open import Categories.Functor hiding (id) open import Categories.Functor.Bifunctor using (Bifunctor; overlap-×) private variable i j k : Level I I′ J J′ : Set i D E : Category i j k n n′ m m′ : ℕ Exp : Set i → Category _ _ _ Exp I = record { Obj = I → Obj ; _⇒_ = λ x y → ∀ i → x i ⇒ y i ; _≈_ = λ f g → ∀ i → f i ≈ g i ; id = λ _ → id ; _∘_ = λ f g i → f i ∘ g i ; assoc = λ _ → assoc ; sym-assoc = λ _ → sym-assoc ; identityˡ = λ _ → identityˡ ; identityʳ = λ _ → identityʳ ; identity² = λ _ → identity² ; equiv = record { refl = λ _ → refl ; sym = λ eq i → sym $ eq i ; trans = λ eq₁ eq₂ i → trans (eq₁ i) (eq₂ i) } ; ∘-resp-≈ = λ eq₁ eq₂ i → ∘-resp-≈ (eq₁ i) (eq₂ i) } Power : (n : ℕ) → Category o ℓ e Power n = Exp (Fin n) -- Convention: the ′ version is for a general index set, unprimed for a ℕ -- representing Fin n. So Powerfunctor D n is Exp C (Fin n) ⇒ D, i.e. -- essentially C ^ n ⇒ D. Powerfunctor′ : (D : Category o ℓ e) (I : Set i) → Set (i ⊔ e ⊔ ℓ ⊔ o) Powerfunctor′ D I = Functor (Exp I) D Powerfunctor : (D : Category o ℓ e) (n : ℕ) → Set (e ⊔ ℓ ⊔ o) Powerfunctor D n = Powerfunctor′ D (Fin n) -- With C = D, so Powerendo n is C ^ n => C Powerendo′ : (I : Set i) → Set (i ⊔ e ⊔ ℓ ⊔ o) Powerendo′ I = Powerfunctor′ C I Powerendo : (n : ℕ) → Set (e ⊔ ℓ ⊔ o) Powerendo n = Powerfunctor C n -- Hyperendo n m is C ^ n ⇒ C ^ m Hyperendo : (n m : ℕ) → Set (e ⊔ ℓ ⊔ o) Hyperendo n m = Functor (Power n) (Power m) -- Hyperendo′ I J is C ^ I → C ^ J Hyperendo′ : (I : Set i) (J : Set j) → Set (i ⊔ j ⊔ e ⊔ ℓ ⊔ o) Hyperendo′ I J = Functor (Exp I) (Exp J) -- Parallel composition of Hyperendo′ (via disjoint union of index sets) infixr 9 _par_ _par_ : (F : Hyperendo′ I I′) (G : Hyperendo′ J J′) → Hyperendo′ (I ⊎ J) (I′ ⊎ J′) F par G = record { F₀ = λ xs → ⟦ F.F₀ (xs ∙ inj₁) , G.F₀ (xs ∙ inj₂) ⟧′ ; F₁ = λ fs → ⟦ F.F₁ (fs ∙ inj₁) , G.F₁ (fs ∙ inj₂) ⟧ ; identity = ⟦ F.identity , G.identity ⟧ ; homomorphism = ⟦ F.homomorphism , G.homomorphism ⟧ ; F-resp-≈ = λ fs≈gs → ⟦ F.F-resp-≈ (fs≈gs ∙ inj₁) , G.F-resp-≈ (fs≈gs ∙ inj₂) ⟧ } where module F = Functor F module G = Functor G -- "flattening" means going from a general disjoint union of Fin to a single Fin, -- which has the effect of doing from Powerfunctor′ to Powerfunctor flattenP : (F : Powerfunctor′ D (Fin n ⊎ Fin m)) → Powerfunctor D (n + m) flattenP {n = n} {m = m} F = record { F₀ = λ As → F₀ (As ∙ pack) ; F₁ = λ fs → F₁ (fs ∙ pack) ; identity = identity ; homomorphism = homomorphism ; F-resp-≈ = λ fs≈gs → F-resp-≈ (fs≈gs ∙ pack) } where open Functor F pack = ⟦ inject+ m , raise n ⟧′ -- TODO unpackFun (and pack above) should be in stdlib private unpackFin : ∀ n → Fin (n + m) → Fin n ⊎ Fin m unpackFin zero f = inj₂ f unpackFin (suc n) zero = inj₁ zero unpackFin (suc n) (suc f) = map suc idf (unpackFin n f) -- needs a better name? unflattenP : Powerfunctor D (n + m) → Powerfunctor′ D (Fin n ⊎ Fin m) unflattenP {n = n} {m = m} F = record { F₀ = λ As → F₀ (As ∙ unpackFin _) ; F₁ = λ fs → F₁ (fs ∙ unpackFin _) ; identity = identity ; homomorphism = homomorphism ; F-resp-≈ = λ fs≈gs → F-resp-≈ (fs≈gs ∙ unpackFin _) } where open Functor F -- flatten a Hyperendo′ "on the right" when over a union of Fin flattenHʳ : (F : Hyperendo′ I (Fin n ⊎ Fin m)) → Hyperendo′ I (Fin (n + m)) flattenHʳ {n = n} {m = m} F = record { F₀ = λ As → F₀ As ∙ unpackFin n ; F₁ = λ fs → F₁ fs ∙ unpackFin n ; identity = identity ∙ unpackFin n ; homomorphism = homomorphism ∙ unpackFin n ; F-resp-≈ = λ fs≈gs → F-resp-≈ fs≈gs ∙ unpackFin n } where open Functor F -- flatten on both sides. flattenH : (F : Hyperendo′ (Fin n ⊎ Fin m) (Fin n′ ⊎ Fin m′)) → Hyperendo (n + m) (n′ + m′) flattenH = flattenHʳ ∙ flattenP -- Pretty syntax for flattening of parallel composition of Hyperendo infixr 9 _∥_ _∥_ : (F : Hyperendo n n′) (G : Hyperendo m m′) → Hyperendo (n + m) (n′ + m′) F ∥ G = flattenH (F par G) -- split is C ^ (I ⊎ J) to C ^ I × C ^ J, as a Functor split : Functor (Exp (I ⊎ J)) (Product (Exp I) (Exp J)) split = record { F₀ = λ As → As ∙ inj₁ , As ∙ inj₂ ; F₁ = λ fs → fs ∙ inj₁ , fs ∙ inj₂ ; identity = (λ _ → refl) , λ _ → refl ; homomorphism = (λ _ → refl) , λ _ → refl ; F-resp-≈ = λ eq → (λ i → eq (inj₁ i)) , λ i → eq (inj₂ i) } reduce′ : (H : Bifunctor C C C) (F : Powerendo′ I) (G : Powerendo′ J) → Powerendo′ (I ⊎ J) reduce′ H F G = H ∘F (F ⁂ G) ∘F split reduce : ∀ (H : Bifunctor C C C) {n m} (F : Powerendo n) (G : Powerendo m) → Powerendo (n + m) reduce H F G = flattenP $ reduce′ H F G flattenP-assocʳ : ∀ {n₁ n₂ n₃} (F : Powerendo′ (Fin n₁ ⊎ Fin n₂ ⊎ Fin n₃)) → Powerendo (n₁ + n₂ + n₃) flattenP-assocʳ {n₁} {n₂} {n₃} F = record { F₀ = λ As → F.F₀ (As ∙ pack) ; F₁ = λ fs → F.F₁ (fs ∙ pack) ; identity = F.identity ; homomorphism = F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ (fs≈gs ∙ pack) } where module F = Functor F pack = ⟦ inject+ n₃ ∙ inject+ n₂ , ⟦ inject+ n₃ ∙ raise n₁ , raise (n₁ + n₂) ⟧′ ⟧′ reduce2ʳ : ∀ (G : Bifunctor C C C) {n₁ n₂ n₃} (F₁ : Powerendo n₁) (F₂ : Powerendo n₂) (F₃ : Powerendo n₃) → Powerendo ((n₁ + n₂) + n₃) reduce2ʳ G F₁ F₂ F₃ = flattenP-assocʳ $ reduce′ G F₁ $ reduce′ G F₂ F₃ overlaps : (H : Bifunctor D D E) (F G : Powerfunctor′ D I) → Powerfunctor′ E I overlaps = overlap-× overlap2ʳ : (G : Bifunctor C C C) (F₁ F₂ F₃ : Powerendo n) → Powerendo n overlap2ʳ G F₁ F₂ F₃ = overlaps G F₁ (overlaps G F₂ F₃) -- select′ i always evaluates at i select′ : (i : I) → Powerendo′ I select′ i = record { F₀ = _$ i ; F₁ = _$ i ; identity = refl ; homomorphism = refl ; F-resp-≈ = _$ i } -- select (m < n) is really select′ (Fin n), but only for m < n select : m < n → Powerendo n select m<n = select′ (fromℕ< m<n) triv : (n : ℕ) → Hyperendo n n triv n = record { F₀ = idf ; F₁ = idf ; identity = λ _ → refl ; homomorphism = λ _ → refl ; F-resp-≈ = idf } -- pad a Hyperendo on the left and right by trivial (i.e. identity) endofunctors pad : ∀ (l r : ℕ) (F : Hyperendo n m) → Hyperendo ((l + n) + r) ((l + m) + r) pad l r F = (triv l ∥ F) ∥ triv r padˡ : ∀ (l : ℕ) (F : Hyperendo n m) → Hyperendo (l + n) (l + m) padˡ l F = triv l ∥ F padʳ : ∀ (r : ℕ) (F : Hyperendo n m) → Hyperendo (n + r) (m + r) padʳ r F = F ∥ triv r unary : Endofunctor C → Powerendo 1 unary F = record { F₀ = λ As → F.F₀ (As zero) ; F₁ = λ fs → F.F₁ (fs zero) ; identity = F.identity ; homomorphism = F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ (fs≈gs zero) } where module F = Functor F unaryH : Endofunctor C → Hyperendo 1 1 unaryH F = record { F₀ = λ As → F.F₀ ∙ As ; F₁ = λ fs → F.F₁ ∙ fs ; identity = λ _ → F.identity ; homomorphism = λ _ → F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ ∙ fs≈gs } where module F = Functor F -- "constant" nullary : Obj → Powerendo 0 nullary X = record { F₀ = λ _ → X ; F₁ = λ _ → id ; identity = refl ; homomorphism = sym identity² ; F-resp-≈ = λ _ → refl } nullaryH : Obj → Hyperendo 0 1 nullaryH X = record { F₀ = λ _ _ → X ; F₁ = λ _ _ → id ; identity = λ _ → refl ; homomorphism = λ _ → sym identity² ; F-resp-≈ = λ _ _ → refl } binary : Bifunctor C C C → Powerendo 2 binary F = record { F₀ = λ As → F.F₀ (As zero , As (suc zero)) ; F₁ = λ fs → F.F₁ (fs zero , fs (suc zero)) ; identity = F.identity ; homomorphism = F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ (fs≈gs zero , fs≈gs (suc zero)) } where module F = Functor F binaryH : Bifunctor C C C → Hyperendo 2 1 binaryH F = record { F₀ = λ As _ → F.F₀ (As zero , As (suc zero)) ; F₁ = λ fs _ → F.F₁ (fs zero , fs (suc zero)) ; identity = λ _ → F.identity ; homomorphism = λ _ → F.homomorphism ; F-resp-≈ = λ fs≈gs _ → F.F-resp-≈ (fs≈gs zero , fs≈gs (suc zero)) } where module F = Functor F hyp : Powerendo n → Hyperendo n 1 hyp F = record { F₀ = λ As _ → F.F₀ As ; F₁ = λ fs _ → F.F₁ fs ; identity = λ _ → F.identity ; homomorphism = λ _ → F.homomorphism ; F-resp-≈ = λ fs≈gs _ → F.F-resp-≈ fs≈gs } where module F = Functor F private curryⁿ : ∀ n {a b} {A : Set a} {B : Set b} → ((Fin n → A) → B) → N-ary n A B curryⁿ zero f = f (λ ()) curryⁿ (suc n) {A = A} f = λ x → curryⁿ n (f ∙ addon x) where addon : A → (Fin n → A) → Fin (suc n) → A addon x _ zero = x addon _ g (suc i) = g i plex′ : (J → Powerendo′ I) → Hyperendo′ I J plex′ Fs = record { F₀ = flip (Functor.F₀ ∙ Fs) ; F₁ = flip (λ j → Functor.F₁ (Fs j)) ; identity = λ j → Functor.identity (Fs j) ; homomorphism = λ j → Functor.homomorphism (Fs j) ; F-resp-≈ = flip (λ j → Functor.F-resp-≈ (Fs j)) } plex : N-ary n (Powerendo′ I) (Hyperendo′ I (Fin n)) plex {n = n} = curryⁿ n plex′ -- like pad, but for Powerendo -- on left or right. widenˡ : ∀ (l : ℕ) (F : Powerendo n) → Powerendo (l + n) widenˡ l F = record { F₀ = λ As → F.F₀ (As ∙ pack) ; F₁ = λ {As Bs} fs → F.F₁ (fs ∙ pack) ; identity = F.identity ; homomorphism = F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ (fs≈gs ∙ pack) } where module F = Functor F pack = raise l widenʳ : ∀ (r : ℕ) (F : Powerendo n) → Powerendo (n + r) widenʳ r F = record { F₀ = λ As → F.F₀ (As ∙ pack) ; F₁ = λ fs → F.F₁ (fs ∙ pack) ; identity = F.identity ; homomorphism = F.homomorphism ; F-resp-≈ = λ fs≈gs → F.F-resp-≈ (fs≈gs ∙ pack) } where module F = Functor F pack = inject+ r
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_9_1809.asm
ljhsiun2/medusa
9
178776
<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r12 push %r9 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_UC_ht+0xa881, %rsi lea addresses_WC_ht+0xe0c1, %rdi nop nop xor %r12, %r12 mov $51, %rcx rep movsl nop nop dec %rdx lea addresses_UC_ht+0x10ac1, %rsi lea addresses_UC_ht+0xae41, %rdi nop nop sub $34873, %r9 mov $61, %rcx rep movsw cmp $32166, %r12 lea addresses_normal_ht+0xb411, %rsi nop nop and $44952, %rax mov $0x6162636465666768, %rdx movq %rdx, %xmm7 and $0xffffffffffffffc0, %rsi movaps %xmm7, (%rsi) nop nop nop nop cmp $4429, %rdi pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r9 pop %r12 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %rbp push %rcx push %rdi push %rsi // REPMOV lea addresses_A+0x80c1, %rsi mov $0x22de980000000d71, %rdi nop nop add %r12, %r12 mov $30, %rcx rep movsw nop nop add %rsi, %rsi // Store lea addresses_normal+0x1c4c1, %rcx nop nop nop nop add $49708, %rbp mov $0x5152535455565758, %r12 movq %r12, %xmm6 movups %xmm6, (%rcx) nop nop nop nop nop dec %r10 // Faulty Load lea addresses_normal+0x6cc1, %rbp nop cmp $40745, %r12 mov (%rbp), %rsi lea oracles, %r11 and $0xff, %rsi shlq $12, %rsi mov (%r11,%rsi,1), %rsi pop %rsi pop %rdi pop %rcx pop %rbp pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 16, 'same': False, 'NT': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A', 'congruent': 4, 'same': False}, 'dst': {'type': 'addresses_NC', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 10, 'size': 16, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 6, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'AVXalign': True, 'congruent': 3, 'size': 16, 'same': False, 'NT': False}} {'34': 9} 34 34 34 34 34 34 34 34 34 */
src/crew-inventory.ads
thindil/steamsky
80
13909
-- Copyright 2017-2021 <NAME> -- -- This file is part of Steam Sky. -- -- Steam Sky is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Steam Sky is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Steam Sky. If not, see <http://www.gnu.org/licenses/>. with Ships; use Ships; -- ****h* Crew/Inventory -- FUNCTION -- Provide code for manipulate player ship crew members inventory -- SOURCE package Crew.Inventory is -- **** -- ****f* Inventory/Inventory.UpdateInventory -- FUNCTION -- Update member inventory -- PARAMETERS -- MemberIndex - Crew index of member which will be have updated the -- inventory -- Amount - Amount of items to add or delete from inventory -- ProtoIndex - Prototype index of item to add or delete. Can be -- empty if InventoryIndex is set -- Durability - Durability of item to add or delete from inventory -- InventoryIndex - Item index in crew member inventory. Can be empty if -- ProtoIndex is set -- Price - Price of the item -- SOURCE procedure UpdateInventory (MemberIndex: Positive; Amount: Integer; ProtoIndex: Unbounded_String := Null_Unbounded_String; Durability: Items_Durability := 0; InventoryIndex, Price: Natural := 0) with Pre => (MemberIndex <= Player_Ship.Crew.Last_Index and InventoryIndex <= Player_Ship.Crew(MemberIndex).Inventory.Last_Index), Test_Case => (Name => "Test_UpdateInventory", Mode => Nominal); -- **** -- ****f* Inventory/Inventory.FreeInventory -- FUNCTION -- Return available space in crew member inventory after adding or -- extracting Amount -- PARAMETERS -- MemberIndex - Crew index of the member which inventory will be checked -- Amount - Amount of kilogram to add or remove during check -- RESULT -- Amount of available space in kilograms -- SOURCE function FreeInventory (MemberIndex: Positive; Amount: Integer) return Integer with Pre => MemberIndex <= Player_Ship.Crew.Last_Index, Test_Case => (Name => "Test_FreeInventory", Mode => Nominal); -- **** -- ****f* Inventory/Inventory.TakeOffItem -- FUNCTION -- Remove selected item from character equipment -- PARAMETERS -- MemberIndex - Crew index of the member from which item willl be taken -- off -- ItemIndex - Inventory index of item to take off -- SOURCE procedure TakeOffItem(MemberIndex, ItemIndex: Positive) with Pre => (MemberIndex <= Player_Ship.Crew.Last_Index and ItemIndex <= Player_Ship.Crew(MemberIndex).Inventory.Last_Index), Test_Case => (Name => "Test_TakeOffItem", Mode => Nominal); -- **** -- ****f* Inventory/Inventory.ItemIsUsed -- FUNCTION -- Check if selected crew member use this item -- PARAMETERS -- MemberIndex - Crew index of the member which will be checked -- ItemIndex - Iventory index of the item which will be checked -- SOURCE function ItemIsUsed(MemberIndex, ItemIndex: Positive) return Boolean with Pre => (MemberIndex <= Player_Ship.Crew.Last_Index and ItemIndex <= Player_Ship.Crew(MemberIndex).Inventory.Last_Index), Test_Case => (Name => "Test_ItemIsUsed", Mode => Nominal); -- **** -- ****f* Inventory/Inventory.FindTools -- FUNCTION -- Search for specified tools in character and ship cargo -- PARAMETERS -- MemberIndex - Crew index of the member which will be checked -- ItemType - Type of item which will be looking for -- Order - Order which crew member will be doing when he/she find -- proper tool -- ToolQuality - Minimal quality of tool to find. Default value is 100 -- RESULT -- Selected crew member inventory index of the tool or 0 if tool was not -- found -- SOURCE function FindTools (MemberIndex: Positive; ItemType: Unbounded_String; Order: Crew_Orders; ToolQuality: Positive := 100) return Natural with Pre => (MemberIndex <= Player_Ship.Crew.Last_Index and ItemType /= Null_Unbounded_String), Test_Case => (Name => "Test_FindTools", Mode => Nominal); -- **** end Crew.Inventory;
lab02/ex02/SuffixCalculator.g4
BlasphemyCoder/Compilers
3
1092
/* * grammar to identify and compute the result of mathematical expressions in Reverse Polish Notation */ grammar SuffixCalculator; program: stat* EOF; /* * code to identify a new entry each new entry can either be an expression or an empty line if it is * an expression, its result is presented */ stat: expr NEWLINE { System.out.println("Result: " + $expr.res); } | NEWLINE; /* * code to identify the possible expression definitions it also computes its value */ expr returns[double res=0.0]: e1 = expr e2 = expr op = ('*' | '/' | '+' | '-') { switch ($op.text) { case "+": $res = $e1.res + $e2.res; break; case "-": $res = $e1.res - $e2.res; break; case "*": $res = $e1.res * $e2.res; break; case "/": if ($e2.res == 0) { System.err.println("Division by 0 not possible"); System.exit(1); } $res = $e1.res / $e2.res; break; } } | Number { $res = Double.parseDouble($Number.text); }; Number: [0-9]+ ('.' [0-9]+)?; NEWLINE: '\r'? '\n'; WS: [ \t]+ -> skip;
programs/oeis/027/A027943.asm
karttu/loda
1
102307
; A027943: a(n) = T(2*n+1, n+3), T given by A027935. ; 1,22,155,709,2587,8273,24416,68595,187030,500950,1327986,3499982,9195035,24115804,63192397,165512723,433410661,1134800215,2971089810,7778591025,20364830496,53316076892,139583609940,365435000524,956721681957,2504730383698,6557469861231,17167679651985,44945569613215,117669029779725,308061520399156,806515532180127,2111485077001370,5527939699790994 mul $0,2 cal $0,53739 ; Partial sums of A014166. mov $1,$0
programs/oeis/064/A064806.asm
neoneye/loda
22
15690
; A064806: a(n) = n + digital root of n. ; 2,4,6,8,10,12,14,16,18,11,13,15,17,19,21,23,25,27,20,22,24,26,28,30,32,34,36,29,31,33,35,37,39,41,43,45,38,40,42,44,46,48,50,52,54,47,49,51,53,55,57,59,61,63,56,58,60,62,64,66,68,70,72,65,67,69,71,73,75,77,79,81,74,76,78,80,82,84,86,88,90,83,85,87,89,91,93,95,97,99,92,94,96,98,100,102,104,106,108,101 mov $1,$0 mod $0,9 add $0,$1 add $0,2
source/zcx/s-unbase.adb
ytomino/drake
33
9171
<filename>source/zcx/s-unbase.adb -- for ZCX pragma Check_Policy (Trace => Ignore); with C.unwind; separate (System.Unwind.Backtrace) package body Separated is pragma Suppress (All_Checks); type Data is record Item : not null access Tracebacks_Array; Last : Natural; Exclude_Min : Address; Exclude_Max : Address; end record; pragma Suppress_Initialization (Data); function Unwind_Trace ( Context : access C.unwind.struct_Unwind_Context; Argument : C.void_ptr) return C.unwind.Unwind_Reason_Code with Convention => C; function Unwind_Trace ( Context : access C.unwind.struct_Unwind_Context; Argument : C.void_ptr) return C.unwind.Unwind_Reason_Code is pragma Check (Trace, Ada.Debug.Put ("enter")); D : Data; for D'Address use Address (Argument); IP : constant Address := System'To_Address (C.unwind.Unwind_GetIP (Context)); begin if IP >= D.Exclude_Min and then IP <= D.Exclude_Max then D.Last := Tracebacks_Array'First - 1; -- reset pragma Check (Trace, Ada.Debug.Put ("exclude")); else D.Last := D.Last + 1; D.Item (D.Last) := IP; pragma Check (Trace, Ada.Debug.Put ("fill")); if D.Last >= Tracebacks_Array'Last then pragma Check (Trace, Ada.Debug.Put ("leave, over")); return C.unwind.URC_NORMAL_STOP; end if; end if; pragma Check (Trace, Ada.Debug.Put ("leave")); return C.unwind.URC_NO_REASON; end Unwind_Trace; procedure Backtrace ( Item : aliased out Tracebacks_Array; Last : out Natural; Exclude_Min : Address; Exclude_Max : Address) is D : aliased Data := ( Item'Unchecked_Access, Tracebacks_Array'First - 1, Exclude_Min, Exclude_Max); Dummy : C.unwind.Unwind_Reason_Code; begin pragma Check (Trace, Ada.Debug.Put ("start")); Dummy := C.unwind.Unwind_Backtrace ( Unwind_Trace'Access, C.void_ptr (D'Address)); pragma Check (Trace, Ada.Debug.Put ("end")); Last := D.Last; end Backtrace; end Separated;
fiat-amd64/33.71_ratio16752_seed267833281830466_square_poly1305.asm
dderjoel/fiat-crypto
491
162048
<reponame>dderjoel/fiat-crypto SECTION .text GLOBAL square_poly1305 square_poly1305: sub rsp, 0x30 ; last 0x30 (6) for Caller - save regs mov [ rsp + 0x0 ], rbx; saving to stack mov [ rsp + 0x8 ], rbp; saving to stack mov [ rsp + 0x10 ], r12; saving to stack mov [ rsp + 0x18 ], r13; saving to stack mov [ rsp + 0x20 ], r14; saving to stack mov [ rsp + 0x28 ], r15; saving to stack imul rax, [ rsi + 0x10 ], 0x5; x1 <- arg1[2] * 0x5 mov rdx, [ rsi + 0x0 ]; arg1[0] to rdx mulx r10, r11, [ rsi + 0x0 ]; x16, x15<- arg1[0] * arg1[0] imul rbx, rax, 0x2; x2 <- x1 * 0x2 imul rbx, rbx, 0x2; x10000 <- x2 * 0x2 mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx mulx rbx, rbp, rbx; x8, x7<- arg1[1] * x10000 add rbp, r11; could be done better, if r0 has been u8 as well adcx r10, rbx mov r12, rbp; x21, copying x17 here, cause x17 is needed in a reg for other than x21, namely all: , x22, x21, size: 2 shrd r12, r10, 44; x21 <- x19||x17 >> 44 mov r13, 0xfffffffffff ; moving imm to reg and rbp, r13; x22 <- x17&0xfffffffffff imul r14, [ rsi + 0x8 ], 0x2; x4 <- arg1[1] * 0x2 mov rdx, [ rsi + 0x10 ]; arg1[2] to rdx mulx rax, r15, rax; x6, x5<- arg1[2] * x1 mov rdx, r14; x4 to rdx mulx rdx, r14, [ rsi + 0x0 ]; x14, x13<- arg1[0] * x4 xor rcx, rcx adox r15, r14 adox rdx, rax adcx r15, r12 adc rdx, 0x0 mov r8, r15; x34, copying x31 here, cause x31 is needed in a reg for other than x34, namely all: , x34, x35, size: 2 shrd r8, rdx, 43; x34 <- x33||x31 >> 43 imul r9, [ rsi + 0x10 ], 0x2; x3 <- arg1[2] * 0x2 imul r11, [ rsi + 0x8 ], 0x2; x10001 <- arg1[1] * 0x2 mov rdx, [ rsi + 0x8 ]; arg1[1] to rdx mulx r11, rbx, r11; x10, x9<- arg1[1] * x10001 mov rdx, r9; x3 to rdx mulx rdx, r9, [ rsi + 0x0 ]; x12, x11<- arg1[0] * x3 xor r10, r10 adox rbx, r9 adcx rbx, r8 adox rdx, r11 adc rdx, 0x0 mov rcx, rbx; x39, copying x36 here, cause x36 is needed in a reg for other than x39, namely all: , x39, x40, size: 2 shrd rcx, rdx, 43; x39 <- x38||x36 >> 43 imul rcx, rcx, 0x5; x41 <- x39 * 0x5 lea rbp, [ rbp + rcx ] mov r12, rbp; x43, copying x42 here, cause x42 is needed in a reg for other than x43, namely all: , x43, x44, size: 2 shr r12, 44; x43 <- x42>> 44 mov rax, 0x7ffffffffff ; moving imm to reg and r15, rax; x35 <- x31&0x7ffffffffff and rbx, rax; x40 <- x36&0x7ffffffffff lea r12, [ r12 + r15 ] mov r14, r12; x46, copying x45 here, cause x45 is needed in a reg for other than x46, namely all: , x46, x47, size: 2 shr r14, 43; x46 <- x45>> 43 lea r14, [ r14 + rbx ] mov [ rdi + 0x10 ], r14; out1[2] = x48 and rbp, r13; x44 <- x42&0xfffffffffff and r12, rax; x47 <- x45&0x7ffffffffff mov [ rdi + 0x0 ], rbp; out1[0] = x44 mov [ rdi + 0x8 ], r12; out1[1] = x47 mov rbx, [ rsp + 0x0 ]; restoring from stack mov rbp, [ rsp + 0x8 ]; restoring from stack mov r12, [ rsp + 0x10 ]; restoring from stack mov r13, [ rsp + 0x18 ]; restoring from stack mov r14, [ rsp + 0x20 ]; restoring from stack mov r15, [ rsp + 0x28 ]; restoring from stack add rsp, 0x30 ret ; cpu AMD Ryzen Threadripper 1900X 8-Core Processor ; clocked at 2200 MHz ; first cyclecount 35.34, best 32.4180790960452, lastGood 33.706214689265536 ; seed 267833281830466 ; CC / CFLAGS clang / -march=native -mtune=native -O3 ; time needed: 4098 ms / 500 runs=> 8.196ms/run ; Time spent for assembling and measureing (initial batch_size=177, initial num_batches=101): 2292 ms ; Ratio (time for assembling + measure)/(total runtime for 500runs): 0.5592972181551976 ; number reverted permutation/ tried permutation: 217 / 255 =85.098% ; number reverted decision/ tried decision: 185 / 246 =75.203%
oeis/203/A203848.asm
neoneye/loda-programs
11
12470
; A203848: a(n) = sigma(n)*Fibonacci(n), where sigma(n) = A000203(n), the sum of divisors of n. ; Submitted by <NAME> ; 1,3,8,21,30,96,104,315,442,990,1068,4032,3262,9048,14640,30597,28746,100776,83620,284130,350272,637596,687768,2782080,2325775,5098506,7856720,17797416,15426870,59906880,43080608,137233467,169179744,307955898,442918320,1358662032,917997046,2345290140,3541775216,9210073950,6954365922,25719772416,19073755228,58918333572,88522447260,132214457016,142618323504,596133345024,443388296793,1170523019325,1466280797328,3229225449702,2879079723342,10352108552640,10050038096040,27102172046040,29234823692960 mov $2,$0 add $0,1 seq $0,45 ; Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1. seq $2,274536 ; a(n) = 6 * sigma(n). mul $0,$2 sub $0,6 div $0,6 add $0,1
vrml.g4
ingowald/antlr-vrml
0
1182
<reponame>ingowald/antlr-vrml<gh_stars>0 grammar vrml; world: header ( node ) * EOF ; header : '#VRML' 'V2.0' 'utf8' ( 'CosmoWorlds' 'V1.0' )? ; node : ( worldInfoNode | navigationInfoNode | transformNode | viewPointNode | pointLightNode | groupNode | shapeNode | collisionNode | switchNode | inlineNode | spotLightNode | ortSpotLightNode | ortDirectionalLightNode | ortPointLightNode | ortShaderNode ) ; inlineNode : optDef 'Inline' '{' ( 'url' stringArray | 'bboxCenter' float3 | 'bboxSize' float3 )* '}' ; navigationInfoNode : optDef 'NavigationInfo' '{' ( 'headlight' BooleanLiteral | 'avatarSize' float1Array | 'speed' float1 | 'type' stringArray | 'visibilityLimit' float1 )* '}' ; worldInfoNode : optDef 'WorldInfo' '{' ('info' stringArray |'title' stringArray )* '}' ; optDef : ('DEF' Identifier)? ; collisionNode : optDef 'Collision' '{' ( children | 'bboxCenter' float3 | 'bboxSize' float3 | 'collide' bool1 | 'proxy' proxyNode )* '}' ; proxyNode : 'USE' Identifier | 'NULL' ; shapeNode : 'Shape' '{' ('appearance' appearanceNode |'geometry' geometryNode)* '}' | 'USE' Identifier | 'NULL' ; colorNode : 'USE' Identifier | 'NULL' ; geometryNode : indexedFaceSetNode ; indexedFaceSetNode : optDef 'IndexedFaceSet' '{' ( 'coord' coordinateNode | 'normal' normalNode | 'creaseAngle' float1 | 'color' colorNode | 'coordIndex' intArray | 'colorIndex' intArray | 'normalIndex' intArray | 'normalPerVertex' bool1 | 'solid' bool1 | 'texCoord' textureCoordinateNode | 'texCoordIndex' intArray | 'ccw' bool1 | 'colorPerVertex' bool1 | 'convex' bool1 )* '}' | 'USE' Identifier | 'NULL' ; textureCoordinateNode : optDef 'TextureCoordinate' '{' ( 'point' float2Array )* '}' | 'USE' Identifier | 'NULL' ; normalNode : optDef 'Normal' '{' ( 'vector' float3Array )* '}' | 'USE' Identifier | 'NULL' ; coordinateNode : optDef 'Coordinate' '{' ( 'point' float3Array )* '}' | 'USE' Identifier | 'NULL' ; intArray : '[' int1 (','? int1)* ']' | '[' ']' | int1 ; stringArray : '[' string (','? string)* ']' | '[' ']' | string ; float2Array : '[' float2 (','? float2)* ']' | '[' ']' | float2 ; float3Array : '[' float3 (','? float3)* ']' | '[' ']' | float3 ; float1Array : '[' float1 (','? float1)* ']' | '[' ']' | float1 ; appearanceNode : 'Appearance' '{' ( appearanceMember )* '}' | ortAppearanceNode | 'USE' Identifier | 'NULL' ; // 'ORT'Appearance nodes are extensions from the original 'openrt' // project (in the 2000-2005's); they're not part of the VRML2 // spec, but I'll add them here just for testing, since many of my // vrml files still have such nodes ortAppearanceNode :'ORTAppearance' '{' ( 'material' materialNode | 'shader' ortShaderNode | 'instanceName' string | appearanceMember )* '}' ; ortSpotLightNode : 'ORTSpotLight' '{' ( 'name' string | 'shader' ortShaderNode | 'ambientIntensity' float1 | 'attenuation' float3 | 'beamWidth' float1 | 'cutOffAngle' float1 | 'direction' float3 | 'location' float3 | 'on' bool1 | 'radius' float1 | 'ambientIntensity' float1 | 'color' float3 | 'intensity' float1 | 'on' bool1 )* '}' ; spotLightNode : 'SpotLight' '{' ( 'color' float3 | 'intensity' float1 | 'ambientIntensity' float1 | 'on' bool1 | 'direction' float3 | 'location' float3 | 'cutOffAngle' float1 | 'beamWidth' float1 )* '}' ; ortDirectionalLightNode : 'ORTDirectionalLight' '{' ( 'name' string | 'shader' ortShaderNode | 'ambientIntensity' float1 | 'color' float3 | 'intensity' float1 | 'on' bool1 | 'direction' float3 )* '}' ; ortPointLightNode : 'ORTPointLight' '{' ( 'name' string | 'shader' ortShaderNode | 'ambientIntensity' float1 | 'color' float3 | 'attenuation' float3 | 'location' float3 | 'intensity' float1 | 'on' bool1 | 'radius' float1 )* '}' ; ortShaderNode : 'ORTGeneralShader' '{' ( 'name' string | 'file' string | 'options' stringArray )* '}' | 'ORTLightShader' '{' ( 'name' string | 'file' string | 'options' stringArray )* '}' | 'ORTEnvironmentShader' '{' ( 'textureURLs' stringArray | 'name' string | 'file' string | 'options' stringArray )* '}' | 'USE' Identifier | 'NULL' ; appearanceMember : 'material' materialNode | 'texture' imageTextureNode | 'textureTransform' textureTransformNode | 'textureProjection' textureProjectionNode ; textureProjectionNode : 'USE' Identifier | 'NULL' ; textureTransformNode : optDef 'TextureTransform' '{' ( 'center' float2 | 'rotation' float1 | 'scale' float2 | 'translation' float2 )* '}' | 'USE' Identifier | 'NULL' ; imageTextureNode : optDef 'ImageTexture' '{' ( 'repeatS' bool1 | 'repeatT' bool1 | 'url' stringArray | 'model' string | 'blendColor' float3 )* '}' | 'USE' Identifier | 'NULL' ; materialNode : optDef 'Material' '{' ( 'diffuseColor' float3 | 'ambientIntensity' float1 | 'specularColor' float3 | 'emissiveColor' float3 | 'shininess' float1 | 'transparency' float1 )* '}' | 'USE' Identifier | 'NULL' ; transformNode : optDef 'Transform' '{' ( children | 'center' float3 | 'rotation' float4 | 'scale' float3 | 'scaleOrientation' float4 | 'translation' float3 | 'bboxCenter' float3 | 'bboxSize' float3 )* '}' | 'USE' Identifier ; groupNode : optDef 'Group' '{' ( children | 'bboxCenter' float3 | 'bboxSize' float3 )* '}' ; switchNode : optDef 'Switch' '{' ( 'choice' nodeArray | 'whichChoice' int1 )* '}' ; pointLightNode : optDef 'PointLight' '{' ( 'ambientIntensity' float1 | 'intensity' float1 | 'location' float3 | 'on' boolVal | 'color' float3 )* '}' ; bool1 : BooleanLiteral ; int1 : IntegerLiteral ; float1 : FloatingPointLiteral | IntegerLiteral ; float2: float1 float1; float3: float1 float1 float1; float4: float1 float1 float1 float1; boolVal : BooleanLiteral ; viewPointNode : optDef 'Viewpoint' '{' ( 'fieldOfView' float1 | 'position' float3 | 'orientation' float4 | 'description' string | 'jump' bool1 )* '}' ; string: StringLiteral ; notImplemented : '___NotYetImplemented___' ; children : 'children' nodeArray ; nodeArray : '[' node (','? node)* ']' | '[' ']' | node ; // §3.10.1 Integer Literals IntegerLiteral : '-'? DecimalIntegerLiteral | '-'? HexIntegerLiteral | '-'? OctalIntegerLiteral | '-'? BinaryIntegerLiteral ; fragment DecimalIntegerLiteral : DecimalNumeral IntegerTypeSuffix? ; fragment HexIntegerLiteral : HexNumeral IntegerTypeSuffix? ; fragment OctalIntegerLiteral : OctalNumeral IntegerTypeSuffix? ; fragment BinaryIntegerLiteral : BinaryNumeral IntegerTypeSuffix? ; fragment IntegerTypeSuffix : [lL] ; fragment DecimalNumeral : '0' | NonZeroDigit (Digits? | Underscores Digits) ; fragment Digits : Digit (DigitOrUnderscore* Digit)? ; fragment Digit : '0' | NonZeroDigit ; fragment NonZeroDigit : [1-9] ; fragment DigitOrUnderscore : Digit | '_' ; fragment Underscores : '_'+ ; fragment HexNumeral : '0' [xX] HexDigits ; fragment HexDigits : HexDigit (HexDigitOrUnderscore* HexDigit)? ; fragment HexDigit : [0-9a-fA-F] ; fragment HexDigitOrUnderscore : HexDigit | '_' ; fragment OctalNumeral : '0' Underscores? OctalDigits ; fragment OctalDigits : OctalDigit (OctalDigitOrUnderscore* OctalDigit)? ; fragment OctalDigit : [0-7] ; fragment OctalDigitOrUnderscore : OctalDigit | '_' ; fragment BinaryNumeral : '0' [bB] BinaryDigits ; fragment BinaryDigits : BinaryDigit (BinaryDigitOrUnderscore* BinaryDigit)? ; fragment BinaryDigit : [01] ; fragment BinaryDigitOrUnderscore : BinaryDigit | '_' ; // §3.10.2 Floating-Point Literals FloatingPointLiteral : '-'? DecimalFloatingPointLiteral | HexadecimalFloatingPointLiteral ; fragment DecimalFloatingPointLiteral : Digits '.' Digits? ExponentPart? FloatTypeSuffix? | '.' Digits ExponentPart? FloatTypeSuffix? | Digits ExponentPart FloatTypeSuffix? | Digits FloatTypeSuffix ; fragment ExponentPart : ExponentIndicator SignedInteger ; fragment ExponentIndicator : [eE] ; fragment SignedInteger : Sign? Digits ; fragment Sign : [+-] ; fragment FloatTypeSuffix : [fFdD] ; fragment HexadecimalFloatingPointLiteral : HexSignificand BinaryExponent FloatTypeSuffix? ; fragment HexSignificand : HexNumeral '.'? | '0' [xX] HexDigits? '.' HexDigits ; fragment BinaryExponent : BinaryExponentIndicator SignedInteger ; fragment BinaryExponentIndicator : [pP] ; // §3.10.3 Boolean Literals BooleanLiteral : 'true' | 'TRUE' | 'false' | 'FALSE' ; // §3.10.4 Character Literals CharacterLiteral : '\'' SingleCharacter '\'' | '\'' EscapeSequence '\'' ; fragment SingleCharacter : ~['\\] ; // §3.10.5 String Literals StringLiteral : '"' StringCharacters? '"' ; fragment StringCharacters : StringCharacter+ ; fragment StringCharacter : ~["] | EscapeSequence ; // §3.10.6 Escape Sequences for Character and String Literals fragment EscapeSequence : '\\' [btnfr"'\\] | OctalEscape | UnicodeEscape ; fragment OctalEscape : '\\' OctalDigit | '\\' OctalDigit OctalDigit | '\\' ZeroToThree OctalDigit OctalDigit ; fragment UnicodeEscape : '\\' 'u' HexDigit HexDigit HexDigit HexDigit ; fragment ZeroToThree : [0-3] ; // §3.10.7 The Null Literal NullLiteral : 'null' ; // §3.11 Separators LPAREN : '('; RPAREN : ')'; LBRACE : '{'; RBRACE : '}'; LBRACK : '['; RBRACK : ']'; SEMI : ';'; COMMA : ','; DOT : '.'; // §3.12 Operators ASSIGN : '='; GT : '>'; LT : '<'; BANG : '!'; TILDE : '~'; QUESTION : '?'; COLON : ':'; EQUAL : '=='; LE : '<='; GE : '>='; NOTEQUAL : '!='; AND : '&&'; OR : '||'; INC : '++'; DEC : '--'; ADD : '+'; SUB : '-'; MUL : '*'; DIV : '/'; BITAND : '&'; BITOR : '|'; CARET : '^'; MOD : '%'; ADD_ASSIGN : '+='; SUB_ASSIGN : '-='; MUL_ASSIGN : '*='; DIV_ASSIGN : '/='; AND_ASSIGN : '&='; OR_ASSIGN : '|='; XOR_ASSIGN : '^='; MOD_ASSIGN : '%='; LSHIFT_ASSIGN : '<<='; RSHIFT_ASSIGN : '>>='; URSHIFT_ASSIGN : '>>>='; // §3.8 Identifiers (must appear after all keywords in the grammar) // Identifier // : JavaLetter JavaLetterOrDigit* // ; Identifier : Letter+ (Letter|[0-9%:])* ; fragment Letter : [a-zA-Z_\(\)] ; fragment JavaLetter : [a-zA-Z$_] // these are the "java letters" below 0xFF | // covers all characters above 0xFF which are not a surrogate ~[\u0000-\u00FF\uD800-\uDBFF] {Character.isJavaIdentifierStart(_input.LA(-1))}? | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF [\uD800-\uDBFF] [\uDC00-\uDFFF] {Character.isJavaIdentifierStart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}? ; fragment JavaLetterOrDigit : [a-zA-Z0-9$_] // these are the "java letters or digits" below 0xFF | // covers all characters above 0xFF which are not a surrogate ~[\u0000-\u00FF\uD800-\uDBFF] {Character.isJavaIdentifierPart(_input.LA(-1))}? | // covers UTF-16 surrogate pairs encodings for U+10000 to U+10FFFF [\uD800-\uDBFF] [\uDC00-\uDFFF] {Character.isJavaIdentifierPart(Character.toCodePoint((char)_input.LA(-2), (char)_input.LA(-1)))}? ; // // Additional symbols not defined in the lexical specification // AT : '@'; ELLIPSIS : '...'; // // Whitespace and comments // WS : [ \t\r\n\u000C]+ -> channel(HIDDEN) ; COMMENT : '/*' .*? '*/' -> channel(HIDDEN) ; LINE_COMMENT : '#' WS ~[\r\n]* -> channel(HIDDEN) ;
src/day-19/adventofcode-day_19.ads
persan/advent-of-code-2020
0
22634
<reponame>persan/advent-of-code-2020 package Adventofcode.Day_19 is end Adventofcode.Day_19;
h2o.asm
jhsie007/xv6
0
164615
_h2o: file format elf32-i386 Disassembly of section .text: 00001000 <init_qs>: void init_qs(struct queues *); void add_qs(struct queues *, int); int empty_qs(struct queues *); int pop_qs(struct queues *); void init_qs(struct queues *q){ 1000: 55 push %ebp 1001: 89 e5 mov %esp,%ebp q->sizes = 0; 1003: 8b 45 08 mov 0x8(%ebp),%eax 1006: c7 00 00 00 00 00 movl $0x0,(%eax) q->heads = 0; 100c: 8b 45 08 mov 0x8(%ebp),%eax 100f: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tails = 0; 1016: 8b 45 08 mov 0x8(%ebp),%eax 1019: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 1020: 5d pop %ebp 1021: c3 ret 00001022 <add_qs>: void add_qs(struct queues *q, int v){ 1022: 55 push %ebp 1023: 89 e5 mov %esp,%ebp 1025: 83 ec 28 sub $0x28,%esp struct nodes * n = malloc(sizeof(struct nodes)); 1028: c7 04 24 08 00 00 00 movl $0x8,(%esp) 102f: e8 99 12 00 00 call 22cd <malloc> 1034: 89 45 f4 mov %eax,-0xc(%ebp) n->nexts = 0; 1037: 8b 45 f4 mov -0xc(%ebp),%eax 103a: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) n->values = v; 1041: 8b 45 f4 mov -0xc(%ebp),%eax 1044: 8b 55 0c mov 0xc(%ebp),%edx 1047: 89 10 mov %edx,(%eax) if(q->heads == 0){ 1049: 8b 45 08 mov 0x8(%ebp),%eax 104c: 8b 40 04 mov 0x4(%eax),%eax 104f: 85 c0 test %eax,%eax 1051: 75 0b jne 105e <add_qs+0x3c> q->heads = n; 1053: 8b 45 08 mov 0x8(%ebp),%eax 1056: 8b 55 f4 mov -0xc(%ebp),%edx 1059: 89 50 04 mov %edx,0x4(%eax) 105c: eb 0c jmp 106a <add_qs+0x48> }else{ q->tails->nexts = n; 105e: 8b 45 08 mov 0x8(%ebp),%eax 1061: 8b 40 08 mov 0x8(%eax),%eax 1064: 8b 55 f4 mov -0xc(%ebp),%edx 1067: 89 50 04 mov %edx,0x4(%eax) } q->tails = n; 106a: 8b 45 08 mov 0x8(%ebp),%eax 106d: 8b 55 f4 mov -0xc(%ebp),%edx 1070: 89 50 08 mov %edx,0x8(%eax) q->sizes++; 1073: 8b 45 08 mov 0x8(%ebp),%eax 1076: 8b 00 mov (%eax),%eax 1078: 8d 50 01 lea 0x1(%eax),%edx 107b: 8b 45 08 mov 0x8(%ebp),%eax 107e: 89 10 mov %edx,(%eax) } 1080: c9 leave 1081: c3 ret 00001082 <empty_qs>: int empty_qs(struct queues *q){ 1082: 55 push %ebp 1083: 89 e5 mov %esp,%ebp if(q->sizes == 0) 1085: 8b 45 08 mov 0x8(%ebp),%eax 1088: 8b 00 mov (%eax),%eax 108a: 85 c0 test %eax,%eax 108c: 75 07 jne 1095 <empty_qs+0x13> return 1; 108e: b8 01 00 00 00 mov $0x1,%eax 1093: eb 05 jmp 109a <empty_qs+0x18> else return 0; 1095: b8 00 00 00 00 mov $0x0,%eax } 109a: 5d pop %ebp 109b: c3 ret 0000109c <pop_qs>: int pop_qs(struct queues *q){ 109c: 55 push %ebp 109d: 89 e5 mov %esp,%ebp 109f: 83 ec 28 sub $0x28,%esp int val; struct nodes *destroy; if(!empty_qs(q)){ 10a2: 8b 45 08 mov 0x8(%ebp),%eax 10a5: 89 04 24 mov %eax,(%esp) 10a8: e8 d5 ff ff ff call 1082 <empty_qs> 10ad: 85 c0 test %eax,%eax 10af: 75 5d jne 110e <pop_qs+0x72> val = q->heads->values; 10b1: 8b 45 08 mov 0x8(%ebp),%eax 10b4: 8b 40 04 mov 0x4(%eax),%eax 10b7: 8b 00 mov (%eax),%eax 10b9: 89 45 f4 mov %eax,-0xc(%ebp) destroy = q->heads; 10bc: 8b 45 08 mov 0x8(%ebp),%eax 10bf: 8b 40 04 mov 0x4(%eax),%eax 10c2: 89 45 f0 mov %eax,-0x10(%ebp) q->heads = q->heads->nexts; 10c5: 8b 45 08 mov 0x8(%ebp),%eax 10c8: 8b 40 04 mov 0x4(%eax),%eax 10cb: 8b 50 04 mov 0x4(%eax),%edx 10ce: 8b 45 08 mov 0x8(%ebp),%eax 10d1: 89 50 04 mov %edx,0x4(%eax) free(destroy); 10d4: 8b 45 f0 mov -0x10(%ebp),%eax 10d7: 89 04 24 mov %eax,(%esp) 10da: e8 b5 10 00 00 call 2194 <free> q->sizes--; 10df: 8b 45 08 mov 0x8(%ebp),%eax 10e2: 8b 00 mov (%eax),%eax 10e4: 8d 50 ff lea -0x1(%eax),%edx 10e7: 8b 45 08 mov 0x8(%ebp),%eax 10ea: 89 10 mov %edx,(%eax) if(q->sizes == 0){ 10ec: 8b 45 08 mov 0x8(%ebp),%eax 10ef: 8b 00 mov (%eax),%eax 10f1: 85 c0 test %eax,%eax 10f3: 75 14 jne 1109 <pop_qs+0x6d> q->heads = 0; 10f5: 8b 45 08 mov 0x8(%ebp),%eax 10f8: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tails = 0; 10ff: 8b 45 08 mov 0x8(%ebp),%eax 1102: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } return val; 1109: 8b 45 f4 mov -0xc(%ebp),%eax 110c: eb 05 jmp 1113 <pop_qs+0x77> } return -1; 110e: b8 ff ff ff ff mov $0xffffffff,%eax } 1113: c9 leave 1114: c3 ret 00001115 <sem_init>: lock_t lock; struct queues pRobyn; }; //Initialize Semaphore void sem_init(struct Semaphore *s, int c){ 1115: 55 push %ebp 1116: 89 e5 mov %esp,%ebp 1118: 83 ec 18 sub $0x18,%esp s->count = c; 111b: 8b 45 08 mov 0x8(%ebp),%eax 111e: 8b 55 0c mov 0xc(%ebp),%edx 1121: 89 10 mov %edx,(%eax) s->maxCount = c; 1123: 8b 45 08 mov 0x8(%ebp),%eax 1126: 8b 55 0c mov 0xc(%ebp),%edx 1129: 89 50 04 mov %edx,0x4(%eax) init_qs(&(s->pRobyn)); 112c: 8b 45 08 mov 0x8(%ebp),%eax 112f: 83 c0 0c add $0xc,%eax 1132: 89 04 24 mov %eax,(%esp) 1135: e8 c6 fe ff ff call 1000 <init_qs> lock_init(&s->lock); 113a: 8b 45 08 mov 0x8(%ebp),%eax 113d: 83 c0 08 add $0x8,%eax 1140: 89 04 24 mov %eax,(%esp) 1143: e8 82 12 00 00 call 23ca <lock_init> } 1148: c9 leave 1149: c3 ret 0000114a <sem_acquire>: //Acquire Semaphore void sem_acquire(struct Semaphore *s){ 114a: 55 push %ebp 114b: 89 e5 mov %esp,%ebp 114d: 83 ec 18 sub $0x18,%esp if(s->count > 0){ 1150: 8b 45 08 mov 0x8(%ebp),%eax 1153: 8b 00 mov (%eax),%eax 1155: 85 c0 test %eax,%eax 1157: 7e 2b jle 1184 <sem_acquire+0x3a> lock_acquire(&s->lock); 1159: 8b 45 08 mov 0x8(%ebp),%eax 115c: 83 c0 08 add $0x8,%eax 115f: 89 04 24 mov %eax,(%esp) 1162: e8 71 12 00 00 call 23d8 <lock_acquire> s->count--; 1167: 8b 45 08 mov 0x8(%ebp),%eax 116a: 8b 00 mov (%eax),%eax 116c: 8d 50 ff lea -0x1(%eax),%edx 116f: 8b 45 08 mov 0x8(%ebp),%eax 1172: 89 10 mov %edx,(%eax) lock_release(&s->lock); 1174: 8b 45 08 mov 0x8(%ebp),%eax 1177: 83 c0 08 add $0x8,%eax 117a: 89 04 24 mov %eax,(%esp) 117d: e8 76 12 00 00 call 23f8 <lock_release> 1182: eb 43 jmp 11c7 <sem_acquire+0x7d> } else{ lock_acquire(&s->lock); 1184: 8b 45 08 mov 0x8(%ebp),%eax 1187: 83 c0 08 add $0x8,%eax 118a: 89 04 24 mov %eax,(%esp) 118d: e8 46 12 00 00 call 23d8 <lock_acquire> add_qs(&(s->pRobyn), getpid()); 1192: e8 21 0d 00 00 call 1eb8 <getpid> 1197: 8b 55 08 mov 0x8(%ebp),%edx 119a: 83 c2 0c add $0xc,%edx 119d: 89 44 24 04 mov %eax,0x4(%esp) 11a1: 89 14 24 mov %edx,(%esp) 11a4: e8 79 fe ff ff call 1022 <add_qs> lock_release(&s->lock); 11a9: 8b 45 08 mov 0x8(%ebp),%eax 11ac: 83 c0 08 add $0x8,%eax 11af: 89 04 24 mov %eax,(%esp) 11b2: e8 41 12 00 00 call 23f8 <lock_release> tsleep(); 11b7: e8 2c 0d 00 00 call 1ee8 <tsleep> sem_acquire(s); 11bc: 8b 45 08 mov 0x8(%ebp),%eax 11bf: 89 04 24 mov %eax,(%esp) 11c2: e8 83 ff ff ff call 114a <sem_acquire> } } 11c7: c9 leave 11c8: c3 ret 000011c9 <sem_signal>: //Signal Semaphore void sem_signal(struct Semaphore *s){ 11c9: 55 push %ebp 11ca: 89 e5 mov %esp,%ebp 11cc: 83 ec 18 sub $0x18,%esp if(s->count < s->maxCount){ 11cf: 8b 45 08 mov 0x8(%ebp),%eax 11d2: 8b 10 mov (%eax),%edx 11d4: 8b 45 08 mov 0x8(%ebp),%eax 11d7: 8b 40 04 mov 0x4(%eax),%eax 11da: 39 c2 cmp %eax,%edx 11dc: 7d 51 jge 122f <sem_signal+0x66> lock_acquire(&s->lock); 11de: 8b 45 08 mov 0x8(%ebp),%eax 11e1: 83 c0 08 add $0x8,%eax 11e4: 89 04 24 mov %eax,(%esp) 11e7: e8 ec 11 00 00 call 23d8 <lock_acquire> s->count++; 11ec: 8b 45 08 mov 0x8(%ebp),%eax 11ef: 8b 00 mov (%eax),%eax 11f1: 8d 50 01 lea 0x1(%eax),%edx 11f4: 8b 45 08 mov 0x8(%ebp),%eax 11f7: 89 10 mov %edx,(%eax) lock_release(&s->lock); 11f9: 8b 45 08 mov 0x8(%ebp),%eax 11fc: 83 c0 08 add $0x8,%eax 11ff: 89 04 24 mov %eax,(%esp) 1202: e8 f1 11 00 00 call 23f8 <lock_release> if(empty_qs(&(s->pRobyn)) == 0){ 1207: 8b 45 08 mov 0x8(%ebp),%eax 120a: 83 c0 0c add $0xc,%eax 120d: 89 04 24 mov %eax,(%esp) 1210: e8 6d fe ff ff call 1082 <empty_qs> 1215: 85 c0 test %eax,%eax 1217: 75 16 jne 122f <sem_signal+0x66> twakeup(pop_qs(&(s->pRobyn))); 1219: 8b 45 08 mov 0x8(%ebp),%eax 121c: 83 c0 0c add $0xc,%eax 121f: 89 04 24 mov %eax,(%esp) 1222: e8 75 fe ff ff call 109c <pop_qs> 1227: 89 04 24 mov %eax,(%esp) 122a: e8 c1 0c 00 00 call 1ef0 <twakeup> } } } 122f: c9 leave 1230: c3 ret 00001231 <main>: int i; void hReady(); void oReady(); int main(){ 1231: 55 push %ebp 1232: 89 e5 mov %esp,%ebp 1234: 83 e4 f0 and $0xfffffff0,%esp 1237: 83 ec 10 sub $0x10,%esp h = malloc(sizeof(struct Semaphore)); 123a: c7 04 24 18 00 00 00 movl $0x18,(%esp) 1241: e8 87 10 00 00 call 22cd <malloc> 1246: a3 68 2c 00 00 mov %eax,0x2c68 o = malloc(sizeof(struct Semaphore)); 124b: c7 04 24 18 00 00 00 movl $0x18,(%esp) 1252: e8 76 10 00 00 call 22cd <malloc> 1257: a3 6c 2c 00 00 mov %eax,0x2c6c p = malloc(sizeof(struct Semaphore)); 125c: c7 04 24 18 00 00 00 movl $0x18,(%esp) 1263: e8 65 10 00 00 call 22cd <malloc> 1268: a3 70 2c 00 00 mov %eax,0x2c70 sem_init(p, 1); 126d: a1 70 2c 00 00 mov 0x2c70,%eax 1272: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 1279: 00 127a: 89 04 24 mov %eax,(%esp) 127d: e8 93 fe ff ff call 1115 <sem_init> // Test 1: 2 hydrogen 1 oxygen (Thread creation order: H->H->O) sem_acquire(p); 1282: a1 70 2c 00 00 mov 0x2c70,%eax 1287: 89 04 24 mov %eax,(%esp) 128a: e8 bb fe ff ff call 114a <sem_acquire> printf(1, "Test 1: 2 Hydrogen, 1 Oxygen (Thread creation order: H->H->O): \n"); 128f: c7 44 24 04 24 26 00 movl $0x2624,0x4(%esp) 1296: 00 1297: c7 04 24 01 00 00 00 movl $0x1,(%esp) 129e: e8 3d 0d 00 00 call 1fe0 <printf> sem_signal(p); 12a3: a1 70 2c 00 00 mov 0x2c70,%eax 12a8: 89 04 24 mov %eax,(%esp) 12ab: e8 19 ff ff ff call 11c9 <sem_signal> sem_init(h, 2); 12b0: a1 68 2c 00 00 mov 0x2c68,%eax 12b5: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 12bc: 00 12bd: 89 04 24 mov %eax,(%esp) 12c0: e8 50 fe ff ff call 1115 <sem_init> sem_init(o, 1); 12c5: a1 6c 2c 00 00 mov 0x2c6c,%eax 12ca: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 12d1: 00 12d2: 89 04 24 mov %eax,(%esp) 12d5: e8 3b fe ff ff call 1115 <sem_init> for(water = 0; water < 1; water++){ 12da: c7 05 80 2c 00 00 00 movl $0x0,0x2c80 12e1: 00 00 00 12e4: e9 7b 01 00 00 jmp 1464 <main+0x233> tid = thread_create(hReady, (void *) &arg); 12e9: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 12f0: 00 12f1: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 12f8: e8 16 11 00 00 call 2413 <thread_create> 12fd: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 1302: a1 88 2c 00 00 mov 0x2c88,%eax 1307: 85 c0 test %eax,%eax 1309: 75 33 jne 133e <main+0x10d> sem_acquire(p); 130b: a1 70 2c 00 00 mov 0x2c70,%eax 1310: 89 04 24 mov %eax,(%esp) 1313: e8 32 fe ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1318: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 131f: 00 1320: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1327: e8 b4 0c 00 00 call 1fe0 <printf> sem_signal(p); 132c: a1 70 2c 00 00 mov 0x2c70,%eax 1331: 89 04 24 mov %eax,(%esp) 1334: e8 90 fe ff ff call 11c9 <sem_signal> exit(); 1339: e8 fa 0a 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 133e: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1345: 00 00 00 1348: eb 0d jmp 1357 <main+0x126> 134a: a1 84 2c 00 00 mov 0x2c84,%eax 134f: 83 c0 01 add $0x1,%eax 1352: a3 84 2c 00 00 mov %eax,0x2c84 1357: a1 84 2c 00 00 mov 0x2c84,%eax 135c: 3d 3e 42 0f 00 cmp $0xf423e,%eax 1361: 7e e7 jle 134a <main+0x119> tid = thread_create(hReady, (void *) &arg); 1363: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 136a: 00 136b: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 1372: e8 9c 10 00 00 call 2413 <thread_create> 1377: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 137c: a1 88 2c 00 00 mov 0x2c88,%eax 1381: 85 c0 test %eax,%eax 1383: 75 33 jne 13b8 <main+0x187> sem_acquire(p); 1385: a1 70 2c 00 00 mov 0x2c70,%eax 138a: 89 04 24 mov %eax,(%esp) 138d: e8 b8 fd ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1392: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1399: 00 139a: c7 04 24 01 00 00 00 movl $0x1,(%esp) 13a1: e8 3a 0c 00 00 call 1fe0 <printf> sem_signal(p); 13a6: a1 70 2c 00 00 mov 0x2c70,%eax 13ab: 89 04 24 mov %eax,(%esp) 13ae: e8 16 fe ff ff call 11c9 <sem_signal> exit(); 13b3: e8 80 0a 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 13b8: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 13bf: 00 00 00 13c2: eb 0d jmp 13d1 <main+0x1a0> 13c4: a1 84 2c 00 00 mov 0x2c84,%eax 13c9: 83 c0 01 add $0x1,%eax 13cc: a3 84 2c 00 00 mov %eax,0x2c84 13d1: a1 84 2c 00 00 mov 0x2c84,%eax 13d6: 3d 3e 42 0f 00 cmp $0xf423e,%eax 13db: 7e e7 jle 13c4 <main+0x193> tid = thread_create(oReady, (void *) &arg); 13dd: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 13e4: 00 13e5: c7 04 24 1f 1b 00 00 movl $0x1b1f,(%esp) 13ec: e8 22 10 00 00 call 2413 <thread_create> 13f1: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 13f6: a1 88 2c 00 00 mov 0x2c88,%eax 13fb: 85 c0 test %eax,%eax 13fd: 75 33 jne 1432 <main+0x201> sem_acquire(p); 13ff: a1 70 2c 00 00 mov 0x2c70,%eax 1404: 89 04 24 mov %eax,(%esp) 1407: e8 3e fd ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 140c: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1413: 00 1414: c7 04 24 01 00 00 00 movl $0x1,(%esp) 141b: e8 c0 0b 00 00 call 1fe0 <printf> sem_signal(p); 1420: a1 70 2c 00 00 mov 0x2c70,%eax 1425: 89 04 24 mov %eax,(%esp) 1428: e8 9c fd ff ff call 11c9 <sem_signal> exit(); 142d: e8 06 0a 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 1432: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1439: 00 00 00 143c: eb 0d jmp 144b <main+0x21a> 143e: a1 84 2c 00 00 mov 0x2c84,%eax 1443: 83 c0 01 add $0x1,%eax 1446: a3 84 2c 00 00 mov %eax,0x2c84 144b: a1 84 2c 00 00 mov 0x2c84,%eax 1450: 3d 3e 42 0f 00 cmp $0xf423e,%eax 1455: 7e e7 jle 143e <main+0x20d> printf(1, "Test 1: 2 Hydrogen, 1 Oxygen (Thread creation order: H->H->O): \n"); sem_signal(p); sem_init(h, 2); sem_init(o, 1); for(water = 0; water < 1; water++){ 1457: a1 80 2c 00 00 mov 0x2c80,%eax 145c: 83 c0 01 add $0x1,%eax 145f: a3 80 2c 00 00 mov %eax,0x2c80 1464: a1 80 2c 00 00 mov 0x2c80,%eax 1469: 85 c0 test %eax,%eax 146b: 0f 8e 78 fe ff ff jle 12e9 <main+0xb8> sem_signal(p); exit(); } for(i = 0; i < 999999; i++); } while(wait()>= 0); 1471: 90 nop 1472: e8 c9 09 00 00 call 1e40 <wait> 1477: 85 c0 test %eax,%eax 1479: 79 f7 jns 1472 <main+0x241> // Test 2: 20 hydrogen 10 oxygen (Thread creation order: O->H->H) sem_acquire(p); 147b: a1 70 2c 00 00 mov 0x2c70,%eax 1480: 89 04 24 mov %eax,(%esp) 1483: e8 c2 fc ff ff call 114a <sem_acquire> printf(1, "\nTest 2: 20 Hydrogen, 10 Oxygen (Thread creation order: O->H->H): \n"); 1488: c7 44 24 04 80 26 00 movl $0x2680,0x4(%esp) 148f: 00 1490: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1497: e8 44 0b 00 00 call 1fe0 <printf> sem_signal(p); 149c: a1 70 2c 00 00 mov 0x2c70,%eax 14a1: 89 04 24 mov %eax,(%esp) 14a4: e8 20 fd ff ff call 11c9 <sem_signal> sem_init(h, 2); 14a9: a1 68 2c 00 00 mov 0x2c68,%eax 14ae: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 14b5: 00 14b6: 89 04 24 mov %eax,(%esp) 14b9: e8 57 fc ff ff call 1115 <sem_init> sem_init(o, 1); 14be: a1 6c 2c 00 00 mov 0x2c6c,%eax 14c3: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 14ca: 00 14cb: 89 04 24 mov %eax,(%esp) 14ce: e8 42 fc ff ff call 1115 <sem_init> for(water = 0; water < 10; water++){ 14d3: c7 05 80 2c 00 00 00 movl $0x0,0x2c80 14da: 00 00 00 14dd: e9 7b 01 00 00 jmp 165d <main+0x42c> tid = thread_create(oReady, (void *) &arg); 14e2: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 14e9: 00 14ea: c7 04 24 1f 1b 00 00 movl $0x1b1f,(%esp) 14f1: e8 1d 0f 00 00 call 2413 <thread_create> 14f6: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 14fb: a1 88 2c 00 00 mov 0x2c88,%eax 1500: 85 c0 test %eax,%eax 1502: 75 33 jne 1537 <main+0x306> sem_acquire(p); 1504: a1 70 2c 00 00 mov 0x2c70,%eax 1509: 89 04 24 mov %eax,(%esp) 150c: e8 39 fc ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1511: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1518: 00 1519: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1520: e8 bb 0a 00 00 call 1fe0 <printf> sem_signal(p); 1525: a1 70 2c 00 00 mov 0x2c70,%eax 152a: 89 04 24 mov %eax,(%esp) 152d: e8 97 fc ff ff call 11c9 <sem_signal> exit(); 1532: e8 01 09 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 1537: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 153e: 00 00 00 1541: eb 0d jmp 1550 <main+0x31f> 1543: a1 84 2c 00 00 mov 0x2c84,%eax 1548: 83 c0 01 add $0x1,%eax 154b: a3 84 2c 00 00 mov %eax,0x2c84 1550: a1 84 2c 00 00 mov 0x2c84,%eax 1555: 3d 3e 42 0f 00 cmp $0xf423e,%eax 155a: 7e e7 jle 1543 <main+0x312> tid = thread_create(hReady, (void *) &arg); 155c: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 1563: 00 1564: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 156b: e8 a3 0e 00 00 call 2413 <thread_create> 1570: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 1575: a1 88 2c 00 00 mov 0x2c88,%eax 157a: 85 c0 test %eax,%eax 157c: 75 33 jne 15b1 <main+0x380> sem_acquire(p); 157e: a1 70 2c 00 00 mov 0x2c70,%eax 1583: 89 04 24 mov %eax,(%esp) 1586: e8 bf fb ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 158b: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1592: 00 1593: c7 04 24 01 00 00 00 movl $0x1,(%esp) 159a: e8 41 0a 00 00 call 1fe0 <printf> sem_signal(p); 159f: a1 70 2c 00 00 mov 0x2c70,%eax 15a4: 89 04 24 mov %eax,(%esp) 15a7: e8 1d fc ff ff call 11c9 <sem_signal> exit(); 15ac: e8 87 08 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 15b1: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 15b8: 00 00 00 15bb: eb 0d jmp 15ca <main+0x399> 15bd: a1 84 2c 00 00 mov 0x2c84,%eax 15c2: 83 c0 01 add $0x1,%eax 15c5: a3 84 2c 00 00 mov %eax,0x2c84 15ca: a1 84 2c 00 00 mov 0x2c84,%eax 15cf: 3d 3e 42 0f 00 cmp $0xf423e,%eax 15d4: 7e e7 jle 15bd <main+0x38c> tid = thread_create(hReady, (void *) &arg); 15d6: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 15dd: 00 15de: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 15e5: e8 29 0e 00 00 call 2413 <thread_create> 15ea: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 15ef: a1 88 2c 00 00 mov 0x2c88,%eax 15f4: 85 c0 test %eax,%eax 15f6: 75 33 jne 162b <main+0x3fa> sem_acquire(p); 15f8: a1 70 2c 00 00 mov 0x2c70,%eax 15fd: 89 04 24 mov %eax,(%esp) 1600: e8 45 fb ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1605: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 160c: 00 160d: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1614: e8 c7 09 00 00 call 1fe0 <printf> sem_signal(p); 1619: a1 70 2c 00 00 mov 0x2c70,%eax 161e: 89 04 24 mov %eax,(%esp) 1621: e8 a3 fb ff ff call 11c9 <sem_signal> exit(); 1626: e8 0d 08 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 162b: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1632: 00 00 00 1635: eb 0d jmp 1644 <main+0x413> 1637: a1 84 2c 00 00 mov 0x2c84,%eax 163c: 83 c0 01 add $0x1,%eax 163f: a3 84 2c 00 00 mov %eax,0x2c84 1644: a1 84 2c 00 00 mov 0x2c84,%eax 1649: 3d 3e 42 0f 00 cmp $0xf423e,%eax 164e: 7e e7 jle 1637 <main+0x406> printf(1, "\nTest 2: 20 Hydrogen, 10 Oxygen (Thread creation order: O->H->H): \n"); sem_signal(p); sem_init(h, 2); sem_init(o, 1); for(water = 0; water < 10; water++){ 1650: a1 80 2c 00 00 mov 0x2c80,%eax 1655: 83 c0 01 add $0x1,%eax 1658: a3 80 2c 00 00 mov %eax,0x2c80 165d: a1 80 2c 00 00 mov 0x2c80,%eax 1662: 83 f8 09 cmp $0x9,%eax 1665: 0f 8e 77 fe ff ff jle 14e2 <main+0x2b1> sem_signal(p); exit(); } for(i = 0; i < 999999; i++); } while(wait()>= 0); 166b: 90 nop 166c: e8 cf 07 00 00 call 1e40 <wait> 1671: 85 c0 test %eax,%eax 1673: 79 f7 jns 166c <main+0x43b> // Test 3: 20 hydrogen 10 oxygen (Thread creation order: H->O->H) sem_acquire(p); 1675: a1 70 2c 00 00 mov 0x2c70,%eax 167a: 89 04 24 mov %eax,(%esp) 167d: e8 c8 fa ff ff call 114a <sem_acquire> printf(1, "\nTest 3: 20 Hydrogen, 10 Oxygen (Thread creation order: H->O->H): \n"); 1682: c7 44 24 04 c4 26 00 movl $0x26c4,0x4(%esp) 1689: 00 168a: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1691: e8 4a 09 00 00 call 1fe0 <printf> sem_signal(p); 1696: a1 70 2c 00 00 mov 0x2c70,%eax 169b: 89 04 24 mov %eax,(%esp) 169e: e8 26 fb ff ff call 11c9 <sem_signal> sem_init(h, 2); 16a3: a1 68 2c 00 00 mov 0x2c68,%eax 16a8: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 16af: 00 16b0: 89 04 24 mov %eax,(%esp) 16b3: e8 5d fa ff ff call 1115 <sem_init> sem_init(o, 1); 16b8: a1 6c 2c 00 00 mov 0x2c6c,%eax 16bd: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 16c4: 00 16c5: 89 04 24 mov %eax,(%esp) 16c8: e8 48 fa ff ff call 1115 <sem_init> for(water = 0; water < 10; water++){ 16cd: c7 05 80 2c 00 00 00 movl $0x0,0x2c80 16d4: 00 00 00 16d7: e9 7b 01 00 00 jmp 1857 <main+0x626> tid = thread_create(hReady, (void *) &arg); 16dc: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 16e3: 00 16e4: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 16eb: e8 23 0d 00 00 call 2413 <thread_create> 16f0: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 16f5: a1 88 2c 00 00 mov 0x2c88,%eax 16fa: 85 c0 test %eax,%eax 16fc: 75 33 jne 1731 <main+0x500> sem_acquire(p); 16fe: a1 70 2c 00 00 mov 0x2c70,%eax 1703: 89 04 24 mov %eax,(%esp) 1706: e8 3f fa ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 170b: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1712: 00 1713: c7 04 24 01 00 00 00 movl $0x1,(%esp) 171a: e8 c1 08 00 00 call 1fe0 <printf> sem_signal(p); 171f: a1 70 2c 00 00 mov 0x2c70,%eax 1724: 89 04 24 mov %eax,(%esp) 1727: e8 9d fa ff ff call 11c9 <sem_signal> exit(); 172c: e8 07 07 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 1731: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1738: 00 00 00 173b: eb 0d jmp 174a <main+0x519> 173d: a1 84 2c 00 00 mov 0x2c84,%eax 1742: 83 c0 01 add $0x1,%eax 1745: a3 84 2c 00 00 mov %eax,0x2c84 174a: a1 84 2c 00 00 mov 0x2c84,%eax 174f: 3d 3e 42 0f 00 cmp $0xf423e,%eax 1754: 7e e7 jle 173d <main+0x50c> tid = thread_create(oReady, (void *) &arg); 1756: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 175d: 00 175e: c7 04 24 1f 1b 00 00 movl $0x1b1f,(%esp) 1765: e8 a9 0c 00 00 call 2413 <thread_create> 176a: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 176f: a1 88 2c 00 00 mov 0x2c88,%eax 1774: 85 c0 test %eax,%eax 1776: 75 33 jne 17ab <main+0x57a> sem_acquire(p); 1778: a1 70 2c 00 00 mov 0x2c70,%eax 177d: 89 04 24 mov %eax,(%esp) 1780: e8 c5 f9 ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1785: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 178c: 00 178d: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1794: e8 47 08 00 00 call 1fe0 <printf> sem_signal(p); 1799: a1 70 2c 00 00 mov 0x2c70,%eax 179e: 89 04 24 mov %eax,(%esp) 17a1: e8 23 fa ff ff call 11c9 <sem_signal> exit(); 17a6: e8 8d 06 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 17ab: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 17b2: 00 00 00 17b5: eb 0d jmp 17c4 <main+0x593> 17b7: a1 84 2c 00 00 mov 0x2c84,%eax 17bc: 83 c0 01 add $0x1,%eax 17bf: a3 84 2c 00 00 mov %eax,0x2c84 17c4: a1 84 2c 00 00 mov 0x2c84,%eax 17c9: 3d 3e 42 0f 00 cmp $0xf423e,%eax 17ce: 7e e7 jle 17b7 <main+0x586> tid = thread_create(hReady, (void *) &arg); 17d0: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 17d7: 00 17d8: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 17df: e8 2f 0c 00 00 call 2413 <thread_create> 17e4: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 17e9: a1 88 2c 00 00 mov 0x2c88,%eax 17ee: 85 c0 test %eax,%eax 17f0: 75 33 jne 1825 <main+0x5f4> sem_acquire(p); 17f2: a1 70 2c 00 00 mov 0x2c70,%eax 17f7: 89 04 24 mov %eax,(%esp) 17fa: e8 4b f9 ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 17ff: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1806: 00 1807: c7 04 24 01 00 00 00 movl $0x1,(%esp) 180e: e8 cd 07 00 00 call 1fe0 <printf> sem_signal(p); 1813: a1 70 2c 00 00 mov 0x2c70,%eax 1818: 89 04 24 mov %eax,(%esp) 181b: e8 a9 f9 ff ff call 11c9 <sem_signal> exit(); 1820: e8 13 06 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 1825: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 182c: 00 00 00 182f: eb 0d jmp 183e <main+0x60d> 1831: a1 84 2c 00 00 mov 0x2c84,%eax 1836: 83 c0 01 add $0x1,%eax 1839: a3 84 2c 00 00 mov %eax,0x2c84 183e: a1 84 2c 00 00 mov 0x2c84,%eax 1843: 3d 3e 42 0f 00 cmp $0xf423e,%eax 1848: 7e e7 jle 1831 <main+0x600> printf(1, "\nTest 3: 20 Hydrogen, 10 Oxygen (Thread creation order: H->O->H): \n"); sem_signal(p); sem_init(h, 2); sem_init(o, 1); for(water = 0; water < 10; water++){ 184a: a1 80 2c 00 00 mov 0x2c80,%eax 184f: 83 c0 01 add $0x1,%eax 1852: a3 80 2c 00 00 mov %eax,0x2c80 1857: a1 80 2c 00 00 mov 0x2c80,%eax 185c: 83 f8 09 cmp $0x9,%eax 185f: 0f 8e 77 fe ff ff jle 16dc <main+0x4ab> sem_signal(p); exit(); } for(i = 0; i < 999999; i++); } while(wait()>= 0); 1865: 90 nop 1866: e8 d5 05 00 00 call 1e40 <wait> 186b: 85 c0 test %eax,%eax 186d: 79 f7 jns 1866 <main+0x635> // Test 4: 20 hydrogen 10 oxygen (Thread creation order: H->H->O) sem_acquire(p); 186f: a1 70 2c 00 00 mov 0x2c70,%eax 1874: 89 04 24 mov %eax,(%esp) 1877: e8 ce f8 ff ff call 114a <sem_acquire> printf(1, "\nTest 4: 20 Hydrogen, 10 Oxygen (Thread creation order: H->H->O): \n"); 187c: c7 44 24 04 08 27 00 movl $0x2708,0x4(%esp) 1883: 00 1884: c7 04 24 01 00 00 00 movl $0x1,(%esp) 188b: e8 50 07 00 00 call 1fe0 <printf> sem_signal(p); 1890: a1 70 2c 00 00 mov 0x2c70,%eax 1895: 89 04 24 mov %eax,(%esp) 1898: e8 2c f9 ff ff call 11c9 <sem_signal> sem_init(h, 2); 189d: a1 68 2c 00 00 mov 0x2c68,%eax 18a2: c7 44 24 04 02 00 00 movl $0x2,0x4(%esp) 18a9: 00 18aa: 89 04 24 mov %eax,(%esp) 18ad: e8 63 f8 ff ff call 1115 <sem_init> sem_init(o, 1); 18b2: a1 6c 2c 00 00 mov 0x2c6c,%eax 18b7: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 18be: 00 18bf: 89 04 24 mov %eax,(%esp) 18c2: e8 4e f8 ff ff call 1115 <sem_init> for(water = 0; water < 10; water++){ 18c7: c7 05 80 2c 00 00 00 movl $0x0,0x2c80 18ce: 00 00 00 18d1: e9 7b 01 00 00 jmp 1a51 <main+0x820> tid = thread_create(hReady, (void *) &arg); 18d6: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 18dd: 00 18de: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 18e5: e8 29 0b 00 00 call 2413 <thread_create> 18ea: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 18ef: a1 88 2c 00 00 mov 0x2c88,%eax 18f4: 85 c0 test %eax,%eax 18f6: 75 33 jne 192b <main+0x6fa> sem_acquire(p); 18f8: a1 70 2c 00 00 mov 0x2c70,%eax 18fd: 89 04 24 mov %eax,(%esp) 1900: e8 45 f8 ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 1905: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 190c: 00 190d: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1914: e8 c7 06 00 00 call 1fe0 <printf> sem_signal(p); 1919: a1 70 2c 00 00 mov 0x2c70,%eax 191e: 89 04 24 mov %eax,(%esp) 1921: e8 a3 f8 ff ff call 11c9 <sem_signal> exit(); 1926: e8 0d 05 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 192b: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1932: 00 00 00 1935: eb 0d jmp 1944 <main+0x713> 1937: a1 84 2c 00 00 mov 0x2c84,%eax 193c: 83 c0 01 add $0x1,%eax 193f: a3 84 2c 00 00 mov %eax,0x2c84 1944: a1 84 2c 00 00 mov 0x2c84,%eax 1949: 3d 3e 42 0f 00 cmp $0xf423e,%eax 194e: 7e e7 jle 1937 <main+0x706> tid = thread_create(hReady, (void *) &arg); 1950: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 1957: 00 1958: c7 04 24 6e 1a 00 00 movl $0x1a6e,(%esp) 195f: e8 af 0a 00 00 call 2413 <thread_create> 1964: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 1969: a1 88 2c 00 00 mov 0x2c88,%eax 196e: 85 c0 test %eax,%eax 1970: 75 33 jne 19a5 <main+0x774> sem_acquire(p); 1972: a1 70 2c 00 00 mov 0x2c70,%eax 1977: 89 04 24 mov %eax,(%esp) 197a: e8 cb f7 ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 197f: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1986: 00 1987: c7 04 24 01 00 00 00 movl $0x1,(%esp) 198e: e8 4d 06 00 00 call 1fe0 <printf> sem_signal(p); 1993: a1 70 2c 00 00 mov 0x2c70,%eax 1998: 89 04 24 mov %eax,(%esp) 199b: e8 29 f8 ff ff call 11c9 <sem_signal> exit(); 19a0: e8 93 04 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 19a5: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 19ac: 00 00 00 19af: eb 0d jmp 19be <main+0x78d> 19b1: a1 84 2c 00 00 mov 0x2c84,%eax 19b6: 83 c0 01 add $0x1,%eax 19b9: a3 84 2c 00 00 mov %eax,0x2c84 19be: a1 84 2c 00 00 mov 0x2c84,%eax 19c3: 3d 3e 42 0f 00 cmp $0xf423e,%eax 19c8: 7e e7 jle 19b1 <main+0x780> tid = thread_create(oReady, (void *) &arg); 19ca: c7 44 24 04 4c 2c 00 movl $0x2c4c,0x4(%esp) 19d1: 00 19d2: c7 04 24 1f 1b 00 00 movl $0x1b1f,(%esp) 19d9: e8 35 0a 00 00 call 2413 <thread_create> 19de: a3 88 2c 00 00 mov %eax,0x2c88 if(tid <= 0){ 19e3: a1 88 2c 00 00 mov 0x2c88,%eax 19e8: 85 c0 test %eax,%eax 19ea: 75 33 jne 1a1f <main+0x7ee> sem_acquire(p); 19ec: a1 70 2c 00 00 mov 0x2c70,%eax 19f1: 89 04 24 mov %eax,(%esp) 19f4: e8 51 f7 ff ff call 114a <sem_acquire> printf(1, "Failed to create a thread\n"); 19f9: c7 44 24 04 65 26 00 movl $0x2665,0x4(%esp) 1a00: 00 1a01: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1a08: e8 d3 05 00 00 call 1fe0 <printf> sem_signal(p); 1a0d: a1 70 2c 00 00 mov 0x2c70,%eax 1a12: 89 04 24 mov %eax,(%esp) 1a15: e8 af f7 ff ff call 11c9 <sem_signal> exit(); 1a1a: e8 19 04 00 00 call 1e38 <exit> } for(i = 0; i < 999999; i++); 1a1f: c7 05 84 2c 00 00 00 movl $0x0,0x2c84 1a26: 00 00 00 1a29: eb 0d jmp 1a38 <main+0x807> 1a2b: a1 84 2c 00 00 mov 0x2c84,%eax 1a30: 83 c0 01 add $0x1,%eax 1a33: a3 84 2c 00 00 mov %eax,0x2c84 1a38: a1 84 2c 00 00 mov 0x2c84,%eax 1a3d: 3d 3e 42 0f 00 cmp $0xf423e,%eax 1a42: 7e e7 jle 1a2b <main+0x7fa> printf(1, "\nTest 4: 20 Hydrogen, 10 Oxygen (Thread creation order: H->H->O): \n"); sem_signal(p); sem_init(h, 2); sem_init(o, 1); for(water = 0; water < 10; water++){ 1a44: a1 80 2c 00 00 mov 0x2c80,%eax 1a49: 83 c0 01 add $0x1,%eax 1a4c: a3 80 2c 00 00 mov %eax,0x2c80 1a51: a1 80 2c 00 00 mov 0x2c80,%eax 1a56: 83 f8 09 cmp $0x9,%eax 1a59: 0f 8e 77 fe ff ff jle 18d6 <main+0x6a5> sem_signal(p); exit(); } for(i = 0; i < 999999; i++); } while(wait()>= 0); 1a5f: 90 nop 1a60: e8 db 03 00 00 call 1e40 <wait> 1a65: 85 c0 test %eax,%eax 1a67: 79 f7 jns 1a60 <main+0x82f> exit(); 1a69: e8 ca 03 00 00 call 1e38 <exit> 00001a6e <hReady>: return 0; } //Hydrogen void hReady(){ 1a6e: 55 push %ebp 1a6f: 89 e5 mov %esp,%ebp 1a71: 83 ec 18 sub $0x18,%esp sem_acquire(p); 1a74: a1 70 2c 00 00 mov 0x2c70,%eax 1a79: 89 04 24 mov %eax,(%esp) 1a7c: e8 c9 f6 ff ff call 114a <sem_acquire> printf(1, "Hydrogen ready\n"); 1a81: c7 44 24 04 4c 27 00 movl $0x274c,0x4(%esp) 1a88: 00 1a89: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1a90: e8 4b 05 00 00 call 1fe0 <printf> sem_signal(p); 1a95: a1 70 2c 00 00 mov 0x2c70,%eax 1a9a: 89 04 24 mov %eax,(%esp) 1a9d: e8 27 f7 ff ff call 11c9 <sem_signal> sem_acquire(h); 1aa2: a1 68 2c 00 00 mov 0x2c68,%eax 1aa7: 89 04 24 mov %eax,(%esp) 1aaa: e8 9b f6 ff ff call 114a <sem_acquire> if(h->count == 0 && o->count == 0){ 1aaf: a1 68 2c 00 00 mov 0x2c68,%eax 1ab4: 8b 00 mov (%eax),%eax 1ab6: 85 c0 test %eax,%eax 1ab8: 75 60 jne 1b1a <hReady+0xac> 1aba: a1 6c 2c 00 00 mov 0x2c6c,%eax 1abf: 8b 00 mov (%eax),%eax 1ac1: 85 c0 test %eax,%eax 1ac3: 75 55 jne 1b1a <hReady+0xac> sem_acquire(p); 1ac5: a1 70 2c 00 00 mov 0x2c70,%eax 1aca: 89 04 24 mov %eax,(%esp) 1acd: e8 78 f6 ff ff call 114a <sem_acquire> printf(1, "*Water created*\n"); 1ad2: c7 44 24 04 5c 27 00 movl $0x275c,0x4(%esp) 1ad9: 00 1ada: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1ae1: e8 fa 04 00 00 call 1fe0 <printf> sem_signal(p); 1ae6: a1 70 2c 00 00 mov 0x2c70,%eax 1aeb: 89 04 24 mov %eax,(%esp) 1aee: e8 d6 f6 ff ff call 11c9 <sem_signal> sem_signal(h); 1af3: a1 68 2c 00 00 mov 0x2c68,%eax 1af8: 89 04 24 mov %eax,(%esp) 1afb: e8 c9 f6 ff ff call 11c9 <sem_signal> sem_signal(h); 1b00: a1 68 2c 00 00 mov 0x2c68,%eax 1b05: 89 04 24 mov %eax,(%esp) 1b08: e8 bc f6 ff ff call 11c9 <sem_signal> sem_signal(o); 1b0d: a1 6c 2c 00 00 mov 0x2c6c,%eax 1b12: 89 04 24 mov %eax,(%esp) 1b15: e8 af f6 ff ff call 11c9 <sem_signal> } texit(); 1b1a: e8 c1 03 00 00 call 1ee0 <texit> 00001b1f <oReady>: } //Oxygen void oReady(){ 1b1f: 55 push %ebp 1b20: 89 e5 mov %esp,%ebp 1b22: 83 ec 18 sub $0x18,%esp sem_acquire(p); 1b25: a1 70 2c 00 00 mov 0x2c70,%eax 1b2a: 89 04 24 mov %eax,(%esp) 1b2d: e8 18 f6 ff ff call 114a <sem_acquire> printf(1, "Oxygen ready\n"); 1b32: c7 44 24 04 6d 27 00 movl $0x276d,0x4(%esp) 1b39: 00 1b3a: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1b41: e8 9a 04 00 00 call 1fe0 <printf> sem_signal(p); 1b46: a1 70 2c 00 00 mov 0x2c70,%eax 1b4b: 89 04 24 mov %eax,(%esp) 1b4e: e8 76 f6 ff ff call 11c9 <sem_signal> sem_acquire(o); 1b53: a1 6c 2c 00 00 mov 0x2c6c,%eax 1b58: 89 04 24 mov %eax,(%esp) 1b5b: e8 ea f5 ff ff call 114a <sem_acquire> if(h->count == 0 && o->count == 0){ 1b60: a1 68 2c 00 00 mov 0x2c68,%eax 1b65: 8b 00 mov (%eax),%eax 1b67: 85 c0 test %eax,%eax 1b69: 75 60 jne 1bcb <oReady+0xac> 1b6b: a1 6c 2c 00 00 mov 0x2c6c,%eax 1b70: 8b 00 mov (%eax),%eax 1b72: 85 c0 test %eax,%eax 1b74: 75 55 jne 1bcb <oReady+0xac> sem_acquire(p); 1b76: a1 70 2c 00 00 mov 0x2c70,%eax 1b7b: 89 04 24 mov %eax,(%esp) 1b7e: e8 c7 f5 ff ff call 114a <sem_acquire> printf(1, "*Water created*\n"); 1b83: c7 44 24 04 5c 27 00 movl $0x275c,0x4(%esp) 1b8a: 00 1b8b: c7 04 24 01 00 00 00 movl $0x1,(%esp) 1b92: e8 49 04 00 00 call 1fe0 <printf> sem_signal(p); 1b97: a1 70 2c 00 00 mov 0x2c70,%eax 1b9c: 89 04 24 mov %eax,(%esp) 1b9f: e8 25 f6 ff ff call 11c9 <sem_signal> sem_signal(h); 1ba4: a1 68 2c 00 00 mov 0x2c68,%eax 1ba9: 89 04 24 mov %eax,(%esp) 1bac: e8 18 f6 ff ff call 11c9 <sem_signal> sem_signal(h); 1bb1: a1 68 2c 00 00 mov 0x2c68,%eax 1bb6: 89 04 24 mov %eax,(%esp) 1bb9: e8 0b f6 ff ff call 11c9 <sem_signal> sem_signal(o); 1bbe: a1 6c 2c 00 00 mov 0x2c6c,%eax 1bc3: 89 04 24 mov %eax,(%esp) 1bc6: e8 fe f5 ff ff call 11c9 <sem_signal> } texit(); 1bcb: e8 10 03 00 00 call 1ee0 <texit> 00001bd0 <stosb>: "cc"); } static inline void stosb(void *addr, int data, int cnt) { 1bd0: 55 push %ebp 1bd1: 89 e5 mov %esp,%ebp 1bd3: 57 push %edi 1bd4: 53 push %ebx asm volatile("cld; rep stosb" : 1bd5: 8b 4d 08 mov 0x8(%ebp),%ecx 1bd8: 8b 55 10 mov 0x10(%ebp),%edx 1bdb: 8b 45 0c mov 0xc(%ebp),%eax 1bde: 89 cb mov %ecx,%ebx 1be0: 89 df mov %ebx,%edi 1be2: 89 d1 mov %edx,%ecx 1be4: fc cld 1be5: f3 aa rep stos %al,%es:(%edi) 1be7: 89 ca mov %ecx,%edx 1be9: 89 fb mov %edi,%ebx 1beb: 89 5d 08 mov %ebx,0x8(%ebp) 1bee: 89 55 10 mov %edx,0x10(%ebp) "=D" (addr), "=c" (cnt) : "0" (addr), "1" (cnt), "a" (data) : "memory", "cc"); } 1bf1: 5b pop %ebx 1bf2: 5f pop %edi 1bf3: 5d pop %ebp 1bf4: c3 ret 00001bf5 <strcpy>: #include "user.h" #include "x86.h" char* strcpy(char *s, char *t) { 1bf5: 55 push %ebp 1bf6: 89 e5 mov %esp,%ebp 1bf8: 83 ec 10 sub $0x10,%esp char *os; os = s; 1bfb: 8b 45 08 mov 0x8(%ebp),%eax 1bfe: 89 45 fc mov %eax,-0x4(%ebp) while((*s++ = *t++) != 0) 1c01: 90 nop 1c02: 8b 45 08 mov 0x8(%ebp),%eax 1c05: 8d 50 01 lea 0x1(%eax),%edx 1c08: 89 55 08 mov %edx,0x8(%ebp) 1c0b: 8b 55 0c mov 0xc(%ebp),%edx 1c0e: 8d 4a 01 lea 0x1(%edx),%ecx 1c11: 89 4d 0c mov %ecx,0xc(%ebp) 1c14: 0f b6 12 movzbl (%edx),%edx 1c17: 88 10 mov %dl,(%eax) 1c19: 0f b6 00 movzbl (%eax),%eax 1c1c: 84 c0 test %al,%al 1c1e: 75 e2 jne 1c02 <strcpy+0xd> ; return os; 1c20: 8b 45 fc mov -0x4(%ebp),%eax } 1c23: c9 leave 1c24: c3 ret 00001c25 <strcmp>: int strcmp(const char *p, const char *q) { 1c25: 55 push %ebp 1c26: 89 e5 mov %esp,%ebp while(*p && *p == *q) 1c28: eb 08 jmp 1c32 <strcmp+0xd> p++, q++; 1c2a: 83 45 08 01 addl $0x1,0x8(%ebp) 1c2e: 83 45 0c 01 addl $0x1,0xc(%ebp) } int strcmp(const char *p, const char *q) { while(*p && *p == *q) 1c32: 8b 45 08 mov 0x8(%ebp),%eax 1c35: 0f b6 00 movzbl (%eax),%eax 1c38: 84 c0 test %al,%al 1c3a: 74 10 je 1c4c <strcmp+0x27> 1c3c: 8b 45 08 mov 0x8(%ebp),%eax 1c3f: 0f b6 10 movzbl (%eax),%edx 1c42: 8b 45 0c mov 0xc(%ebp),%eax 1c45: 0f b6 00 movzbl (%eax),%eax 1c48: 38 c2 cmp %al,%dl 1c4a: 74 de je 1c2a <strcmp+0x5> p++, q++; return (uchar)*p - (uchar)*q; 1c4c: 8b 45 08 mov 0x8(%ebp),%eax 1c4f: 0f b6 00 movzbl (%eax),%eax 1c52: 0f b6 d0 movzbl %al,%edx 1c55: 8b 45 0c mov 0xc(%ebp),%eax 1c58: 0f b6 00 movzbl (%eax),%eax 1c5b: 0f b6 c0 movzbl %al,%eax 1c5e: 29 c2 sub %eax,%edx 1c60: 89 d0 mov %edx,%eax } 1c62: 5d pop %ebp 1c63: c3 ret 00001c64 <strlen>: uint strlen(char *s) { 1c64: 55 push %ebp 1c65: 89 e5 mov %esp,%ebp 1c67: 83 ec 10 sub $0x10,%esp int n; for(n = 0; s[n]; n++) 1c6a: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) 1c71: eb 04 jmp 1c77 <strlen+0x13> 1c73: 83 45 fc 01 addl $0x1,-0x4(%ebp) 1c77: 8b 55 fc mov -0x4(%ebp),%edx 1c7a: 8b 45 08 mov 0x8(%ebp),%eax 1c7d: 01 d0 add %edx,%eax 1c7f: 0f b6 00 movzbl (%eax),%eax 1c82: 84 c0 test %al,%al 1c84: 75 ed jne 1c73 <strlen+0xf> ; return n; 1c86: 8b 45 fc mov -0x4(%ebp),%eax } 1c89: c9 leave 1c8a: c3 ret 00001c8b <memset>: void* memset(void *dst, int c, uint n) { 1c8b: 55 push %ebp 1c8c: 89 e5 mov %esp,%ebp 1c8e: 83 ec 0c sub $0xc,%esp stosb(dst, c, n); 1c91: 8b 45 10 mov 0x10(%ebp),%eax 1c94: 89 44 24 08 mov %eax,0x8(%esp) 1c98: 8b 45 0c mov 0xc(%ebp),%eax 1c9b: 89 44 24 04 mov %eax,0x4(%esp) 1c9f: 8b 45 08 mov 0x8(%ebp),%eax 1ca2: 89 04 24 mov %eax,(%esp) 1ca5: e8 26 ff ff ff call 1bd0 <stosb> return dst; 1caa: 8b 45 08 mov 0x8(%ebp),%eax } 1cad: c9 leave 1cae: c3 ret 00001caf <strchr>: char* strchr(const char *s, char c) { 1caf: 55 push %ebp 1cb0: 89 e5 mov %esp,%ebp 1cb2: 83 ec 04 sub $0x4,%esp 1cb5: 8b 45 0c mov 0xc(%ebp),%eax 1cb8: 88 45 fc mov %al,-0x4(%ebp) for(; *s; s++) 1cbb: eb 14 jmp 1cd1 <strchr+0x22> if(*s == c) 1cbd: 8b 45 08 mov 0x8(%ebp),%eax 1cc0: 0f b6 00 movzbl (%eax),%eax 1cc3: 3a 45 fc cmp -0x4(%ebp),%al 1cc6: 75 05 jne 1ccd <strchr+0x1e> return (char*)s; 1cc8: 8b 45 08 mov 0x8(%ebp),%eax 1ccb: eb 13 jmp 1ce0 <strchr+0x31> } char* strchr(const char *s, char c) { for(; *s; s++) 1ccd: 83 45 08 01 addl $0x1,0x8(%ebp) 1cd1: 8b 45 08 mov 0x8(%ebp),%eax 1cd4: 0f b6 00 movzbl (%eax),%eax 1cd7: 84 c0 test %al,%al 1cd9: 75 e2 jne 1cbd <strchr+0xe> if(*s == c) return (char*)s; return 0; 1cdb: b8 00 00 00 00 mov $0x0,%eax } 1ce0: c9 leave 1ce1: c3 ret 00001ce2 <gets>: char* gets(char *buf, int max) { 1ce2: 55 push %ebp 1ce3: 89 e5 mov %esp,%ebp 1ce5: 83 ec 28 sub $0x28,%esp int i, cc; char c; for(i=0; i+1 < max; ){ 1ce8: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) 1cef: eb 4c jmp 1d3d <gets+0x5b> cc = read(0, &c, 1); 1cf1: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1cf8: 00 1cf9: 8d 45 ef lea -0x11(%ebp),%eax 1cfc: 89 44 24 04 mov %eax,0x4(%esp) 1d00: c7 04 24 00 00 00 00 movl $0x0,(%esp) 1d07: e8 44 01 00 00 call 1e50 <read> 1d0c: 89 45 f0 mov %eax,-0x10(%ebp) if(cc < 1) 1d0f: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1d13: 7f 02 jg 1d17 <gets+0x35> break; 1d15: eb 31 jmp 1d48 <gets+0x66> buf[i++] = c; 1d17: 8b 45 f4 mov -0xc(%ebp),%eax 1d1a: 8d 50 01 lea 0x1(%eax),%edx 1d1d: 89 55 f4 mov %edx,-0xc(%ebp) 1d20: 89 c2 mov %eax,%edx 1d22: 8b 45 08 mov 0x8(%ebp),%eax 1d25: 01 c2 add %eax,%edx 1d27: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1d2b: 88 02 mov %al,(%edx) if(c == '\n' || c == '\r') 1d2d: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1d31: 3c 0a cmp $0xa,%al 1d33: 74 13 je 1d48 <gets+0x66> 1d35: 0f b6 45 ef movzbl -0x11(%ebp),%eax 1d39: 3c 0d cmp $0xd,%al 1d3b: 74 0b je 1d48 <gets+0x66> gets(char *buf, int max) { int i, cc; char c; for(i=0; i+1 < max; ){ 1d3d: 8b 45 f4 mov -0xc(%ebp),%eax 1d40: 83 c0 01 add $0x1,%eax 1d43: 3b 45 0c cmp 0xc(%ebp),%eax 1d46: 7c a9 jl 1cf1 <gets+0xf> break; buf[i++] = c; if(c == '\n' || c == '\r') break; } buf[i] = '\0'; 1d48: 8b 55 f4 mov -0xc(%ebp),%edx 1d4b: 8b 45 08 mov 0x8(%ebp),%eax 1d4e: 01 d0 add %edx,%eax 1d50: c6 00 00 movb $0x0,(%eax) return buf; 1d53: 8b 45 08 mov 0x8(%ebp),%eax } 1d56: c9 leave 1d57: c3 ret 00001d58 <stat>: int stat(char *n, struct stat *st) { 1d58: 55 push %ebp 1d59: 89 e5 mov %esp,%ebp 1d5b: 83 ec 28 sub $0x28,%esp int fd; int r; fd = open(n, O_RDONLY); 1d5e: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 1d65: 00 1d66: 8b 45 08 mov 0x8(%ebp),%eax 1d69: 89 04 24 mov %eax,(%esp) 1d6c: e8 07 01 00 00 call 1e78 <open> 1d71: 89 45 f4 mov %eax,-0xc(%ebp) if(fd < 0) 1d74: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1d78: 79 07 jns 1d81 <stat+0x29> return -1; 1d7a: b8 ff ff ff ff mov $0xffffffff,%eax 1d7f: eb 23 jmp 1da4 <stat+0x4c> r = fstat(fd, st); 1d81: 8b 45 0c mov 0xc(%ebp),%eax 1d84: 89 44 24 04 mov %eax,0x4(%esp) 1d88: 8b 45 f4 mov -0xc(%ebp),%eax 1d8b: 89 04 24 mov %eax,(%esp) 1d8e: e8 fd 00 00 00 call 1e90 <fstat> 1d93: 89 45 f0 mov %eax,-0x10(%ebp) close(fd); 1d96: 8b 45 f4 mov -0xc(%ebp),%eax 1d99: 89 04 24 mov %eax,(%esp) 1d9c: e8 bf 00 00 00 call 1e60 <close> return r; 1da1: 8b 45 f0 mov -0x10(%ebp),%eax } 1da4: c9 leave 1da5: c3 ret 00001da6 <atoi>: int atoi(const char *s) { 1da6: 55 push %ebp 1da7: 89 e5 mov %esp,%ebp 1da9: 83 ec 10 sub $0x10,%esp int n; n = 0; 1dac: c7 45 fc 00 00 00 00 movl $0x0,-0x4(%ebp) while('0' <= *s && *s <= '9') 1db3: eb 25 jmp 1dda <atoi+0x34> n = n*10 + *s++ - '0'; 1db5: 8b 55 fc mov -0x4(%ebp),%edx 1db8: 89 d0 mov %edx,%eax 1dba: c1 e0 02 shl $0x2,%eax 1dbd: 01 d0 add %edx,%eax 1dbf: 01 c0 add %eax,%eax 1dc1: 89 c1 mov %eax,%ecx 1dc3: 8b 45 08 mov 0x8(%ebp),%eax 1dc6: 8d 50 01 lea 0x1(%eax),%edx 1dc9: 89 55 08 mov %edx,0x8(%ebp) 1dcc: 0f b6 00 movzbl (%eax),%eax 1dcf: 0f be c0 movsbl %al,%eax 1dd2: 01 c8 add %ecx,%eax 1dd4: 83 e8 30 sub $0x30,%eax 1dd7: 89 45 fc mov %eax,-0x4(%ebp) atoi(const char *s) { int n; n = 0; while('0' <= *s && *s <= '9') 1dda: 8b 45 08 mov 0x8(%ebp),%eax 1ddd: 0f b6 00 movzbl (%eax),%eax 1de0: 3c 2f cmp $0x2f,%al 1de2: 7e 0a jle 1dee <atoi+0x48> 1de4: 8b 45 08 mov 0x8(%ebp),%eax 1de7: 0f b6 00 movzbl (%eax),%eax 1dea: 3c 39 cmp $0x39,%al 1dec: 7e c7 jle 1db5 <atoi+0xf> n = n*10 + *s++ - '0'; return n; 1dee: 8b 45 fc mov -0x4(%ebp),%eax } 1df1: c9 leave 1df2: c3 ret 00001df3 <memmove>: void* memmove(void *vdst, void *vsrc, int n) { 1df3: 55 push %ebp 1df4: 89 e5 mov %esp,%ebp 1df6: 83 ec 10 sub $0x10,%esp char *dst, *src; dst = vdst; 1df9: 8b 45 08 mov 0x8(%ebp),%eax 1dfc: 89 45 fc mov %eax,-0x4(%ebp) src = vsrc; 1dff: 8b 45 0c mov 0xc(%ebp),%eax 1e02: 89 45 f8 mov %eax,-0x8(%ebp) while(n-- > 0) 1e05: eb 17 jmp 1e1e <memmove+0x2b> *dst++ = *src++; 1e07: 8b 45 fc mov -0x4(%ebp),%eax 1e0a: 8d 50 01 lea 0x1(%eax),%edx 1e0d: 89 55 fc mov %edx,-0x4(%ebp) 1e10: 8b 55 f8 mov -0x8(%ebp),%edx 1e13: 8d 4a 01 lea 0x1(%edx),%ecx 1e16: 89 4d f8 mov %ecx,-0x8(%ebp) 1e19: 0f b6 12 movzbl (%edx),%edx 1e1c: 88 10 mov %dl,(%eax) { char *dst, *src; dst = vdst; src = vsrc; while(n-- > 0) 1e1e: 8b 45 10 mov 0x10(%ebp),%eax 1e21: 8d 50 ff lea -0x1(%eax),%edx 1e24: 89 55 10 mov %edx,0x10(%ebp) 1e27: 85 c0 test %eax,%eax 1e29: 7f dc jg 1e07 <memmove+0x14> *dst++ = *src++; return vdst; 1e2b: 8b 45 08 mov 0x8(%ebp),%eax } 1e2e: c9 leave 1e2f: c3 ret 00001e30 <fork>: name: \ movl $SYS_ ## name, %eax; \ int $T_SYSCALL; \ ret SYSCALL(fork) 1e30: b8 01 00 00 00 mov $0x1,%eax 1e35: cd 40 int $0x40 1e37: c3 ret 00001e38 <exit>: SYSCALL(exit) 1e38: b8 02 00 00 00 mov $0x2,%eax 1e3d: cd 40 int $0x40 1e3f: c3 ret 00001e40 <wait>: SYSCALL(wait) 1e40: b8 03 00 00 00 mov $0x3,%eax 1e45: cd 40 int $0x40 1e47: c3 ret 00001e48 <pipe>: SYSCALL(pipe) 1e48: b8 04 00 00 00 mov $0x4,%eax 1e4d: cd 40 int $0x40 1e4f: c3 ret 00001e50 <read>: SYSCALL(read) 1e50: b8 05 00 00 00 mov $0x5,%eax 1e55: cd 40 int $0x40 1e57: c3 ret 00001e58 <write>: SYSCALL(write) 1e58: b8 10 00 00 00 mov $0x10,%eax 1e5d: cd 40 int $0x40 1e5f: c3 ret 00001e60 <close>: SYSCALL(close) 1e60: b8 15 00 00 00 mov $0x15,%eax 1e65: cd 40 int $0x40 1e67: c3 ret 00001e68 <kill>: SYSCALL(kill) 1e68: b8 06 00 00 00 mov $0x6,%eax 1e6d: cd 40 int $0x40 1e6f: c3 ret 00001e70 <exec>: SYSCALL(exec) 1e70: b8 07 00 00 00 mov $0x7,%eax 1e75: cd 40 int $0x40 1e77: c3 ret 00001e78 <open>: SYSCALL(open) 1e78: b8 0f 00 00 00 mov $0xf,%eax 1e7d: cd 40 int $0x40 1e7f: c3 ret 00001e80 <mknod>: SYSCALL(mknod) 1e80: b8 11 00 00 00 mov $0x11,%eax 1e85: cd 40 int $0x40 1e87: c3 ret 00001e88 <unlink>: SYSCALL(unlink) 1e88: b8 12 00 00 00 mov $0x12,%eax 1e8d: cd 40 int $0x40 1e8f: c3 ret 00001e90 <fstat>: SYSCALL(fstat) 1e90: b8 08 00 00 00 mov $0x8,%eax 1e95: cd 40 int $0x40 1e97: c3 ret 00001e98 <link>: SYSCALL(link) 1e98: b8 13 00 00 00 mov $0x13,%eax 1e9d: cd 40 int $0x40 1e9f: c3 ret 00001ea0 <mkdir>: SYSCALL(mkdir) 1ea0: b8 14 00 00 00 mov $0x14,%eax 1ea5: cd 40 int $0x40 1ea7: c3 ret 00001ea8 <chdir>: SYSCALL(chdir) 1ea8: b8 09 00 00 00 mov $0x9,%eax 1ead: cd 40 int $0x40 1eaf: c3 ret 00001eb0 <dup>: SYSCALL(dup) 1eb0: b8 0a 00 00 00 mov $0xa,%eax 1eb5: cd 40 int $0x40 1eb7: c3 ret 00001eb8 <getpid>: SYSCALL(getpid) 1eb8: b8 0b 00 00 00 mov $0xb,%eax 1ebd: cd 40 int $0x40 1ebf: c3 ret 00001ec0 <sbrk>: SYSCALL(sbrk) 1ec0: b8 0c 00 00 00 mov $0xc,%eax 1ec5: cd 40 int $0x40 1ec7: c3 ret 00001ec8 <sleep>: SYSCALL(sleep) 1ec8: b8 0d 00 00 00 mov $0xd,%eax 1ecd: cd 40 int $0x40 1ecf: c3 ret 00001ed0 <uptime>: SYSCALL(uptime) 1ed0: b8 0e 00 00 00 mov $0xe,%eax 1ed5: cd 40 int $0x40 1ed7: c3 ret 00001ed8 <clone>: SYSCALL(clone) 1ed8: b8 16 00 00 00 mov $0x16,%eax 1edd: cd 40 int $0x40 1edf: c3 ret 00001ee0 <texit>: SYSCALL(texit) 1ee0: b8 17 00 00 00 mov $0x17,%eax 1ee5: cd 40 int $0x40 1ee7: c3 ret 00001ee8 <tsleep>: SYSCALL(tsleep) 1ee8: b8 18 00 00 00 mov $0x18,%eax 1eed: cd 40 int $0x40 1eef: c3 ret 00001ef0 <twakeup>: SYSCALL(twakeup) 1ef0: b8 19 00 00 00 mov $0x19,%eax 1ef5: cd 40 int $0x40 1ef7: c3 ret 00001ef8 <thread_yield>: SYSCALL(thread_yield) 1ef8: b8 1a 00 00 00 mov $0x1a,%eax 1efd: cd 40 int $0x40 1eff: c3 ret 00001f00 <putc>: #include "stat.h" #include "user.h" static void putc(int fd, char c) { 1f00: 55 push %ebp 1f01: 89 e5 mov %esp,%ebp 1f03: 83 ec 18 sub $0x18,%esp 1f06: 8b 45 0c mov 0xc(%ebp),%eax 1f09: 88 45 f4 mov %al,-0xc(%ebp) write(fd, &c, 1); 1f0c: c7 44 24 08 01 00 00 movl $0x1,0x8(%esp) 1f13: 00 1f14: 8d 45 f4 lea -0xc(%ebp),%eax 1f17: 89 44 24 04 mov %eax,0x4(%esp) 1f1b: 8b 45 08 mov 0x8(%ebp),%eax 1f1e: 89 04 24 mov %eax,(%esp) 1f21: e8 32 ff ff ff call 1e58 <write> } 1f26: c9 leave 1f27: c3 ret 00001f28 <printint>: static void printint(int fd, int xx, int base, int sgn) { 1f28: 55 push %ebp 1f29: 89 e5 mov %esp,%ebp 1f2b: 56 push %esi 1f2c: 53 push %ebx 1f2d: 83 ec 30 sub $0x30,%esp static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; 1f30: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) if(sgn && xx < 0){ 1f37: 83 7d 14 00 cmpl $0x0,0x14(%ebp) 1f3b: 74 17 je 1f54 <printint+0x2c> 1f3d: 83 7d 0c 00 cmpl $0x0,0xc(%ebp) 1f41: 79 11 jns 1f54 <printint+0x2c> neg = 1; 1f43: c7 45 f0 01 00 00 00 movl $0x1,-0x10(%ebp) x = -xx; 1f4a: 8b 45 0c mov 0xc(%ebp),%eax 1f4d: f7 d8 neg %eax 1f4f: 89 45 ec mov %eax,-0x14(%ebp) 1f52: eb 06 jmp 1f5a <printint+0x32> } else { x = xx; 1f54: 8b 45 0c mov 0xc(%ebp),%eax 1f57: 89 45 ec mov %eax,-0x14(%ebp) } i = 0; 1f5a: c7 45 f4 00 00 00 00 movl $0x0,-0xc(%ebp) do{ buf[i++] = digits[x % base]; 1f61: 8b 4d f4 mov -0xc(%ebp),%ecx 1f64: 8d 41 01 lea 0x1(%ecx),%eax 1f67: 89 45 f4 mov %eax,-0xc(%ebp) 1f6a: 8b 5d 10 mov 0x10(%ebp),%ebx 1f6d: 8b 45 ec mov -0x14(%ebp),%eax 1f70: ba 00 00 00 00 mov $0x0,%edx 1f75: f7 f3 div %ebx 1f77: 89 d0 mov %edx,%eax 1f79: 0f b6 80 50 2c 00 00 movzbl 0x2c50(%eax),%eax 1f80: 88 44 0d dc mov %al,-0x24(%ebp,%ecx,1) }while((x /= base) != 0); 1f84: 8b 75 10 mov 0x10(%ebp),%esi 1f87: 8b 45 ec mov -0x14(%ebp),%eax 1f8a: ba 00 00 00 00 mov $0x0,%edx 1f8f: f7 f6 div %esi 1f91: 89 45 ec mov %eax,-0x14(%ebp) 1f94: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 1f98: 75 c7 jne 1f61 <printint+0x39> if(neg) 1f9a: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 1f9e: 74 10 je 1fb0 <printint+0x88> buf[i++] = '-'; 1fa0: 8b 45 f4 mov -0xc(%ebp),%eax 1fa3: 8d 50 01 lea 0x1(%eax),%edx 1fa6: 89 55 f4 mov %edx,-0xc(%ebp) 1fa9: c6 44 05 dc 2d movb $0x2d,-0x24(%ebp,%eax,1) while(--i >= 0) 1fae: eb 1f jmp 1fcf <printint+0xa7> 1fb0: eb 1d jmp 1fcf <printint+0xa7> putc(fd, buf[i]); 1fb2: 8d 55 dc lea -0x24(%ebp),%edx 1fb5: 8b 45 f4 mov -0xc(%ebp),%eax 1fb8: 01 d0 add %edx,%eax 1fba: 0f b6 00 movzbl (%eax),%eax 1fbd: 0f be c0 movsbl %al,%eax 1fc0: 89 44 24 04 mov %eax,0x4(%esp) 1fc4: 8b 45 08 mov 0x8(%ebp),%eax 1fc7: 89 04 24 mov %eax,(%esp) 1fca: e8 31 ff ff ff call 1f00 <putc> buf[i++] = digits[x % base]; }while((x /= base) != 0); if(neg) buf[i++] = '-'; while(--i >= 0) 1fcf: 83 6d f4 01 subl $0x1,-0xc(%ebp) 1fd3: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 1fd7: 79 d9 jns 1fb2 <printint+0x8a> putc(fd, buf[i]); } 1fd9: 83 c4 30 add $0x30,%esp 1fdc: 5b pop %ebx 1fdd: 5e pop %esi 1fde: 5d pop %ebp 1fdf: c3 ret 00001fe0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char *fmt, ...) { 1fe0: 55 push %ebp 1fe1: 89 e5 mov %esp,%ebp 1fe3: 83 ec 38 sub $0x38,%esp char *s; int c, i, state; uint *ap; state = 0; 1fe6: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) ap = (uint*)(void*)&fmt + 1; 1fed: 8d 45 0c lea 0xc(%ebp),%eax 1ff0: 83 c0 04 add $0x4,%eax 1ff3: 89 45 e8 mov %eax,-0x18(%ebp) for(i = 0; fmt[i]; i++){ 1ff6: c7 45 f0 00 00 00 00 movl $0x0,-0x10(%ebp) 1ffd: e9 7c 01 00 00 jmp 217e <printf+0x19e> c = fmt[i] & 0xff; 2002: 8b 55 0c mov 0xc(%ebp),%edx 2005: 8b 45 f0 mov -0x10(%ebp),%eax 2008: 01 d0 add %edx,%eax 200a: 0f b6 00 movzbl (%eax),%eax 200d: 0f be c0 movsbl %al,%eax 2010: 25 ff 00 00 00 and $0xff,%eax 2015: 89 45 e4 mov %eax,-0x1c(%ebp) if(state == 0){ 2018: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 201c: 75 2c jne 204a <printf+0x6a> if(c == '%'){ 201e: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 2022: 75 0c jne 2030 <printf+0x50> state = '%'; 2024: c7 45 ec 25 00 00 00 movl $0x25,-0x14(%ebp) 202b: e9 4a 01 00 00 jmp 217a <printf+0x19a> } else { putc(fd, c); 2030: 8b 45 e4 mov -0x1c(%ebp),%eax 2033: 0f be c0 movsbl %al,%eax 2036: 89 44 24 04 mov %eax,0x4(%esp) 203a: 8b 45 08 mov 0x8(%ebp),%eax 203d: 89 04 24 mov %eax,(%esp) 2040: e8 bb fe ff ff call 1f00 <putc> 2045: e9 30 01 00 00 jmp 217a <printf+0x19a> } } else if(state == '%'){ 204a: 83 7d ec 25 cmpl $0x25,-0x14(%ebp) 204e: 0f 85 26 01 00 00 jne 217a <printf+0x19a> if(c == 'd'){ 2054: 83 7d e4 64 cmpl $0x64,-0x1c(%ebp) 2058: 75 2d jne 2087 <printf+0xa7> printint(fd, *ap, 10, 1); 205a: 8b 45 e8 mov -0x18(%ebp),%eax 205d: 8b 00 mov (%eax),%eax 205f: c7 44 24 0c 01 00 00 movl $0x1,0xc(%esp) 2066: 00 2067: c7 44 24 08 0a 00 00 movl $0xa,0x8(%esp) 206e: 00 206f: 89 44 24 04 mov %eax,0x4(%esp) 2073: 8b 45 08 mov 0x8(%ebp),%eax 2076: 89 04 24 mov %eax,(%esp) 2079: e8 aa fe ff ff call 1f28 <printint> ap++; 207e: 83 45 e8 04 addl $0x4,-0x18(%ebp) 2082: e9 ec 00 00 00 jmp 2173 <printf+0x193> } else if(c == 'x' || c == 'p'){ 2087: 83 7d e4 78 cmpl $0x78,-0x1c(%ebp) 208b: 74 06 je 2093 <printf+0xb3> 208d: 83 7d e4 70 cmpl $0x70,-0x1c(%ebp) 2091: 75 2d jne 20c0 <printf+0xe0> printint(fd, *ap, 16, 0); 2093: 8b 45 e8 mov -0x18(%ebp),%eax 2096: 8b 00 mov (%eax),%eax 2098: c7 44 24 0c 00 00 00 movl $0x0,0xc(%esp) 209f: 00 20a0: c7 44 24 08 10 00 00 movl $0x10,0x8(%esp) 20a7: 00 20a8: 89 44 24 04 mov %eax,0x4(%esp) 20ac: 8b 45 08 mov 0x8(%ebp),%eax 20af: 89 04 24 mov %eax,(%esp) 20b2: e8 71 fe ff ff call 1f28 <printint> ap++; 20b7: 83 45 e8 04 addl $0x4,-0x18(%ebp) 20bb: e9 b3 00 00 00 jmp 2173 <printf+0x193> } else if(c == 's'){ 20c0: 83 7d e4 73 cmpl $0x73,-0x1c(%ebp) 20c4: 75 45 jne 210b <printf+0x12b> s = (char*)*ap; 20c6: 8b 45 e8 mov -0x18(%ebp),%eax 20c9: 8b 00 mov (%eax),%eax 20cb: 89 45 f4 mov %eax,-0xc(%ebp) ap++; 20ce: 83 45 e8 04 addl $0x4,-0x18(%ebp) if(s == 0) 20d2: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 20d6: 75 09 jne 20e1 <printf+0x101> s = "(null)"; 20d8: c7 45 f4 7b 27 00 00 movl $0x277b,-0xc(%ebp) while(*s != 0){ 20df: eb 1e jmp 20ff <printf+0x11f> 20e1: eb 1c jmp 20ff <printf+0x11f> putc(fd, *s); 20e3: 8b 45 f4 mov -0xc(%ebp),%eax 20e6: 0f b6 00 movzbl (%eax),%eax 20e9: 0f be c0 movsbl %al,%eax 20ec: 89 44 24 04 mov %eax,0x4(%esp) 20f0: 8b 45 08 mov 0x8(%ebp),%eax 20f3: 89 04 24 mov %eax,(%esp) 20f6: e8 05 fe ff ff call 1f00 <putc> s++; 20fb: 83 45 f4 01 addl $0x1,-0xc(%ebp) } else if(c == 's'){ s = (char*)*ap; ap++; if(s == 0) s = "(null)"; while(*s != 0){ 20ff: 8b 45 f4 mov -0xc(%ebp),%eax 2102: 0f b6 00 movzbl (%eax),%eax 2105: 84 c0 test %al,%al 2107: 75 da jne 20e3 <printf+0x103> 2109: eb 68 jmp 2173 <printf+0x193> putc(fd, *s); s++; } } else if(c == 'c'){ 210b: 83 7d e4 63 cmpl $0x63,-0x1c(%ebp) 210f: 75 1d jne 212e <printf+0x14e> putc(fd, *ap); 2111: 8b 45 e8 mov -0x18(%ebp),%eax 2114: 8b 00 mov (%eax),%eax 2116: 0f be c0 movsbl %al,%eax 2119: 89 44 24 04 mov %eax,0x4(%esp) 211d: 8b 45 08 mov 0x8(%ebp),%eax 2120: 89 04 24 mov %eax,(%esp) 2123: e8 d8 fd ff ff call 1f00 <putc> ap++; 2128: 83 45 e8 04 addl $0x4,-0x18(%ebp) 212c: eb 45 jmp 2173 <printf+0x193> } else if(c == '%'){ 212e: 83 7d e4 25 cmpl $0x25,-0x1c(%ebp) 2132: 75 17 jne 214b <printf+0x16b> putc(fd, c); 2134: 8b 45 e4 mov -0x1c(%ebp),%eax 2137: 0f be c0 movsbl %al,%eax 213a: 89 44 24 04 mov %eax,0x4(%esp) 213e: 8b 45 08 mov 0x8(%ebp),%eax 2141: 89 04 24 mov %eax,(%esp) 2144: e8 b7 fd ff ff call 1f00 <putc> 2149: eb 28 jmp 2173 <printf+0x193> } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); 214b: c7 44 24 04 25 00 00 movl $0x25,0x4(%esp) 2152: 00 2153: 8b 45 08 mov 0x8(%ebp),%eax 2156: 89 04 24 mov %eax,(%esp) 2159: e8 a2 fd ff ff call 1f00 <putc> putc(fd, c); 215e: 8b 45 e4 mov -0x1c(%ebp),%eax 2161: 0f be c0 movsbl %al,%eax 2164: 89 44 24 04 mov %eax,0x4(%esp) 2168: 8b 45 08 mov 0x8(%ebp),%eax 216b: 89 04 24 mov %eax,(%esp) 216e: e8 8d fd ff ff call 1f00 <putc> } state = 0; 2173: c7 45 ec 00 00 00 00 movl $0x0,-0x14(%ebp) int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ 217a: 83 45 f0 01 addl $0x1,-0x10(%ebp) 217e: 8b 55 0c mov 0xc(%ebp),%edx 2181: 8b 45 f0 mov -0x10(%ebp),%eax 2184: 01 d0 add %edx,%eax 2186: 0f b6 00 movzbl (%eax),%eax 2189: 84 c0 test %al,%al 218b: 0f 85 71 fe ff ff jne 2002 <printf+0x22> putc(fd, c); } state = 0; } } } 2191: c9 leave 2192: c3 ret 2193: 90 nop 00002194 <free>: static Header base; static Header *freep; void free(void *ap) { 2194: 55 push %ebp 2195: 89 e5 mov %esp,%ebp 2197: 83 ec 10 sub $0x10,%esp Header *bp, *p; bp = (Header*)ap - 1; 219a: 8b 45 08 mov 0x8(%ebp),%eax 219d: 83 e8 08 sub $0x8,%eax 21a0: 89 45 f8 mov %eax,-0x8(%ebp) for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 21a3: a1 7c 2c 00 00 mov 0x2c7c,%eax 21a8: 89 45 fc mov %eax,-0x4(%ebp) 21ab: eb 24 jmp 21d1 <free+0x3d> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 21ad: 8b 45 fc mov -0x4(%ebp),%eax 21b0: 8b 00 mov (%eax),%eax 21b2: 3b 45 fc cmp -0x4(%ebp),%eax 21b5: 77 12 ja 21c9 <free+0x35> 21b7: 8b 45 f8 mov -0x8(%ebp),%eax 21ba: 3b 45 fc cmp -0x4(%ebp),%eax 21bd: 77 24 ja 21e3 <free+0x4f> 21bf: 8b 45 fc mov -0x4(%ebp),%eax 21c2: 8b 00 mov (%eax),%eax 21c4: 3b 45 f8 cmp -0x8(%ebp),%eax 21c7: 77 1a ja 21e3 <free+0x4f> free(void *ap) { Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 21c9: 8b 45 fc mov -0x4(%ebp),%eax 21cc: 8b 00 mov (%eax),%eax 21ce: 89 45 fc mov %eax,-0x4(%ebp) 21d1: 8b 45 f8 mov -0x8(%ebp),%eax 21d4: 3b 45 fc cmp -0x4(%ebp),%eax 21d7: 76 d4 jbe 21ad <free+0x19> 21d9: 8b 45 fc mov -0x4(%ebp),%eax 21dc: 8b 00 mov (%eax),%eax 21de: 3b 45 f8 cmp -0x8(%ebp),%eax 21e1: 76 ca jbe 21ad <free+0x19> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) break; if(bp + bp->s.size == p->s.ptr){ 21e3: 8b 45 f8 mov -0x8(%ebp),%eax 21e6: 8b 40 04 mov 0x4(%eax),%eax 21e9: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 21f0: 8b 45 f8 mov -0x8(%ebp),%eax 21f3: 01 c2 add %eax,%edx 21f5: 8b 45 fc mov -0x4(%ebp),%eax 21f8: 8b 00 mov (%eax),%eax 21fa: 39 c2 cmp %eax,%edx 21fc: 75 24 jne 2222 <free+0x8e> bp->s.size += p->s.ptr->s.size; 21fe: 8b 45 f8 mov -0x8(%ebp),%eax 2201: 8b 50 04 mov 0x4(%eax),%edx 2204: 8b 45 fc mov -0x4(%ebp),%eax 2207: 8b 00 mov (%eax),%eax 2209: 8b 40 04 mov 0x4(%eax),%eax 220c: 01 c2 add %eax,%edx 220e: 8b 45 f8 mov -0x8(%ebp),%eax 2211: 89 50 04 mov %edx,0x4(%eax) bp->s.ptr = p->s.ptr->s.ptr; 2214: 8b 45 fc mov -0x4(%ebp),%eax 2217: 8b 00 mov (%eax),%eax 2219: 8b 10 mov (%eax),%edx 221b: 8b 45 f8 mov -0x8(%ebp),%eax 221e: 89 10 mov %edx,(%eax) 2220: eb 0a jmp 222c <free+0x98> } else bp->s.ptr = p->s.ptr; 2222: 8b 45 fc mov -0x4(%ebp),%eax 2225: 8b 10 mov (%eax),%edx 2227: 8b 45 f8 mov -0x8(%ebp),%eax 222a: 89 10 mov %edx,(%eax) if(p + p->s.size == bp){ 222c: 8b 45 fc mov -0x4(%ebp),%eax 222f: 8b 40 04 mov 0x4(%eax),%eax 2232: 8d 14 c5 00 00 00 00 lea 0x0(,%eax,8),%edx 2239: 8b 45 fc mov -0x4(%ebp),%eax 223c: 01 d0 add %edx,%eax 223e: 3b 45 f8 cmp -0x8(%ebp),%eax 2241: 75 20 jne 2263 <free+0xcf> p->s.size += bp->s.size; 2243: 8b 45 fc mov -0x4(%ebp),%eax 2246: 8b 50 04 mov 0x4(%eax),%edx 2249: 8b 45 f8 mov -0x8(%ebp),%eax 224c: 8b 40 04 mov 0x4(%eax),%eax 224f: 01 c2 add %eax,%edx 2251: 8b 45 fc mov -0x4(%ebp),%eax 2254: 89 50 04 mov %edx,0x4(%eax) p->s.ptr = bp->s.ptr; 2257: 8b 45 f8 mov -0x8(%ebp),%eax 225a: 8b 10 mov (%eax),%edx 225c: 8b 45 fc mov -0x4(%ebp),%eax 225f: 89 10 mov %edx,(%eax) 2261: eb 08 jmp 226b <free+0xd7> } else p->s.ptr = bp; 2263: 8b 45 fc mov -0x4(%ebp),%eax 2266: 8b 55 f8 mov -0x8(%ebp),%edx 2269: 89 10 mov %edx,(%eax) freep = p; 226b: 8b 45 fc mov -0x4(%ebp),%eax 226e: a3 7c 2c 00 00 mov %eax,0x2c7c } 2273: c9 leave 2274: c3 ret 00002275 <morecore>: static Header* morecore(uint nu) { 2275: 55 push %ebp 2276: 89 e5 mov %esp,%ebp 2278: 83 ec 28 sub $0x28,%esp char *p; Header *hp; if(nu < 4096) 227b: 81 7d 08 ff 0f 00 00 cmpl $0xfff,0x8(%ebp) 2282: 77 07 ja 228b <morecore+0x16> nu = 4096; 2284: c7 45 08 00 10 00 00 movl $0x1000,0x8(%ebp) p = sbrk(nu * sizeof(Header)); 228b: 8b 45 08 mov 0x8(%ebp),%eax 228e: c1 e0 03 shl $0x3,%eax 2291: 89 04 24 mov %eax,(%esp) 2294: e8 27 fc ff ff call 1ec0 <sbrk> 2299: 89 45 f4 mov %eax,-0xc(%ebp) if(p == (char*)-1) 229c: 83 7d f4 ff cmpl $0xffffffff,-0xc(%ebp) 22a0: 75 07 jne 22a9 <morecore+0x34> return 0; 22a2: b8 00 00 00 00 mov $0x0,%eax 22a7: eb 22 jmp 22cb <morecore+0x56> hp = (Header*)p; 22a9: 8b 45 f4 mov -0xc(%ebp),%eax 22ac: 89 45 f0 mov %eax,-0x10(%ebp) hp->s.size = nu; 22af: 8b 45 f0 mov -0x10(%ebp),%eax 22b2: 8b 55 08 mov 0x8(%ebp),%edx 22b5: 89 50 04 mov %edx,0x4(%eax) free((void*)(hp + 1)); 22b8: 8b 45 f0 mov -0x10(%ebp),%eax 22bb: 83 c0 08 add $0x8,%eax 22be: 89 04 24 mov %eax,(%esp) 22c1: e8 ce fe ff ff call 2194 <free> return freep; 22c6: a1 7c 2c 00 00 mov 0x2c7c,%eax } 22cb: c9 leave 22cc: c3 ret 000022cd <malloc>: void* malloc(uint nbytes) { 22cd: 55 push %ebp 22ce: 89 e5 mov %esp,%ebp 22d0: 83 ec 28 sub $0x28,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 22d3: 8b 45 08 mov 0x8(%ebp),%eax 22d6: 83 c0 07 add $0x7,%eax 22d9: c1 e8 03 shr $0x3,%eax 22dc: 83 c0 01 add $0x1,%eax 22df: 89 45 ec mov %eax,-0x14(%ebp) if((prevp = freep) == 0){ 22e2: a1 7c 2c 00 00 mov 0x2c7c,%eax 22e7: 89 45 f0 mov %eax,-0x10(%ebp) 22ea: 83 7d f0 00 cmpl $0x0,-0x10(%ebp) 22ee: 75 23 jne 2313 <malloc+0x46> base.s.ptr = freep = prevp = &base; 22f0: c7 45 f0 74 2c 00 00 movl $0x2c74,-0x10(%ebp) 22f7: 8b 45 f0 mov -0x10(%ebp),%eax 22fa: a3 7c 2c 00 00 mov %eax,0x2c7c 22ff: a1 7c 2c 00 00 mov 0x2c7c,%eax 2304: a3 74 2c 00 00 mov %eax,0x2c74 base.s.size = 0; 2309: c7 05 78 2c 00 00 00 movl $0x0,0x2c78 2310: 00 00 00 } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 2313: 8b 45 f0 mov -0x10(%ebp),%eax 2316: 8b 00 mov (%eax),%eax 2318: 89 45 f4 mov %eax,-0xc(%ebp) if(p->s.size >= nunits){ 231b: 8b 45 f4 mov -0xc(%ebp),%eax 231e: 8b 40 04 mov 0x4(%eax),%eax 2321: 3b 45 ec cmp -0x14(%ebp),%eax 2324: 72 4d jb 2373 <malloc+0xa6> if(p->s.size == nunits) 2326: 8b 45 f4 mov -0xc(%ebp),%eax 2329: 8b 40 04 mov 0x4(%eax),%eax 232c: 3b 45 ec cmp -0x14(%ebp),%eax 232f: 75 0c jne 233d <malloc+0x70> prevp->s.ptr = p->s.ptr; 2331: 8b 45 f4 mov -0xc(%ebp),%eax 2334: 8b 10 mov (%eax),%edx 2336: 8b 45 f0 mov -0x10(%ebp),%eax 2339: 89 10 mov %edx,(%eax) 233b: eb 26 jmp 2363 <malloc+0x96> else { p->s.size -= nunits; 233d: 8b 45 f4 mov -0xc(%ebp),%eax 2340: 8b 40 04 mov 0x4(%eax),%eax 2343: 2b 45 ec sub -0x14(%ebp),%eax 2346: 89 c2 mov %eax,%edx 2348: 8b 45 f4 mov -0xc(%ebp),%eax 234b: 89 50 04 mov %edx,0x4(%eax) p += p->s.size; 234e: 8b 45 f4 mov -0xc(%ebp),%eax 2351: 8b 40 04 mov 0x4(%eax),%eax 2354: c1 e0 03 shl $0x3,%eax 2357: 01 45 f4 add %eax,-0xc(%ebp) p->s.size = nunits; 235a: 8b 45 f4 mov -0xc(%ebp),%eax 235d: 8b 55 ec mov -0x14(%ebp),%edx 2360: 89 50 04 mov %edx,0x4(%eax) } freep = prevp; 2363: 8b 45 f0 mov -0x10(%ebp),%eax 2366: a3 7c 2c 00 00 mov %eax,0x2c7c return (void*)(p + 1); 236b: 8b 45 f4 mov -0xc(%ebp),%eax 236e: 83 c0 08 add $0x8,%eax 2371: eb 38 jmp 23ab <malloc+0xde> } if(p == freep) 2373: a1 7c 2c 00 00 mov 0x2c7c,%eax 2378: 39 45 f4 cmp %eax,-0xc(%ebp) 237b: 75 1b jne 2398 <malloc+0xcb> if((p = morecore(nunits)) == 0) 237d: 8b 45 ec mov -0x14(%ebp),%eax 2380: 89 04 24 mov %eax,(%esp) 2383: e8 ed fe ff ff call 2275 <morecore> 2388: 89 45 f4 mov %eax,-0xc(%ebp) 238b: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 238f: 75 07 jne 2398 <malloc+0xcb> return 0; 2391: b8 00 00 00 00 mov $0x0,%eax 2396: eb 13 jmp 23ab <malloc+0xde> nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; if((prevp = freep) == 0){ base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 2398: 8b 45 f4 mov -0xc(%ebp),%eax 239b: 89 45 f0 mov %eax,-0x10(%ebp) 239e: 8b 45 f4 mov -0xc(%ebp),%eax 23a1: 8b 00 mov (%eax),%eax 23a3: 89 45 f4 mov %eax,-0xc(%ebp) return (void*)(p + 1); } if(p == freep) if((p = morecore(nunits)) == 0) return 0; } 23a6: e9 70 ff ff ff jmp 231b <malloc+0x4e> } 23ab: c9 leave 23ac: c3 ret 23ad: 66 90 xchg %ax,%ax 23af: 90 nop 000023b0 <xchg>: asm volatile("sti"); } static inline uint xchg(volatile uint *addr, uint newval) { 23b0: 55 push %ebp 23b1: 89 e5 mov %esp,%ebp 23b3: 83 ec 10 sub $0x10,%esp uint result; // The + in "+m" denotes a read-modify-write operand. asm volatile("lock; xchgl %0, %1" : 23b6: 8b 55 08 mov 0x8(%ebp),%edx 23b9: 8b 45 0c mov 0xc(%ebp),%eax 23bc: 8b 4d 08 mov 0x8(%ebp),%ecx 23bf: f0 87 02 lock xchg %eax,(%edx) 23c2: 89 45 fc mov %eax,-0x4(%ebp) "+m" (*addr), "=a" (result) : "1" (newval) : "cc"); return result; 23c5: 8b 45 fc mov -0x4(%ebp),%eax } 23c8: c9 leave 23c9: c3 ret 000023ca <lock_init>: #include "x86.h" #include "proc.h" unsigned long rands = 1; void lock_init(lock_t *lock){ 23ca: 55 push %ebp 23cb: 89 e5 mov %esp,%ebp lock->locked = 0; 23cd: 8b 45 08 mov 0x8(%ebp),%eax 23d0: c7 00 00 00 00 00 movl $0x0,(%eax) } 23d6: 5d pop %ebp 23d7: c3 ret 000023d8 <lock_acquire>: void lock_acquire(lock_t *lock){ 23d8: 55 push %ebp 23d9: 89 e5 mov %esp,%ebp 23db: 83 ec 08 sub $0x8,%esp while(xchg(&lock->locked,1) != 0); 23de: 90 nop 23df: 8b 45 08 mov 0x8(%ebp),%eax 23e2: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp) 23e9: 00 23ea: 89 04 24 mov %eax,(%esp) 23ed: e8 be ff ff ff call 23b0 <xchg> 23f2: 85 c0 test %eax,%eax 23f4: 75 e9 jne 23df <lock_acquire+0x7> } 23f6: c9 leave 23f7: c3 ret 000023f8 <lock_release>: void lock_release(lock_t *lock){ 23f8: 55 push %ebp 23f9: 89 e5 mov %esp,%ebp 23fb: 83 ec 08 sub $0x8,%esp xchg(&lock->locked,0); 23fe: 8b 45 08 mov 0x8(%ebp),%eax 2401: c7 44 24 04 00 00 00 movl $0x0,0x4(%esp) 2408: 00 2409: 89 04 24 mov %eax,(%esp) 240c: e8 9f ff ff ff call 23b0 <xchg> } 2411: c9 leave 2412: c3 ret 00002413 <thread_create>: void *thread_create(void(*start_routine)(void*), void *arg){ 2413: 55 push %ebp 2414: 89 e5 mov %esp,%ebp 2416: 83 ec 28 sub $0x28,%esp int tid; void * stack = malloc(2 * 4096); 2419: c7 04 24 00 20 00 00 movl $0x2000,(%esp) 2420: e8 a8 fe ff ff call 22cd <malloc> 2425: 89 45 f4 mov %eax,-0xc(%ebp) void *garbage_stack = stack; 2428: 8b 45 f4 mov -0xc(%ebp),%eax 242b: 89 45 f0 mov %eax,-0x10(%ebp) // printf(1,"start routine addr : %d\n",(uint)start_routine); if((uint)stack % 4096){ 242e: 8b 45 f4 mov -0xc(%ebp),%eax 2431: 25 ff 0f 00 00 and $0xfff,%eax 2436: 85 c0 test %eax,%eax 2438: 74 14 je 244e <thread_create+0x3b> stack = stack + (4096 - (uint)stack % 4096); 243a: 8b 45 f4 mov -0xc(%ebp),%eax 243d: 25 ff 0f 00 00 and $0xfff,%eax 2442: 89 c2 mov %eax,%edx 2444: b8 00 10 00 00 mov $0x1000,%eax 2449: 29 d0 sub %edx,%eax 244b: 01 45 f4 add %eax,-0xc(%ebp) } if (stack == 0){ 244e: 83 7d f4 00 cmpl $0x0,-0xc(%ebp) 2452: 75 1b jne 246f <thread_create+0x5c> printf(1,"malloc fail \n"); 2454: c7 44 24 04 82 27 00 movl $0x2782,0x4(%esp) 245b: 00 245c: c7 04 24 01 00 00 00 movl $0x1,(%esp) 2463: e8 78 fb ff ff call 1fe0 <printf> return 0; 2468: b8 00 00 00 00 mov $0x0,%eax 246d: eb 6f jmp 24de <thread_create+0xcb> } tid = clone((uint)stack,PSIZE,(uint)start_routine,(int)arg); 246f: 8b 4d 0c mov 0xc(%ebp),%ecx 2472: 8b 55 08 mov 0x8(%ebp),%edx 2475: 8b 45 f4 mov -0xc(%ebp),%eax 2478: 89 4c 24 0c mov %ecx,0xc(%esp) 247c: 89 54 24 08 mov %edx,0x8(%esp) 2480: c7 44 24 04 00 10 00 movl $0x1000,0x4(%esp) 2487: 00 2488: 89 04 24 mov %eax,(%esp) 248b: e8 48 fa ff ff call 1ed8 <clone> 2490: 89 45 ec mov %eax,-0x14(%ebp) if(tid < 0){ 2493: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 2497: 79 1b jns 24b4 <thread_create+0xa1> printf(1,"clone fails\n"); 2499: c7 44 24 04 90 27 00 movl $0x2790,0x4(%esp) 24a0: 00 24a1: c7 04 24 01 00 00 00 movl $0x1,(%esp) 24a8: e8 33 fb ff ff call 1fe0 <printf> return 0; 24ad: b8 00 00 00 00 mov $0x0,%eax 24b2: eb 2a jmp 24de <thread_create+0xcb> } if(tid > 0){ 24b4: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 24b8: 7e 05 jle 24bf <thread_create+0xac> //store threads on thread table return garbage_stack; 24ba: 8b 45 f0 mov -0x10(%ebp),%eax 24bd: eb 1f jmp 24de <thread_create+0xcb> } if(tid == 0){ 24bf: 83 7d ec 00 cmpl $0x0,-0x14(%ebp) 24c3: 75 14 jne 24d9 <thread_create+0xc6> printf(1,"tid = 0 return \n"); 24c5: c7 44 24 04 9d 27 00 movl $0x279d,0x4(%esp) 24cc: 00 24cd: c7 04 24 01 00 00 00 movl $0x1,(%esp) 24d4: e8 07 fb ff ff call 1fe0 <printf> } // wait(); // free(garbage_stack); return 0; 24d9: b8 00 00 00 00 mov $0x0,%eax } 24de: c9 leave 24df: c3 ret 000024e0 <random>: // generate 0 -> max random number exclude max. int random(int max){ 24e0: 55 push %ebp 24e1: 89 e5 mov %esp,%ebp rands = rands * 1664525 + 1013904233; 24e3: a1 64 2c 00 00 mov 0x2c64,%eax 24e8: 69 c0 0d 66 19 00 imul $0x19660d,%eax,%eax 24ee: 05 69 f3 6e 3c add $0x3c6ef369,%eax 24f3: a3 64 2c 00 00 mov %eax,0x2c64 return (int)(rands % max); 24f8: a1 64 2c 00 00 mov 0x2c64,%eax 24fd: 8b 4d 08 mov 0x8(%ebp),%ecx 2500: ba 00 00 00 00 mov $0x0,%edx 2505: f7 f1 div %ecx 2507: 89 d0 mov %edx,%eax } 2509: 5d pop %ebp 250a: c3 ret 250b: 90 nop 0000250c <init_q>: #include "queue.h" #include "types.h" #include "user.h" void init_q(struct queue *q){ 250c: 55 push %ebp 250d: 89 e5 mov %esp,%ebp q->size = 0; 250f: 8b 45 08 mov 0x8(%ebp),%eax 2512: c7 00 00 00 00 00 movl $0x0,(%eax) q->head = 0; 2518: 8b 45 08 mov 0x8(%ebp),%eax 251b: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 2522: 8b 45 08 mov 0x8(%ebp),%eax 2525: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } 252c: 5d pop %ebp 252d: c3 ret 0000252e <add_q>: void add_q(struct queue *q, int v){ 252e: 55 push %ebp 252f: 89 e5 mov %esp,%ebp 2531: 83 ec 28 sub $0x28,%esp struct node * n = malloc(sizeof(struct node)); 2534: c7 04 24 08 00 00 00 movl $0x8,(%esp) 253b: e8 8d fd ff ff call 22cd <malloc> 2540: 89 45 f4 mov %eax,-0xc(%ebp) n->next = 0; 2543: 8b 45 f4 mov -0xc(%ebp),%eax 2546: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) n->value = v; 254d: 8b 45 f4 mov -0xc(%ebp),%eax 2550: 8b 55 0c mov 0xc(%ebp),%edx 2553: 89 10 mov %edx,(%eax) if(q->head == 0){ 2555: 8b 45 08 mov 0x8(%ebp),%eax 2558: 8b 40 04 mov 0x4(%eax),%eax 255b: 85 c0 test %eax,%eax 255d: 75 0b jne 256a <add_q+0x3c> q->head = n; 255f: 8b 45 08 mov 0x8(%ebp),%eax 2562: 8b 55 f4 mov -0xc(%ebp),%edx 2565: 89 50 04 mov %edx,0x4(%eax) 2568: eb 0c jmp 2576 <add_q+0x48> }else{ q->tail->next = n; 256a: 8b 45 08 mov 0x8(%ebp),%eax 256d: 8b 40 08 mov 0x8(%eax),%eax 2570: 8b 55 f4 mov -0xc(%ebp),%edx 2573: 89 50 04 mov %edx,0x4(%eax) } q->tail = n; 2576: 8b 45 08 mov 0x8(%ebp),%eax 2579: 8b 55 f4 mov -0xc(%ebp),%edx 257c: 89 50 08 mov %edx,0x8(%eax) q->size++; 257f: 8b 45 08 mov 0x8(%ebp),%eax 2582: 8b 00 mov (%eax),%eax 2584: 8d 50 01 lea 0x1(%eax),%edx 2587: 8b 45 08 mov 0x8(%ebp),%eax 258a: 89 10 mov %edx,(%eax) } 258c: c9 leave 258d: c3 ret 0000258e <empty_q>: int empty_q(struct queue *q){ 258e: 55 push %ebp 258f: 89 e5 mov %esp,%ebp if(q->size == 0) 2591: 8b 45 08 mov 0x8(%ebp),%eax 2594: 8b 00 mov (%eax),%eax 2596: 85 c0 test %eax,%eax 2598: 75 07 jne 25a1 <empty_q+0x13> return 1; 259a: b8 01 00 00 00 mov $0x1,%eax 259f: eb 05 jmp 25a6 <empty_q+0x18> else return 0; 25a1: b8 00 00 00 00 mov $0x0,%eax } 25a6: 5d pop %ebp 25a7: c3 ret 000025a8 <pop_q>: int pop_q(struct queue *q){ 25a8: 55 push %ebp 25a9: 89 e5 mov %esp,%ebp 25ab: 83 ec 28 sub $0x28,%esp int val; struct node *destroy; if(!empty_q(q)){ 25ae: 8b 45 08 mov 0x8(%ebp),%eax 25b1: 89 04 24 mov %eax,(%esp) 25b4: e8 d5 ff ff ff call 258e <empty_q> 25b9: 85 c0 test %eax,%eax 25bb: 75 5d jne 261a <pop_q+0x72> val = q->head->value; 25bd: 8b 45 08 mov 0x8(%ebp),%eax 25c0: 8b 40 04 mov 0x4(%eax),%eax 25c3: 8b 00 mov (%eax),%eax 25c5: 89 45 f4 mov %eax,-0xc(%ebp) destroy = q->head; 25c8: 8b 45 08 mov 0x8(%ebp),%eax 25cb: 8b 40 04 mov 0x4(%eax),%eax 25ce: 89 45 f0 mov %eax,-0x10(%ebp) q->head = q->head->next; 25d1: 8b 45 08 mov 0x8(%ebp),%eax 25d4: 8b 40 04 mov 0x4(%eax),%eax 25d7: 8b 50 04 mov 0x4(%eax),%edx 25da: 8b 45 08 mov 0x8(%ebp),%eax 25dd: 89 50 04 mov %edx,0x4(%eax) free(destroy); 25e0: 8b 45 f0 mov -0x10(%ebp),%eax 25e3: 89 04 24 mov %eax,(%esp) 25e6: e8 a9 fb ff ff call 2194 <free> q->size--; 25eb: 8b 45 08 mov 0x8(%ebp),%eax 25ee: 8b 00 mov (%eax),%eax 25f0: 8d 50 ff lea -0x1(%eax),%edx 25f3: 8b 45 08 mov 0x8(%ebp),%eax 25f6: 89 10 mov %edx,(%eax) if(q->size == 0){ 25f8: 8b 45 08 mov 0x8(%ebp),%eax 25fb: 8b 00 mov (%eax),%eax 25fd: 85 c0 test %eax,%eax 25ff: 75 14 jne 2615 <pop_q+0x6d> q->head = 0; 2601: 8b 45 08 mov 0x8(%ebp),%eax 2604: c7 40 04 00 00 00 00 movl $0x0,0x4(%eax) q->tail = 0; 260b: 8b 45 08 mov 0x8(%ebp),%eax 260e: c7 40 08 00 00 00 00 movl $0x0,0x8(%eax) } return val; 2615: 8b 45 f4 mov -0xc(%ebp),%eax 2618: eb 05 jmp 261f <pop_q+0x77> } return -1; 261a: b8 ff ff ff ff mov $0xffffffff,%eax } 261f: c9 leave 2620: c3 ret
universal-poset/universal-poset.als
cdstanford/curiosities
1
108
<filename>universal-poset/universal-poset.als /* What is the smallest poset containing all posets of size n? This code uses the Alloy language (https://alloytools.org/) to get the answer by encoding the problem as a SAT instance. Spoiler: the encoding is expensive, and only tractable for n <= 4. If f(n) is the minimum size of the universal poset for the class of posets of size n, then we are able to verify: - f(1) = 1 - f(2) = 3 - f(3) = 5 - f(4) = 8 References: - The problem is considered in general here, where it is shown that there is no polynomial upper bound: https://mathoverflow.net/questions/25874/ - Currently the sequence doesn't seem to be in OEIS. - In the code below, we also need to hardcode the number of posets on n labeled elements, which can be found here: https://oeis.org/A001035 */ // First, we model the problem with an abstract set of n vertices V, and a // (larger) set of vertices UniversalV. sig UniversalV {} one sig UniversalPoset { edge: UniversalV -> UniversalV, }{ // edge is reflexive and transitive edge = (UniversalV <: *edge) // edge is antisymmetric edge & ~edge in iden } sig V {} sig Poset { edge: V -> V, embedding: V -> one UniversalV, }{ // edge is reflexive and transitive edge = (V <: *edge) // edge is antisymmetric edge & ~edge in iden } // The poset relation on UniversalV should contain all possible posets on V. pred poset_embeds[p: Poset] { p.edge = (p.embedding).(UniversalPoset.edge).(~(p.embedding)) } fact universal_poset_is_universal { all p: Poset | poset_embeds[p] } fact different_posets_are_different { all p1: Poset | all p2: Poset { (p1.edge = p2.edge) => p1 = p2 } } // Finally, we verify the solution for different values of n. // For each n, we check that the minimum size is satisfiable, then check that // (a) one less than the minimum is unsatisfiable; and // (b) one additional poset is unsatisfiable. /* n = 1 */ // Number of posets: 1 // Minimum universal poset size: 1 run sat_1 {} for exactly 1 V, exactly 1 Poset, exactly 1 UniversalV run unsat_1a {} for exactly 1 V, exactly 1 Poset, exactly 0 UniversalV run unsat_1b {} for exactly 1 V, exactly 2 Poset, exactly 1 UniversalV /* n = 2 */ // Number of posets: 3 // Minimum universal poset size: 3 run sat_2 {} for exactly 2 V, exactly 3 Poset, exactly 3 UniversalV run unsat_2a {} for exactly 2 V, exactly 3 Poset, exactly 2 UniversalV run unsat_2b {} for exactly 2 V, exactly 4 Poset, exactly 3 UniversalV /* n = 3 */ // Number of posets: 19 // Minimum universal poset size: 5 run sat_3 {} for exactly 3 V, exactly 19 Poset, exactly 5 UniversalV run unsat_3a {} for exactly 3 V, exactly 19 Poset, exactly 4 UniversalV run unsat_3b {} for exactly 3 V, exactly 20 Poset, exactly 5 UniversalV /* n = 4 */ // Number of posets: 219 // Minimum universal poset size: 8 // Note: this runs slowly (a few minutes per query). run sat_4 {} for exactly 4 V, exactly 219 Poset, exactly 8 UniversalV run unsat_4a {} for exactly 4 V, exactly 219 Poset, exactly 7 UniversalV run unsat_4b {} for exactly 4 V, exactly 220 Poset, exactly 8 UniversalV
src/framework/sintable.asm
Scorpion-Illuminati/ControllerTest
1
81836
<gh_stars>1-10 ;============================================================== ; BIG EVIL CORPORATION .co.uk ;============================================================== ; SEGA Genesis Framework (c) <NAME> 2014 ;============================================================== ; sintable.asm - Sine wave ;============================================================== DC.B 0, 3, 6, 9, 12, 16, 19, 22 DC.B 25, 28, 31, 34, 37, 40, 43, 46 DC.B 48, 51, 54, 57, 60, 62, 65, 68 DC.B 70, 73, 75, 78, 80, 83, 85, 87 DC.B 90, 92, 94, 96, 98, 100, 102, 104 DC.B 105, 107, 109, 110, 112, 113, 115, 116 DC.B 117, 118, 119, 120, 121, 122, 123, 124 DC.B 124, 125, 126, 126, 126, 127, 127, 127 DC.B 127, 127, 127, 127, 126, 126, 126, 125 DC.B 125, 124, 123, 123, 122, 121, 120, 119 DC.B 118, 116, 115, 114, 112, 111, 109, 108 DC.B 106, 104, 102, 101, 99, 97, 95, 93 DC.B 90, 88, 86, 84, 81, 79, 76, 74 DC.B 71, 69, 66, 63, 61, 58, 55, 52 DC.B 49, 47, 44, 41, 38, 35, 32, 29 DC.B 26, 23, 20, 17, 14, 10, 7, 4 DC.B 1, -2, -5, -8, -11, -14, -17, -21 DC.B -24, -27, -30, -33, -36, -39, -42, -45 DC.B -47, -50, -53, -56, -59, -61, -64, -67 DC.B -69, -72, -75, -77, -80, -82, -84, -87 DC.B -89, -91, -93, -95, -97, -99, -101, -103 DC.B -105, -107, -108, -110, -111, -113, -114, -115 DC.B -117, -118, -119, -120, -121, -122, -123, -124 DC.B -124, -125, -125, -126, -126, -127, -127, -127 DC.B -127, -127, -127, -127, -127, -126, -126, -125 DC.B -125, -124, -124, -123, -122, -121, -120, -119 DC.B -118, -117, -116, -114, -113, -111, -110, -108 DC.B -107, -105, -103, -101, -99, -97, -95, -93 DC.B -91, -89, -87, -84, -82, -80, -77, -75 DC.B -72, -70, -67, -64, -62, -59, -56, -53 DC.B -51, -48, -45, -42, -39, -36, -33, -30 DC.B -27, -24, -21, -18, -15, -12, -8, -5
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48.log_5_104.asm
ljhsiun2/medusa
9
100359
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r8 push %rbp push %rsi lea addresses_A_ht+0x18888, %r14 nop nop xor $58524, %rsi and $0xffffffffffffffc0, %r14 movntdqa (%r14), %xmm4 vpextrq $0, %xmm4, %rbp cmp %r8, %r8 pop %rsi pop %rbp pop %r8 pop %r14 ret .global s_faulty_load s_faulty_load: push %r12 push %r13 push %r15 push %r8 push %r9 push %rax push %rdi // Store lea addresses_UC+0x129e8, %rdi cmp $21083, %r13 mov $0x5152535455565758, %r12 movq %r12, (%rdi) nop and $17619, %rax // Load lea addresses_A+0x1da28, %rax nop nop nop nop nop and %r9, %r9 movb (%rax), %r15b nop nop nop nop nop cmp %r15, %r15 // Store lea addresses_PSE+0x19888, %r12 and %rax, %rax movb $0x51, (%r12) and %r15, %r15 // Faulty Load lea addresses_RW+0x4888, %r8 nop nop nop nop inc %rdi mov (%r8), %r9 lea oracles, %r13 and $0xff, %r9 shlq $12, %r9 mov (%r13,%r9,1), %r9 pop %rdi pop %rax pop %r9 pop %r8 pop %r15 pop %r13 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'congruent': 5, 'size': 8, 'same': False, 'NT': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'AVXalign': False, 'congruent': 5, 'size': 1, 'same': False, 'NT': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'AVXalign': True, 'congruent': 10, 'size': 1, 'same': False, 'NT': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_RW', 'AVXalign': False, 'congruent': 0, 'size': 8, 'same': True, 'NT': False}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_A_ht', 'AVXalign': False, 'congruent': 11, 'size': 16, 'same': True, 'NT': True}} {'32': 5} 32 32 32 32 32 */
test/Fail/NoEtaPatterns.agda
hborum/agda
3
1871
<reponame>hborum/agda record _×_ (A B : Set) : Set where no-eta-equality constructor _,_ field fst : A snd : B open _×_ swap : ∀ {A B} → A × B → B × A swap (x , y) = y , x data _≡_ {A : Set} (x : A) : A → Set where refl : x ≡ x -- This should fail since we don't have eta for _×_. fails : ∀ {A B} (p : A × B) → swap p ≡ (snd p , fst p) fails p = refl
archive/agda-3/src/Oscar/Property/Setoid/Proposequality.agda
m0davis/oscar
0
11756
<filename>archive/agda-3/src/Oscar/Property/Setoid/Proposequality.agda open import Oscar.Prelude open import Oscar.Class open import Oscar.Class.Reflexivity open import Oscar.Class.Symmetry open import Oscar.Class.Transitivity open import Oscar.Class.IsEquivalence open import Oscar.Class.Setoid open import Oscar.Data.Proposequality module Oscar.Property.Setoid.Proposequality where module _ {𝔬} {𝔒 : Ø 𝔬} where instance 𝓡eflexivityProposequality : Reflexivity.class Proposequality⟦ 𝔒 ⟧ 𝓡eflexivityProposequality .⋆ = ! 𝓢ymmetryProposequality : Symmetry.class Proposequality⟦ 𝔒 ⟧ 𝓢ymmetryProposequality .⋆ ∅ = ! 𝓣ransitivityProposequality : Transitivity.class Proposequality⟦ 𝔒 ⟧ 𝓣ransitivityProposequality .⋆ ∅ y∼z = y∼z IsEquivalenceProposequality : IsEquivalence Proposequality⟦ 𝔒 ⟧ IsEquivalenceProposequality = ∁ module _ {𝔬} (𝔒 : Ø 𝔬) where SetoidProposequality : Setoid _ _ SetoidProposequality = ∁ Proposequality⟦ 𝔒 ⟧
programs/oeis/092/A092283.asm
neoneye/loda
22
174333
; A092283: Triangular array read by rows: T(n,k)=n+k^2, 1<=k<=n. ; 2,3,6,4,7,12,5,8,13,20,6,9,14,21,30,7,10,15,22,31,42,8,11,16,23,32,43,56,9,12,17,24,33,44,57,72,10,13,18,25,34,45,58,73,90,11,14,19,26,35,46,59,74,91,110,12,15,20,27,36,47,60,75,92,111,132,13,16,21,28,37,48,61,76,93,112,133,156,14,17,22,29,38,49,62,77,94,113,134,157,182,15,18,23,30,39,50,63,78,95 mov $2,$0 lpb $2 mov $1,$2 add $3,1 sub $2,$3 trn $2,1 lpe pow $1,2 add $1,$3 trn $1,1 add $1,2 mov $0,$1
00 Import all to library.applescript
bsmith96/Qlab-Scripts
1
1993
<reponame>bsmith96/Qlab-Scripts<filename>00 Import all to library.applescript -- @description Import all script to user library -- @author <NAME> -- @link bensmithsound.uk -- @version 2.1 -- @testedmacos 10.14.6 -- @testedqlab 4.6.10 -- @about Run this script in MacOS's "Script Editor" to import all scripts in a folder (including within subfolders) to the user's "Library/Script Libraries" -- @separateprocess TRUE -- @changelog -- v2.1 + can install specific versions of the library from github, and notes the version if launched in Qlab. -- v2.0 + can now optionally import scripts directly from github -- v1.3 + add default location when choosing a folder -- v1.2 + creates "Script Libraries" folder if it doesn't already exist -- USER DEFINED VARIABLES ----------------- set gitVersionToGet to "latest" -- latest, or a git version tag. If using an old file, set this to the version previously installed. ---------- END OF USER DEFINED VARIABLES -- -- RUN SCRIPT ----------------------------- set theMethod to button returned of (display dialog "Would you like to install from github, or from a local folder?" with title "Install from github?" buttons {"Github", "Local", "Cancel"} default button "Github") global scriptFiles set scriptFiles to {} -- Git clone the current master branch if theMethod is "Github" then tell application "Finder" set homeLocation to path to home folder if gitVersionToGet is "latest" then set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp" else set gitClone to "cd " & (POSIX path of homeLocation) & "&& git clone https://github.com/bsmith96/Qlab-Scripts.git qlab-scripts-temp -b " & gitVersionToGet & " --single-branch" end if do shell script gitClone set scriptFolder to (POSIX path of homeLocation) & "qlab-scripts-temp" set scriptFolder to (POSIX file scriptFolder) as alias -- Get version number for notes set getGitVersion to "cd " & (POSIX path of scriptFolder) & "&& git describe --tags" set gitVersion to do shell script getGitVersion end tell end if -- Get user input: folder to import if theMethod is "Local" then tell application "Finder" set currentPath to container of (path to me) as alias end tell set scriptFolder to choose folder with prompt "Please select the folder containing scripts to import" default location currentPath end if findAllScripts(scriptFolder) tell application "Finder" repeat with eachScript in scriptFiles set fileName to name of (info for (eachScript as alias) without size) if fileName ends with ".applescript" then set fileName to (characters 1 thru -(12 + 1) of fileName as string) end if set rootPath to POSIX path of (scriptFolder as alias) set originalPath to POSIX path of (eachScript as alias) set pathInRoot to my trimLine(originalPath, rootPath, 0) set pathInLibrary to my trimLine(pathInRoot, ".applescript", 1) try set newRoot to (POSIX path of (path to library folder from user domain) & "Script Libraries/") set testRoot to (POSIX file newRoot as alias) on error -- if folder doesn't exist set rootFolderName to "Script Libraries" set rootFolderPath to (POSIX path of (path to library folder from user domain)) set newRootFolder to make new folder at (POSIX file rootFolderPath as alias) set name of newRootFolder to rootFolderName set newRoot to (POSIX path of (path to library folder from user domain) & rootFolderName & "/") end try set newPath to newRoot & pathInRoot set newPath to my trimLine(newPath, ".applescript", 1) & ".scpt" -- compile script set newFolder to my trimLine(newPath, fileName & ".scpt", 1) log newFolder try set testFolder to (POSIX file newFolder as alias) on error -- if folder doesn't exist set theFolderName to my trimLine(newFolder, newRoot, 0) set theFolderPath to my splitString(theFolderName, "/") repeat with eachFolder from 1 to ((count of theFolderPath) - 1) try set theFolder to make new folder at (POSIX file newRoot as alias) set name of theFolder to (item eachFolder of theFolderPath) as string on error try delete theFolder end try end try set newRoot to newRoot & (item eachFolder of theFolderPath) & "/" end repeat end try set osaCommand to "osacompile -o \"" & newPath & "\" \"" & originalPath & "\"" log osaCommand log pathInLibrary try do shell script osaCommand end try end repeat end tell if theMethod is "Github" then tell application "Finder" delete folder scriptFolder end tell try tell application id "com.figure53.Qlab.4" to tell front workspace -- set q number of (last item of (selected as list)) to gitVersion set installerCue to last item of (selected as list) if q type of installerCue is "Script" then set installerName to q display name of installerCue set originalInstallerName to last item of my splitString(installerName, " | ") set q name of installerCue to gitVersion & " installed | " & originalInstallerName end if end tell end try end if display notification "Installation complete - all scripts have been compiled into the \"Script Libraries\" folder" -- FUNCTIONS ------------------------------ on findAllScripts(theFolder) tell application "Finder" set allItems to every item of theFolder repeat with eachItem in allItems if kind of (info for (eachItem as alias) without size) is "folder" then my findAllScripts(eachItem) else if name extension of (info for (eachItem as alias) without size) is "applescript" then set end of scriptFiles to eachItem end if end if end repeat end tell end findAllScripts on trimLine(theText, trimChars, trimIndicator) -- trimIndicator options: -- 0 = beginning -- 1 = end -- 2 = both set x to the length of the trimChars ---- Trim beginning if the trimIndicator is in {0, 2} then repeat while theText begins with the trimChars try set theText to characters (x + 1) thru -1 of theText as string on error -- if the text contains nothing but the trim characters return "" end try end repeat end if ---- Trim ending if the trimIndicator is in {1, 2} then repeat while theText ends with the trimChars try set theText to characters 1 thru -(x + 1) of theText as string on error -- if the text contains nothing but the trim characters return "" end try end repeat end if return theText end trimLine on splitString(theString, theDelimiter) -- save delimiters to restore old settings set oldDelimiters to AppleScript's text item delimiters -- set delimiters to delimiter to be used set AppleScript's text item delimiters to theDelimiter -- create the array set theArray to every text item of theString -- restore old setting set AppleScript's text item delimiters to oldDelimiters -- return the array return theArray end splitString
oeis/017/A017508.asm
neoneye/loda-programs
11
87527
; A017508: a(n) = (11*n + 9)^12. ; 282429536481,4096000000000000,787662783788549761,30129469486639681536,491258904256726154641,4722366482869645213696,31676352024078369140625,163674647745587512938496,693842360995438000295041,2518170116818978404827136,8064241715186276625588961,23298085122481000000000000,61748917974902741368975281,152097843090208773684330496,351763888007705494736404081,770177770297334467043659776,1607166017050789863525390625,3214199700417740936751087616,6189337220490697154402830401,11520674946182735813538942976 mul $0,11 add $0,9 pow $0,12
assemblyCode/test_basedIndexAddress.asm
lschiavini/Hypothetical-Assembler-Loader
0
168569
global _start section .data ROWS EQU 10 COLS EQU 10 array1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 db 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 array2 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 Snippet db 'MASSACRATION', 0dH, 0ah ;0dH + 0ah eh CR+LF section .bss array3 resb 100 section .text _start: mov ecx, ROWS mov ebx, 0 mov esi, 0 mov ah, 0 mov dh, 0 sum_loop: mov al, [array1 + ebx + esi] mov dl, [array2 + ebx + esi] add al, dl add al, 0x30 ; to print as ASCII mov [array3+ebx+esi], al inc esi cmp esi, COLS jb sum_loop reset_cols: add ebx, COLS mov esi, 0 loop sum_loop ; ecx -= 1 && if ecx != 0 print: mov eax, 4 ; system call ID (Sys_write) mov ebx, 1 ; primeiro arg: file handler stdout mov ecx, Snippet ; segundo arg: ponteiro à string mov edx, 15 ; terceiro arg: tamanho da string int 80h ; chamada a syscall print_result: mov eax, 4 ; system call ID (Sys_write) mov ebx, 1 ; primeiro arg: file handler stdout mov ecx, array3 ; segundo arg: ponteiro à string mov edx, 100 ; terceiro arg: tamanho da string int 80h ; chamada a syscall exit: mov eax, 1 mov ebx, 0 int 80h
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_6_1019.asm
ljhsiun2/medusa
9
241293
<filename>Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0x48_notsx.log_6_1019.asm .global s_prepare_buffers s_prepare_buffers: ret .global s_faulty_load s_faulty_load: push %r10 push %r13 push %r15 push %rax push %rcx push %rdi push %rdx push %rsi // Store lea addresses_A+0x1e7b5, %rsi clflush (%rsi) dec %r10 mov $0x5152535455565758, %r13 movq %r13, (%rsi) nop nop inc %rsi // Store lea addresses_WC+0x111f5, %rdx nop nop nop and $10850, %r10 movl $0x51525354, (%rdx) cmp $37710, %rax // Store lea addresses_UC+0x153f5, %rax cmp %rdx, %rdx movw $0x5152, (%rax) nop nop nop nop and $22682, %rdx // REPMOV lea addresses_normal+0x5b65, %rsi lea addresses_PSE+0xe5f5, %rdi nop nop nop nop xor %rdx, %rdx mov $61, %rcx rep movsw nop nop nop nop nop and %r15, %r15 // Store lea addresses_PSE+0x19cf5, %rdx and $7443, %r13 mov $0x5152535455565758, %r15 movq %r15, %xmm2 movups %xmm2, (%rdx) sub %rax, %rax // REPMOV lea addresses_US+0x17f55, %rsi lea addresses_WT+0xfcf5, %rdi clflush (%rsi) nop nop nop nop xor %r10, %r10 mov $27, %rcx rep movsb nop nop nop nop nop sub %r13, %r13 // Faulty Load lea addresses_D+0x8ff5, %rsi nop nop nop sub $60328, %r10 vmovups (%rsi), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $1, %xmm2, %r15 lea oracles, %rdi and $0xff, %r15 shlq $12, %r15 mov (%rdi,%r15,1), %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r15 pop %r13 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_D', 'congruent': 0}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 8, 'type': 'addresses_A', 'congruent': 6}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 4, 'type': 'addresses_WC', 'congruent': 9}, 'OP': 'STOR'} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 2, 'type': 'addresses_UC', 'congruent': 10}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 9, 'type': 'addresses_PSE'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 2, 'type': 'addresses_normal'}} {'dst': {'same': False, 'NT': False, 'AVXalign': False, 'size': 16, 'type': 'addresses_PSE', 'congruent': 8}, 'OP': 'STOR'} {'dst': {'same': False, 'congruent': 5, 'type': 'addresses_WT'}, 'OP': 'REPM', 'src': {'same': False, 'congruent': 4, 'type': 'addresses_US'}} [Faulty Load] {'OP': 'LOAD', 'src': {'same': True, 'NT': False, 'AVXalign': False, 'size': 32, 'type': 'addresses_D', 'congruent': 0}} <gen_prepare_buffer> {'36': 6} 36 36 36 36 36 36 */
oeis/142/A142852.asm
neoneye/loda-programs
11
94392
<filename>oeis/142/A142852.asm ; A142852: Primes congruent to 54 mod 61. ; Submitted by <NAME> ; 359,1091,1213,1579,1823,2311,2677,4019,4507,4751,5483,5849,6337,6581,6703,6947,7069,8167,9631,10607,10729,10973,11827,12071,12437,13291,13901,14389,14633,15121,15731,16097,16829,17317,17683,18049,19391,20123,20611,21221,21587,22441,22807,23173,23417,23539,25247,26711,26833,27077,27809,28297,28541,28663,29761,30493,30859,31469,31957,32323,32933,34031,34519,34763,35129,35251,35617,35983,37447,37691,37813,39521,39887,40009,40253,41351,42083,42571,42937,43669,43913,44279,45377,47207,47939,49037 mov $1,7 mov $2,$0 add $2,2 pow $2,2 lpb $2 add $1,50 sub $2,1 mov $3,$1 add $1,11 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mul $1,2 mov $0,$1 sub $0,21
bb-runtimes/src/s-bbbosu__erc32.adb
JCGobbi/Nucleo-STM32G474RE
0
27798
<reponame>JCGobbi/Nucleo-STM32G474RE<filename>bb-runtimes/src/s-bbbosu__erc32.adb<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- GNAT RUN-TIME LIBRARY (GNARL) COMPONENTS -- -- -- -- S Y S T E M . B B . B O A R D _ S U P P O R T -- -- -- -- B o d y -- -- -- -- Copyright (C) 1999-2002 Universidad Politecnica de Madrid -- -- Copyright (C) 2003-2006 The European Space Agency -- -- Copyright (C) 2003-2016, AdaCore -- -- -- -- 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 3, 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. -- -- -- -- 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/>. -- -- -- -- GNARL was developed by the GNARL team at Florida State University. -- -- Extensive contributions were provided by Ada Core Technologies, Inc. -- -- -- -- The port of GNARL to bare board targets was initially developed by the -- -- Real-Time Systems Group at the Technical University of Madrid. -- -- -- ------------------------------------------------------------------------------ -- There are page numbers in the comments below, please provide the reference -- to the document (here in this header) to which these references apply ??? pragma Restrictions (No_Elaboration_Code); with System.BB.Board_Support.ERC32; with System.BB.Parameters; package body System.BB.Board_Support is use type ERC32.Scaler_8; use type ERC32.Timers_Counter; use CPU_Primitives; package Registers renames ERC32; ----------------------- -- Local Definitions -- ----------------------- Periodic_Scaler : constant := 0; -- In order to obtain the highest granularity of the clock we set the -- scaler to 0. Alarm_Scaler : constant := 0; -- In order to obtain the highest resolution of the alarm timer we set -- the scaler to 0. Periodic_Count : constant := Registers.Timers_Counter'Last - 1; -- Value to be loaded in the clock counter to accomplish the -- Clock_Interrupt_Period. -- -- One is subtracted from Timers_Counter'Last because when the Scaler is -- set to 0, the timeout period will be the counter reload value plus 1. -- Constants defining the external interrupts General_Purpose_Timer : constant System.BB.Interrupts.Interrupt_ID := 12; Timer_Control_Mirror : Registers.Timer_Control_Register; pragma Volatile (Timer_Control_Mirror); -- Timer_Control register cannot be read. So the following object holds a -- copy of the Timer_Control register value. ---------------------- -- Local Procedures -- ---------------------- procedure Stop_Watch_Dog; pragma Inline (Stop_Watch_Dog); -- Stop the watch dog timer procedure Initialize_Memory; pragma Inline (Initialize_Memory); -- Initialize the memory on the board procedure Initialize_Clock; -- Perform all the initialization related to the clock ------------------------ -- Alarm_Interrupt_ID -- ------------------------ function Alarm_Interrupt_ID return Interrupts.Interrupt_ID is begin return General_Purpose_Timer; end Alarm_Interrupt_ID; --------------------------- -- Clear_Alarm_Interrupt -- --------------------------- procedure Clear_Alarm_Interrupt is begin -- From MEC Specification Document (MCD/SPC/0009/SE) page 35 -- The MEC includes a specific register called Interrupt Pending -- Register, which reflects the pending interrupts. -- The interrupts in the IPR are cleared automatically when the -- interrupt is acknowledged. The MEC will sample the trap address in -- order to know which bit to clear. Therefore, this procedure has a -- null body for this target. null; end Clear_Alarm_Interrupt; ----------------------------- -- Clear_Interrupt_Request -- ----------------------------- procedure Clear_Interrupt_Request (Interrupt : System.BB.Interrupts.Interrupt_ID) is begin -- Nothing to do for the IPIC null; end Clear_Interrupt_Request; -------------------------- -- Clear_Poke_Interrupt -- -------------------------- procedure Clear_Poke_Interrupt is begin -- No Poke interrupt available for ERC32 raise Program_Error; end Clear_Poke_Interrupt; --------------------------- -- Priority_Of_Interrupt -- --------------------------- function Priority_Of_Interrupt (Interrupt : System.BB.Interrupts.Interrupt_ID) return System.Any_Priority is begin -- Assert that it is a real interrupt pragma Assert (Interrupt /= System.BB.Interrupts.No_Interrupt); return (Any_Priority (Interrupt) + Interrupt_Priority'First - 1); end Priority_Of_Interrupt; ---------------------- -- Initialize_Board -- ---------------------- procedure Initialize_Board is begin -- The initialization of the ERC32 board consists on stopping the watch -- dog timer, initializing the memory, and initializing the clock in -- order to have the desired granularity and range. Stop_Watch_Dog; Initialize_Memory; Initialize_Clock; end Initialize_Board; ---------------------- -- Initialize_Clock -- ---------------------- procedure Initialize_Clock is Real_Time_Clock_Scaler_Aux : Registers.Real_Time_Clock_Scaler_Register; begin -- Set the scaler for the clock Real_Time_Clock_Scaler_Aux := Registers.Real_Time_Clock_Scaler; Real_Time_Clock_Scaler_Aux.RTCS := Periodic_Scaler; Registers.Real_Time_Clock_Scaler := Real_Time_Clock_Scaler_Aux; -- Load the counter for the clock Registers.Real_Time_Clock_Counter := Periodic_Count; -- Set the proper bits in mirrored Timer Control Register. The timer -- used for the clock is programmed in periodic mode. -- From MEC Specification Document (MCD/SPC/0009/SE) page 50 -- NOTE: All reserved bits have to be written with zeros in order to -- avoid parity error resulting in a MEC internal error. Timer_Control_Mirror.Reserved4 := (others => False); Timer_Control_Mirror.Reserved20 := (others => False); Timer_Control_Mirror.RTCCR := True; Timer_Control_Mirror.RTCCL := True; Timer_Control_Mirror.RTCSL := True; Timer_Control_Mirror.RTCSE := True; -- Do not modify General Purpose Timer downcounter Timer_Control_Mirror.GCL := False; Timer_Control_Mirror.GSL := False; -- Write MEC Timer Control Register Registers.Timer_Control := Timer_Control_Mirror; end Initialize_Clock; ----------------------- -- Initialize_Memory -- ----------------------- procedure Initialize_Memory is begin -- Nothing to be done for the ERC32 null; end Initialize_Memory; ------------------------ -- Max_Timer_Interval -- ------------------------ function Max_Timer_Interval return Timer_Interval is begin return Timer_Interval'Last; end Max_Timer_Interval; ----------------------- -- Poke_Interrupt_ID -- ----------------------- function Poke_Interrupt_ID return Interrupts.Interrupt_ID is begin -- No Poke interrupt available for ERC32 raise Program_Error; -- Unreachable code return Interrupts.Interrupt_ID'First; end Poke_Interrupt_ID; --------------------------- -- Get_Interrupt_Request -- --------------------------- function Get_Interrupt_Request (Vector : CPU_Primitives.Vector_Id) return System.BB.Interrupts.Interrupt_ID is begin -- The range corresponding to asynchronous traps is in 16#11# .. 16#1F# pragma Assert (Vector in 16#11# .. 16#1F#); return System.BB.Interrupts.Interrupt_ID (Vector - 16#10#); end Get_Interrupt_Request; ------------------------------- -- Install_Interrupt_Handler -- ------------------------------- procedure Install_Interrupt_Handler (Handler : Address; Interrupt : Interrupts.Interrupt_ID; Prio : Interrupt_Priority) is pragma Unreferenced (Prio); begin CPU_Primitives.Install_Trap_Handler (Handler, CPU_Primitives.Vector_Id (Interrupt + 16#10#)); end Install_Interrupt_Handler; ---------------- -- Read_Clock -- ---------------- function Read_Clock return Timer_Interval is begin return Timer_Interval (Periodic_Count - Registers.Real_Time_Clock_Counter); end Read_Clock; --------------- -- Set_Alarm -- --------------- procedure Set_Alarm (Ticks : Timer_Interval) is General_Purpose_Timer_Scaler_Aux : Registers.General_Purpose_Timer_Scaler_Register; Interrupt_Mask_Aux : Registers.Interrupt_Mask_Register; begin -- Alarm Clock downcount will reach 0 in Ticks. The granularity of -- time intervals is equal to Clock Period. -- Set the scaler General_Purpose_Timer_Scaler_Aux := Registers.General_Purpose_Timer_Scaler; General_Purpose_Timer_Scaler_Aux.GPTS := Alarm_Scaler; Registers.General_Purpose_Timer_Scaler := General_Purpose_Timer_Scaler_Aux; -- Load the counter Registers.General_Purpose_Timer_Counter := Registers.Timers_Counter (Ticks); -- Set the proper bits in mirrored Timer Control Register. -- General Purpose Timer is used in one-shot mode. Timer_Control_Mirror.GCR := False; Timer_Control_Mirror.GCL := True; Timer_Control_Mirror.GSE := True; Timer_Control_Mirror.GSL := True; -- Do not modify Timer downcount Timer_Control_Mirror.RTCCL := False; Timer_Control_Mirror.RTCSL := False; -- From MEC Specification Document (MCD/SPC/0009/SE) page 50 -- NOTE: All reserved bits have to be written with zeros in order to -- avoid parity error resulting in a MEC internal error. Timer_Control_Mirror.Reserved4 := (others => False); Timer_Control_Mirror.Reserved20 := (others => False); -- Write MEC Timer Control Register Registers.Timer_Control := Timer_Control_Mirror; -- Enable GPT Interrupts Interrupt_Mask_Aux := Registers.Interrupt_Mask; Interrupt_Mask_Aux.General_Purpose_Timer := False; Registers.Interrupt_Mask := Interrupt_Mask_Aux; end Set_Alarm; -------------------------- -- Set_Current_Priority -- -------------------------- procedure Set_Current_Priority (Priority : Integer) is begin null; -- No board-specific actions necessary end Set_Current_Priority; -------------------- -- Stop_Watch_Dog -- -------------------- procedure Stop_Watch_Dog is begin -- From MEC Specification Document (MCD/SPC/0009/SE) page 39 -- After system reset or processor reset, the watch dog timer is enabled -- and starts running. By writing to the Trap Door Set after system -- reset, the timer can be disabled. Registers.Watchdog_Trap_Door_Set := 0; end Stop_Watch_Dog; ---------------------- -- Ticks_Per_Second -- ---------------------- function Ticks_Per_Second return Natural is begin -- The prescaler is clocked by the system clock. When it underflows, it -- is reloaded from the prescaler reload register and a timer tick is -- generated. The effective division rate is therefore equal to the -- prescaler reload register value plus 1. return Parameters.Clock_Frequency / (Periodic_Scaler + 1); end Ticks_Per_Second; end System.BB.Board_Support;
inmemantlr-api/src/test/resources/inmemantlr/LexerGrammar.g4
dafei1288/inmemantlr
0
5490
lexer grammar LexerGrammar; RULE : [a-z] DIGIT; DIGIT: [0-9]+; WS: [ \t\r\n\u000C]+ -> skip ;
libsrc/graphics/g800/xorpixel.asm
rdacomp/z88dk
0
177580
<reponame>rdacomp/z88dk SECTION code_clib PUBLIC xorpixel EXTERN sety EXTERN setx EXTERN getpat EXTERN last_pos ; in: hl=(x,y) xorpixel: push af push bc push hl ld (last_pos),hl call sety call getpat call setx in a,(0x41) ;read data xor b call setx ; to prevent automatic increment of lcd driver out (0x41),a ;write data pop hl pop bc pop af ret
oeis/071/A071178.asm
neoneye/loda-programs
11
101892
<gh_stars>10-100 ; A071178: Exponent of the largest prime factor of n. ; Submitted by <NAME> ; 0,1,1,2,1,1,1,3,2,1,1,1,1,1,1,4,1,2,1,1,1,1,1,1,2,1,3,1,1,1,1,5,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,1,1,3,1,1,1,1,1,1,1,1,1,6,1,1,1,1,1,1,1,2,1,1,2,1,1,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,1,2 add $0,1 pow $0,6 lpb $0 mov $3,$0 lpb $3 mov $4,$0 mov $6,$2 cmp $6,0 add $2,$6 mod $4,$2 add $2,1 cmp $4,0 cmp $4,$6 sub $3,$4 lpe mov $5,0 lpb $0 dif $0,$2 add $5,1 lpe lpe mov $0,$5 div $0,6
libsrc/_DEVELOPMENT/font/font_4x8/_font_4x8_64_omni2.asm
jpoikela/z88dk
640
101653
<gh_stars>100-1000 ; ; Font extracted from 64-4.tap ; ; Tap file downloaded from: http://mdfs.net/Software/Spectrum/Coding/Printout/ SECTION rodata_font SECTION rodata_font_4x8 PUBLIC _font_4x8_64_omni2 PUBLIC _font_4x8_64_omni2_end _font_4x8_64_omni2: BINARY "font_4x8_64_omni2.bin" _font_4x8_64_omni2_end:
test/Fail/Issue719.agda
redfish64/autonomic-agda
3
9978
<gh_stars>1-10 module Issue719 where import Common.Size as A module M where private open module A = M -- NOT NICE: -- Duplicate definition of module A. Previous definition of module A -- at /Users/abel/cover/alfa/Agda2-clean/test/Common/Size.agda:7,15-19 -- when scope checking the declaration -- open module A = M
src/gnat/prj-strt.ads
My-Colaborations/dynamo
15
15438
<reponame>My-Colaborations/dynamo ------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P R J . S T R T -- -- -- -- S p e c -- -- -- -- Copyright (C) 2001-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 3, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING3. If not, go to -- -- http://www.gnu.org/licenses for a complete copy of the license. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ -- This package implements parsing of string expressions in project files with Prj.Tree; use Prj.Tree; private package Prj.Strt is procedure Parse_String_Type_List (In_Tree : Project_Node_Tree_Ref; First_String : out Project_Node_Id; Flags : Processing_Flags); -- Get the list of literal strings that are allowed for a typed string. -- On entry, the current token is the first literal string following -- a left parenthesis in a string type declaration such as: -- type Toto is ("string_1", "string_2", "string_3"); -- -- On exit, the current token is the right parenthesis. The parameter -- First_String is a node that contained the first literal string of the -- string type, linked with the following literal strings. -- -- Report an error if -- - a literal string is not found at the beginning of the list -- or after a comma -- - two literal strings in the list are equal procedure Start_New_Case_Construction (In_Tree : Project_Node_Tree_Ref; String_Type : Project_Node_Id); -- This procedure is called at the beginning of a case construction. The -- parameter String_Type is the node for the string type of the case label -- variable. The different literal strings of the string type are stored -- into a table to be checked against the labels of the case construction. procedure End_Case_Construction (Check_All_Labels : Boolean; Case_Location : Source_Ptr; Flags : Processing_Flags; String_Type : Boolean); -- This procedure is called at the end of a case construction to remove -- the case labels and to restore the previous state. In particular, in the -- case of nested case constructions, the case labels of the enclosing case -- construction are restored. If When_Others is False and we are not in -- quiet output, a warning is emitted for each value of the case variable -- string type that has not been specified. procedure Parse_Choice_List (In_Tree : Project_Node_Tree_Ref; First_Choice : out Project_Node_Id; Flags : Processing_Flags; String_Type : Boolean := True); -- Get the label for a choice list. -- Report an error if -- - a case label is not a literal string -- - a case label is not in the typed string list -- - the same case label is repeated in the same case construction procedure Parse_Expression (In_Tree : Project_Node_Tree_Ref; Expression : out Project_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id; Optional_Index : Boolean; Flags : Processing_Flags); -- Parse a simple string expression or a string list expression -- -- Current_Project is the node of the project file being parsed -- -- Current_Package is the node of the package being parsed, or Empty_Node -- when we are at the project level (not in a package). On exit, Expression -- is the node of the expression that has been parsed. procedure Parse_Variable_Reference (In_Tree : Project_Node_Tree_Ref; Variable : out Project_Node_Id; Current_Project : Project_Node_Id; Current_Package : Project_Node_Id; Flags : Processing_Flags); -- Parse variable or attribute reference. Used internally (in expressions) -- and for case variables (in Prj.Dect). Current_Package is the node of the -- package being parsed, or Empty_Node when we are at the project level -- (not in a package). On exit, Variable is the node of the variable or -- attribute reference. A variable reference is made of one to three simple -- names. An attribute reference is made of one or two simple names, -- followed by an apostrophe, followed by the attribute simple name. end Prj.Strt;
programs/oeis/001/A001014.asm
neoneye/loda
22
93726
<gh_stars>10-100 ; A001014: Sixth powers: a(n) = n^6. ; 0,1,64,729,4096,15625,46656,117649,262144,531441,1000000,1771561,2985984,4826809,7529536,11390625,16777216,24137569,34012224,47045881,64000000,85766121,113379904,148035889,191102976,244140625,308915776,387420489,481890304,594823321,729000000,887503681,1073741824,1291467969,1544804416,1838265625,2176782336,2565726409,3010936384,3518743761,4096000000,4750104241,5489031744,6321363049,7256313856,8303765625,9474296896,10779215329,12230590464,13841287201,15625000000,17596287801,19770609664,22164361129,24794911296,27680640625,30840979456,34296447249,38068692544,42180533641,46656000000,51520374361,56800235584,62523502209,68719476736,75418890625,82653950016,90458382169,98867482624,107918163081,117649000000,128100283921,139314069504,151334226289,164206490176,177978515625,192699928576,208422380089,225199600704,243087455521,262144000000,282429536481,304006671424,326940373369,351298031616,377149515625,404567235136,433626201009,464404086784,496981290961,531441000000,567869252041,606355001344,646990183449,689869781056,735091890625,782757789696,832972004929,885842380864,941480149401 pow $0,6
alloy4fun_models/trashltl/models/7/eEwbFYSWiAwiSXMoz.als
Kaixi26/org.alloytools.alloy
0
1062
<filename>alloy4fun_models/trashltl/models/7/eEwbFYSWiAwiSXMoz.als open main pred ideEwbFYSWiAwiSXMoz_prop8 { eventually File.link in Trash } pred __repair { ideEwbFYSWiAwiSXMoz_prop8 } check __repair { ideEwbFYSWiAwiSXMoz_prop8 <=> prop8o }
libsrc/_DEVELOPMENT/math/float/math48/c/sccz80/cm48_sccz80_fdim.asm
jpoikela/z88dk
640
92729
; double fdim(double x, double y) SECTION code_clib SECTION code_fp_math48 PUBLIC cm48_sccz80_fdim EXTERN am48_fdim, cm48_sccz80p_dread2 cm48_sccz80_fdim: call cm48_sccz80p_dread2 ; AC = x ; AC'= y exx jp am48_fdim
libsrc/rs232/cpc/sti/rs232_get.asm
grancier/z180
0
245745
<filename>libsrc/rs232/cpc/sti/rs232_get.asm ; ; z88dk RS232 Function ; ; Amstrad CPC (STI) version ; ; unsigned char rs232_get(char *) ; ; $Id: rs232_get.asm,v 1.4 2016/06/23 20:15:37 dom Exp $ ; fastcall so implicit push SECTION code_clib PUBLIC rs232_get PUBLIC _rs232_get rs232_get: _rs232_get: ld bc,$f8e1 xor a out (c),a ld c,$ed nowort: in a,(c) bit 7,a jr z,nowort ld c,$ef in a,(c) ld c,$e1 ld e,1 out (c),e ld (hl),a ld hl,0 ; RS_ERR_OK ;;; ld hl,RS_ERR_NO_DATA ret
oeis/067/A067046.asm
neoneye/loda-programs
11
91955
; A067046: a(n) = lcm(n, n+1, n+2)/6. ; 1,2,10,10,35,28,84,60,165,110,286,182,455,280,680,408,969,570,1330,770,1771,1012,2300,1300,2925,1638,3654,2030,4495,2480,5456,2992,6545,3570,7770,4218,9139,4940,10660,5740,12341,6622,14190,7590,16215,8648,18424,9800,20825,11050,23426,12402,26235,13860,29260,15428,32509,17110,35990,18910,39711,20832,43680,22880,47905,25058,52394,27370,57155,29820,62196,32412,67525,35150,73150,38038,79079,41080,85320,44280,91881,47642,98770,51170,105995,54868,113564,58740,121485,62790,129766,67022,138415,71440 add $0,3 mov $1,$0 bin $0,3 gcd $1,2 div $0,$1
Task/Benfords-law/Ada/benfords-law-2.ada
LaudateCorpus1/RosettaCodeData
1
19958
-- N_IO.Get(Counter);
test/interaction/InferIrrelevant.agda
asr/agda-kanso
1
8587
<reponame>asr/agda-kanso<filename>test/interaction/InferIrrelevant.agda -- Andreas, 2011-10-04 -- I'd like to infer the type of a even though it is irrelevant -- E.g. when pressing C-c C-. module InferIrrelevant where f : (A : Set)(g : .A → A).(a : A) → A f A g a = {!a!}
oeis/193/A193421.asm
neoneye/loda-programs
11
246662
<filename>oeis/193/A193421.asm ; A193421: E.g.f.: Sum_{n>=0} x^n * exp(n^2*x). ; Submitted by <NAME> ; 1,1,4,33,436,8185,206046,6622945,263313688,12627149265,716160702970,47284266221401,3587061106583604,309251317536586633,30017652739792964806,3254137305364883664945,391238883136463492841136,51846176797206158144925985 mov $3,1 lpb $0 sub $0,1 add $1,1 mov $2,$0 pow $2,2 pow $2,$1 mul $3,$1 add $3,$2 lpe mov $0,$3
programs/oeis/173/A173691.asm
jmorken/loda
1
175566
<reponame>jmorken/loda ; A173691: Partial sums of round(n^2/6). ; 0,0,1,3,6,10,16,24,35,49,66,86,110,138,171,209,252,300,354,414,481,555,636,724,820,924,1037,1159,1290,1430,1580,1740,1911,2093,2286,2490,2706,2934,3175,3429,3696,3976,4270,4578,4901,5239,5592,5960,6344,6744,7161,7595,8046,8514,9000,9504,10027,10569,11130,11710,12310,12930,13571,14233,14916,15620,16346,17094,17865,18659,19476,20316,21180,22068,22981,23919,24882,25870,26884,27924,28991,30085,31206,32354,33530,34734,35967,37229,38520,39840,41190,42570,43981,45423,46896,48400,49936,51504,53105,54739,56406,58106,59840,61608,63411,65249,67122,69030,70974,72954,74971,77025,79116,81244,83410,85614,87857,90139,92460,94820,97220,99660,102141,104663,107226,109830,112476,115164,117895,120669,123486,126346,129250,132198,135191,138229,141312,144440,147614,150834,154101,157415,160776,164184,167640,171144,174697,178299,181950,185650,189400,193200,197051,200953,204906,208910,212966,217074,221235,225449,229716,234036,238410,242838,247321,251859,256452,261100,265804,270564,275381,280255,285186,290174,295220,300324,305487,310709,315990,321330,326730,332190,337711,343293,348936,354640,360406,366234,372125,378079,384096,390176,396320,402528,408801,415139,421542,428010,434544,441144,447811,454545,461346,468214,475150,482154,489227,496369,503580,510860,518210,525630,533121,540683,548316,556020,563796,571644,579565,587559,595626,603766,611980,620268,628631,637069,645582,654170,662834,671574,680391,689285,698256,707304,716430,725634,734917,744279,753720,763240,772840,782520,792281,802123,812046,822050,832136,842304,852555,862889 mov $2,$0 mov $3,$0 lpb $2 mov $0,$3 sub $2,1 sub $0,$2 mov $4,$0 mul $4,$0 add $4,4 div $4,6 add $1,$4 lpe
src/main/fragment/mos6502-common/pbuc1_derefidx_vbuxx=_dec_pbuc1_derefidx_vbuxx.asm
jbrandwood/kickc
2
96076
<reponame>jbrandwood/kickc dec {c1},x
alloy4fun_models/trainstlt/models/7/YEDHYsNR2oypmMmnj.als
Kaixi26/org.alloytools.alloy
0
4752
open main pred idYEDHYsNR2oypmMmnj_prop8 { always ( all t:Train | some t.pos.prox.signal implies (t.pos.prox.signal in Green) releases (t.pos' = t.pos) ) } pred __repair { idYEDHYsNR2oypmMmnj_prop8 } check __repair { idYEDHYsNR2oypmMmnj_prop8 <=> prop8o }
Groups/Polynomials/Examples.agda
Smaug123/agdaproofs
4
471
<reponame>Smaug123/agdaproofs {-# OPTIONS --safe --warning=error --without-K #-} open import LogicalFormulae open import Numbers.Integers.Integers open import Numbers.Integers.Definition open import Lists.Lists open import Maybe module Groups.Polynomials.Examples where open import Groups.Polynomials.Definition ℤGroup private decide : _ decide = (λ a → ℤDecideEquality a (nonneg 0)) p1 : degree decide [] ≡ no p1 = refl p2 : degree decide (nonneg 0 :: []) ≡ no p2 = refl p3 : degree decide (nonneg 1 :: []) ≡ yes 0 p3 = refl
grammars/src/main/antlr/Adl14.g4
SkidderDuck/archie
1
1872
<filename>grammars/src/main/antlr/Adl14.g4 // // description: Antlr4 grammar for Archetype Definition Language (ADL2) // author: <NAME> <<EMAIL>> // support: openEHR Specifications PR tracker <https://openehr.atlassian.net/projects/SPECPR/issues> // copyright: Copyright (c) 2015 openEHR Foundation // license: Apache 2.0 License <http://www.apache.org/licenses/LICENSE-2.0.html> // grammar Adl14; import cadl14, odin14; // // ============== Parser rules ============== // adl: ( archetype) EOF ; archetype: SYM_ARCHETYPE meta_data? ARCHETYPE_HRID specialization_section? concept_section language_section description_section definition_section rules_section? terminology_section ; specialization_section : SYM_SPECIALIZE archetype_ref ; language_section : SYM_LANGUAGE odin_text ; description_section : SYM_DESCRIPTION odin_text ; definition_section : SYM_DEFINITION c_complex_object ; rules_section : SYM_RULES assertion_list; terminology_section : SYM_TERMINOLOGY odin_text ; concept_section: 'concept' '[' AT_CODE ']'; meta_data: '(' meta_data_item (';' meta_data_item )* ')' ; meta_data_item: meta_data_tag_adl_version '=' (REAL|VERSION_ID) | meta_data_tag_uid '=' guid_or_oid | meta_data_tag_build_uid '=' guid_or_oid | meta_data_tag_rm_release '=' (REAL|VERSION_ID) | meta_data_tag_is_controlled | meta_data_tag_is_generated | identifier ( '=' meta_data_value )? ; meta_data_value: primitive_value | guid_or_oid | (REAL|VERSION_ID) ; guid_or_oid: (GUID | OID | VERSION_ID); //VERSION_ID is the same as a OID with one or two dots meta_data_tag_adl_version : 'adl_version' ; meta_data_tag_uid : 'uid' ; meta_data_tag_build_uid : 'build_uid' ; meta_data_tag_rm_release : 'rm_release' ; meta_data_tag_is_controlled : 'is_controlled' ; meta_data_tag_is_generated : 'is_generated' ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/self.adb
best08618/asylo
7
14309
package body Self is function G (X : Integer) return Lim is begin return R : Lim := (Comp => X, others => <>); end G; procedure Change (X : in out Lim; Incr : Integer) is begin X.Comp := X.Comp + Incr; X.Self_Default.Comp := X.Comp + Incr; X.Self_Anon_Default.Comp := X.Comp + Incr; end Change; function Get (X : Lim) return Integer is begin return X.Comp; end; end Self;
arch/ARM/cortex_m/src/cm7/cortex_m_svd-cache.ads
rocher/Ada_Drivers_Library
192
5783
<reponame>rocher/Ada_Drivers_Library<filename>arch/ARM/cortex_m/src/cm7/cortex_m_svd-cache.ads -- This spec has been automatically generated from cm7.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; -- Cache maintenance operations package Cortex_M_SVD.Cache is pragma Preelaborate; --------------- -- Registers -- --------------- subtype DCISW_Set_Field is HAL.UInt9; subtype DCISW_Way_Field is HAL.UInt2; -- Data cache invalidate by set/way type DCISW_Register is record -- unspecified Reserved_0_4 : HAL.UInt5 := 16#0#; -- Write-only. Set/index that operation applies to. The number of -- indices in a cache depends on the configured cache size. When this is -- less than the maximum, use the LSB of this field. Set : DCISW_Set_Field := 16#0#; -- unspecified Reserved_14_29 : HAL.UInt16 := 16#0#; -- Write-only. Way that operation applies to. For the data cache, values -- 0, 1, 2 and 3 are supported.. Way : DCISW_Way_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DCISW_Register use record Reserved_0_4 at 0 range 0 .. 4; Set at 0 range 5 .. 13; Reserved_14_29 at 0 range 14 .. 29; Way at 0 range 30 .. 31; end record; subtype DCCSW_Set_Field is HAL.UInt9; subtype DCCSW_Way_Field is HAL.UInt2; -- Data cache clean by set/way type DCCSW_Register is record -- unspecified Reserved_0_4 : HAL.UInt5 := 16#0#; -- Write-only. Set/index that operation applies to. The number of -- indices in a cache depends on the configured cache size. When this is -- less than the maximum, use the LSB of this field. Set : DCCSW_Set_Field := 16#0#; -- unspecified Reserved_14_29 : HAL.UInt16 := 16#0#; -- Write-only. Way that operation applies to. For the data cache, values -- 0, 1, 2 and 3 are supported.. Way : DCCSW_Way_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DCCSW_Register use record Reserved_0_4 at 0 range 0 .. 4; Set at 0 range 5 .. 13; Reserved_14_29 at 0 range 14 .. 29; Way at 0 range 30 .. 31; end record; subtype DCCISW_Set_Field is HAL.UInt9; subtype DCCISW_Way_Field is HAL.UInt2; -- Data cache clean and invalidate by set/way type DCCISW_Register is record -- unspecified Reserved_0_4 : HAL.UInt5 := 16#0#; -- Write-only. Set/index that operation applies to. The number of -- indices in a cache depends on the configured cache size. When this is -- less than the maximum, use the LSB of this field. Set : DCCISW_Set_Field := 16#0#; -- unspecified Reserved_14_29 : HAL.UInt16 := 16#0#; -- Write-only. Way that operation applies to. For the data cache, values -- 0, 1, 2 and 3 are supported.. Way : DCCISW_Way_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for DCCISW_Register use record Reserved_0_4 at 0 range 0 .. 4; Set at 0 range 5 .. 13; Reserved_14_29 at 0 range 14 .. 29; Way at 0 range 30 .. 31; end record; ----------------- -- Peripherals -- ----------------- -- Cache maintenance operations type Cache_Peripheral is record -- Instruction cache invalidate all to the PoU ICIALLU : aliased HAL.UInt32; -- Instruction cache invalidate by address to the PoU ICIMVAU : aliased HAL.UInt32; -- Data cache invalidate by address to the PoC DCIMVAC : aliased HAL.UInt32; -- Data cache invalidate by set/way DCISW : aliased DCISW_Register; -- Data cache clean by address to the PoU DCCMVAU : aliased HAL.UInt32; -- Data cache clean by address to the PoC DCCMVAC : aliased HAL.UInt32; -- Data cache clean by set/way DCCSW : aliased DCCSW_Register; -- Data cache clean and invalidate by address to the PoC DCCIMVAC : aliased HAL.UInt32; -- Data cache clean and invalidate by set/way DCCISW : aliased DCCISW_Register; end record with Volatile; for Cache_Peripheral use record ICIALLU at 16#0# range 0 .. 31; ICIMVAU at 16#8# range 0 .. 31; DCIMVAC at 16#C# range 0 .. 31; DCISW at 16#10# range 0 .. 31; DCCMVAU at 16#14# range 0 .. 31; DCCMVAC at 16#18# range 0 .. 31; DCCSW at 16#1C# range 0 .. 31; DCCIMVAC at 16#20# range 0 .. 31; DCCISW at 16#24# range 0 .. 31; end record; -- Cache maintenance operations Cache_Periph : aliased Cache_Peripheral with Import, Address => Cache_Base; end Cortex_M_SVD.Cache;
src/palette_streamer.asm
ISSOtm/gb-open-world
8
245635
<reponame>ISSOtm/gb-open-world NB_BG_PALETTES equ 128 NB_OBJ_PALETTES equ 128 NB_HW_PALS equ 8 ; There currently only 1 small routine, it's not worth moving into ROMX for now SECTION "Palette streamer routine", ROM0 ; Inits a palette streamer struct ; @param hl Pointer to the base of the palette streamer InitPaletteStreamer:: xor a assert NB_BG_PALETTES == NB_OBJ_PALETTES, "Can't use same init func!" ;ld c, NB_BG_PALETTES * 2 assert NB_BG_PALETTES * 2 == 256 ld c, a ; ld c, 0 rst MemsetSmall inc a ; ld a, 1 ld c, NB_HW_PALS jp MemsetSmall SECTION "BG palette streamer", WRAM0,ALIGN[8] ; Array of ref counts indexed by the "global" BG palette ID ; If non-zero, then the palette is loaded somewhere in the `wBGPaletteIDs` array wBGPaletteCounts:: ds NB_BG_PALETTES * 2 .end:: assert NB_BG_PALETTES <= 128, "Explanation below no longer true!" ; PPPP PPPU ; P = Which "global" BG palette is loaded in this slot ; U = If set, other 7 bits are meaningless ; This is useful e.g. if coming from another menu which overwrote this ; Note: a free slot should be exactly $01; other values with the U bit set indicate that the ; palette slot is not available for dynamic allocation (e.g. reserved by UI) ; ; Info: here's how the main loop's map loader treats palettes for fading ; If bit 0 is reset, the palette is always faded ; Otherwise, the palette is faded if and only if bit 1 is set wBGPaletteIDs:: ds NB_HW_PALS .end:: SECTION "OBJ palette streamer", WRAM0,ALIGN[8] ; Same format as above wOBJPaletteCounts:: ds NB_OBJ_PALETTES * 2 wOBJPaletteIDs: ds NB_HW_PALS
Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca.log_19_1347.asm
ljhsiun2/medusa
9
246471
<filename>Transynther/x86/_processed/NC/_zr_/i9-9900K_12_0xca.log_19_1347.asm<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %rbx push %rcx push %rsi lea addresses_normal_ht+0x1d0b2, %rcx cmp $61829, %r14 movw $0x6162, (%rcx) nop and %r14, %r14 lea addresses_normal_ht+0xcc32, %rbx nop nop nop xor $32129, %rcx mov (%rbx), %rsi nop nop and $592, %rbx pop %rsi pop %rcx pop %rbx pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r13 push %r15 push %r9 push %rbp push %rcx push %rdi // Store lea addresses_PSE+0xa072, %rdi nop nop nop add %r13, %r13 movl $0x51525354, (%rdi) nop nop nop nop nop add %rbp, %rbp // Store lea addresses_US+0x11e72, %r11 nop nop xor %rcx, %rcx mov $0x5152535455565758, %r13 movq %r13, (%r11) nop nop nop nop sub $4130, %rbp // Load mov $0x14f8760000000d72, %r9 nop cmp %r15, %r15 movb (%r9), %cl nop nop nop nop nop xor $15633, %r9 // Faulty Load mov $0x6ff0e80000000172, %rbp nop nop nop nop nop and %rdi, %rdi vmovups (%rbp), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %rcx lea oracles, %rdi and $0xff, %rcx shlq $12, %rcx mov (%rdi,%rcx,1), %rcx pop %rdi pop %rcx pop %rbp pop %r9 pop %r15 pop %r13 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'size': 2, 'NT': False, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 0}} {'OP': 'STOR', 'dst': {'size': 4, 'NT': False, 'type': 'addresses_PSE', 'same': False, 'AVXalign': False, 'congruent': 8}} {'OP': 'STOR', 'dst': {'size': 8, 'NT': False, 'type': 'addresses_US', 'same': False, 'AVXalign': True, 'congruent': 7}} {'OP': 'LOAD', 'src': {'size': 1, 'NT': True, 'type': 'addresses_NC', 'same': False, 'AVXalign': False, 'congruent': 10}} [Faulty Load] {'OP': 'LOAD', 'src': {'size': 32, 'NT': False, 'type': 'addresses_NC', 'same': True, 'AVXalign': False, 'congruent': 0}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'size': 2, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'OP': 'LOAD', 'src': {'size': 8, 'NT': False, 'type': 'addresses_normal_ht', 'same': False, 'AVXalign': False, 'congruent': 6}} {'00': 19} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
source/directories/a-creden.ads
ytomino/drake
33
8281
<reponame>ytomino/drake<filename>source/directories/a-creden.ads<gh_stars>10-100 pragma License (Unrestricted); -- extended unit package Ada.Credentials is -- There is a function to get user information. pragma Preelaborate; function User_Name return String; end Ada.Credentials;
src/CategoryTheory/Adjunction.agda
DimaSamoz/temporal-type-systems
4
9727
<gh_stars>1-10 {- Type class for adjoint functors -} module CategoryTheory.Adjunction where open import CategoryTheory.Categories open import CategoryTheory.Functor open import CategoryTheory.NatTrans open import CategoryTheory.Monad open import CategoryTheory.Comonad -- Adjunction between two functors record _⊣_ {n} {ℂ 𝔻 : Category n} (F : Functor ℂ 𝔻) (G : Functor 𝔻 ℂ) : Set (lsuc n) where private module ℂ = Category ℂ private module 𝔻 = Category 𝔻 private module F = Functor F private module G = Functor G field -- || Definitions -- Unit η : I ⟹ G ◯ F -- Counit ε : F ◯ G ⟹ I private module η = _⟹_ η private module ε = _⟹_ ε -- | Isomorphism of homsets ϕ : ∀{A : ℂ.obj} {B : 𝔻.obj} -> (F.omap A 𝔻.~> B) -> (A ℂ.~> G.omap B) ϕ {A} f = G.fmap f ℂ.∘ η.at A ϕ⁻ : ∀{B : 𝔻.obj} {A : ℂ.obj} -> (A ℂ.~> G.omap B) -> (F.omap A 𝔻.~> B) ϕ⁻ {B} f = ε.at B 𝔻.∘ F.fmap f field -- || Laws -- First triangle identity: εF ∘ Fη = ιd tri1 : ∀ {A : ℂ.obj} -> ε.at (F.omap A) 𝔻.∘ F.fmap (η.at A) 𝔻.≈ 𝔻.id -- Second triangle inequality: Gε ∘ ηG = ιd tri2 : ∀ {B : 𝔻.obj} -> G.fmap (ε.at B) ℂ.∘ η.at (G.omap B) ℂ.≈ ℂ.id -- || An adjunction induces a monad and a comonad AdjMonad : ∀ {n} {ℂ 𝔻 : Category n} {F : Functor ℂ 𝔻} {G : Functor 𝔻 ℂ} -> F ⊣ G -> Monad ℂ AdjMonad {n} {ℂ} {𝔻} {F} {G} adj = record { T = G ◯ F ; η = F⊣G.η ; μ = record { at = λ A → G.fmap (at F⊣G.ε (F.omap A)) ; nat-cond = G.fmap-∘ [sym] ≈> G.fmap-cong (nat-cond F⊣G.ε) ≈> G.fmap-∘ } ; η-unit1 = F⊣G.tri2 ; η-unit2 = G.fmap-∘ [sym] ≈> G.fmap-cong (F⊣G.tri1) ≈> G.fmap-id ; μ-assoc = G.fmap-∘ [sym] ≈> G.fmap-cong (nat-cond F⊣G.ε) ≈> G.fmap-∘ } where private module F⊣G = _⊣_ adj open Category ℂ private module 𝔻 = Category 𝔻 private module F = Functor F private module G = Functor G open _⟹_ AdjComonad : ∀ {n} {ℂ 𝔻 : Category n} {F : Functor ℂ 𝔻} {G : Functor 𝔻 ℂ} -> F ⊣ G -> Comonad 𝔻 AdjComonad {n} {ℂ} {𝔻} {F} {G} adj = record { W = F ◯ G ; ε = F⊣G.ε ; δ = record { at = λ A → F.fmap (at F⊣G.η (G.omap A)) ; nat-cond = F.fmap-∘ [sym] ≈> F.fmap-cong (nat-cond F⊣G.η) ≈> F.fmap-∘ } ; ε-unit1 = F⊣G.tri1 ; ε-unit2 = F.fmap-∘ [sym] ≈> F.fmap-cong (F⊣G.tri2) ≈> F.fmap-id ; δ-assoc = F.fmap-∘ [sym] ≈> F.fmap-cong ((nat-cond F⊣G.η) ℂ.[sym]) ≈> F.fmap-∘ } where private module F⊣G = _⊣_ adj open Category 𝔻 private module ℂ = Category ℂ private module F = Functor F private module G = Functor G open _⟹_
Groups/Polynomials/Group.agda
Smaug123/agdaproofs
4
4874
<filename>Groups/Polynomials/Group.agda {-# OPTIONS --safe --warning=error --without-K #-} open import Groups.Abelian.Definition open import Groups.Definition open import Setoids.Setoids open import Sets.EquivalenceRelations open import Lists.Lists module Groups.Polynomials.Group {a b : _} {A : Set a} {S : Setoid {a} {b} A} {_+_ : A → A → A} (G : Group S _+_) where open import Groups.Polynomials.Definition G open import Groups.Polynomials.Addition G public open Setoid S open Equivalence eq polyGroup : Group naivePolySetoid _+P_ Group.+WellDefined polyGroup = +PwellDefined Group.0G polyGroup = [] Group.inverse polyGroup = inverse' Group.+Associative polyGroup {a} {b} {c} = assoc {a} {b} {c} Group.identRight polyGroup = PidentRight Group.identLeft polyGroup = PidentLeft Group.invLeft polyGroup {a} = invLeft' {a} Group.invRight polyGroup {a} = invRight' {a} abelian : AbelianGroup G → AbelianGroup polyGroup AbelianGroup.commutative (abelian ab) {x} {y} = comm ab {x} {y}
ada-containers-bounded_synchronized_queues.ads
mgrojo/adalib
15
19626
<reponame>mgrojo/adalib -- Standard Ada library specification -- Copyright (c) 2004-2016 AXE Consultants -- Copyright (c) 2004, 2005, 2006 Ada-Europe -- Copyright (c) 2000 The MITRE Corporation, Inc. -- Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc. -- SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual --------------------------------------------------------------------------- with System; with Ada.Containers.Synchronized_Queue_Interfaces; generic with package Queue_Interfaces is new Ada.Containers.Synchronized_Queue_Interfaces (<>); Default_Capacity : Count_Type; Default_Ceiling : System.Any_Priority := System.Priority'Last; package Ada.Containers.Bounded_Synchronized_Queues is pragma Preelaborate(Bounded_Synchronized_Queues); package Implementation is -- not specified by the language end Implementation; protected type Queue (Capacity : Count_Type := Default_Capacity; Ceiling : System.Any_Priority := Default_Ceiling) with Priority => Ceiling is new Queue_Interfaces.Queue with overriding entry Enqueue (New_Item : in Queue_Interfaces.Element_Type); overriding entry Dequeue (Element : out Queue_Interfaces.Element_Type); overriding function Current_Use return Count_Type; overriding function Peak_Use return Count_Type; private -- not specified by the language end Queue; private -- not specified by the language end Ada.Containers.Bounded_Synchronized_Queues;
src/fot/FOTC/Base/List.agda
asr/fotc
11
9472
------------------------------------------------------------------------------ -- FOTC combinators for lists, colists, streams, etc. ------------------------------------------------------------------------------ {-# OPTIONS --exact-split #-} {-# OPTIONS --no-sized-types #-} {-# OPTIONS --no-universe-polymorphism #-} {-# OPTIONS --without-K #-} module FOTC.Base.List where open import FOTC.Base infixr 5 _∷_ ------------------------------------------------------------------------------ -- List constants. postulate [] cons head tail null : D -- FOTC partial lists. -- Definitions abstract _∷_ : D → D → D x ∷ xs = cons · x · xs -- {-# ATP definition _∷_ #-} head₁ : D → D head₁ xs = head · xs -- {-# ATP definition head₁ #-} tail₁ : D → D tail₁ xs = tail · xs -- {-# ATP definition tail₁ #-} null₁ : D → D null₁ xs = null · xs -- {-# ATP definition null₁ #-} ------------------------------------------------------------------------------ -- Conversion rules -- Conversion rules for null. -- null-[] : null · [] ≡ true -- null-∷ : ∀ x xs → null · (cons · x · xs) ≡ false postulate null-[] : null₁ [] ≡ true null-∷ : ∀ x xs → null₁ (x ∷ xs) ≡ false -- Conversion rule for head. -- head-∷ : ∀ x xs → head · (cons · x · xs) ≡ x postulate head-∷ : ∀ x xs → head₁ (x ∷ xs) ≡ x {-# ATP axiom head-∷ #-} -- Conversion rule for tail. -- tail-∷ : ∀ x xs → tail · (cons · x · xs) ≡ xs postulate tail-∷ : ∀ x xs → tail₁ (x ∷ xs) ≡ xs {-# ATP axiom tail-∷ #-} ------------------------------------------------------------------------------ -- Discrimination rules -- postulate []≢cons : ∀ {x xs} → [] ≢ cons · x · xs postulate []≢cons : ∀ {x xs} → [] ≢ x ∷ xs
query/src/main/resources/antlr4/ca/phon/query/pql/PQL.g4
ghedlund/phon
3
4949
/* * A query langauge for Phon projects/sessions * */ parser grammar PQL; options { tokenVocab=PQLTokens; } start : query includes EOF ; query : find_query | select_query ; find_query : FIND expr IN select_query ; select_query : SELECT tier_list search_by? FROM session_or_record_list (INCLUDE EXCLUDED RECORDS)? filter_blocks ; search_by : BY (GROUP|WORD) (THEN BY SYLLABLE)? ; expr : plain_text_expr | ipa_expr ; plain_text_expr : QUOTED_STRING # PlainTextExpr | REGEX (QUOTED_STRING|SLASHED_STRING) # RegexExpr ; ipa_expr : PHONEX (QUOTED_STRING|SLASHED_STRING) # PhonexExpr | (WORD SHAPE|STRESS PATTERN) QUOTED_STRING # WordShapeExpr | CV PATTERN QUOTED_STRING # CVPatternExpr ; tier_list : tier_name (COMMA tier_name)* # TierList | STAR # AllTiers ; tier_name : ORTHOGRAPHY | IPATARGET | IPAACTUAL | ALIGNMENT | NOTES | QUOTED_STRING ; session_or_record_list : session_list | record_list ; session_list : session_name (COMMA session_name)* # SessionList | STAR DOT STAR # AllProjectSessions ; session_name : QUOTED_STRING (HASH record_list HASH)? ; record_list : STAR # AllRecords | record_or_range (COMMA record_or_range)* # RecordList ; record_or_range : integer # RecordNumber | integer RANGE_OP integer # RecordRange ; filter_blocks : filter_block* ; filter_block : where_speaker | where_group | where_word | where_syllable | where_session | where_project ; contains_or_equals : CONTAINS | EQUALS ; where_project : WHERE PROJECT OPEN_BRACE where_project_stmt CLOSE_BRACE ; where_project_stmt : where_project_or_stmt ; where_project_or_stmt : where_project_and_stmt (OR where_project_and_stmt)* ; where_project_and_stmt : where_project_unary_stmt (AND where_project_unary_stmt)* ; where_project_unary_stmt : NAME NOT? contains_or_equals plain_text_expr | OPEN_PAREN where_project_stmt CLOSE_PAREN ; where_session : WHERE SESSION OPEN_BRACE where_session_stmt CLOSE_BRACE ; where_session_stmt : where_session_or_stmt ; where_session_or_stmt : where_session_and_stmt (OR where_session_and_stmt)* ; where_session_and_stmt : where_session_unary_stmt (AND where_session_unary_stmt)* ; where_session_unary_stmt : NAME NOT? contains_or_equals plain_text_expr | DATE NOT? (AFTER|BEFORE|EQUALS) date_expr | OPEN_PAREN where_session_stmt CLOSE_PAREN ; where_speaker : WHERE SPEAKER OPEN_BRACE where_speaker_stmt CLOSE_BRACE ; where_speaker_stmt : where_speaker_or_stmt ; where_speaker_or_stmt : where_speaker_and_stmt (OR where_speaker_and_stmt)* ; where_speaker_and_stmt : where_speaker_unary_stmt (AND where_speaker_unary_stmt)* ; where_speaker_unary_stmt : ID NOT? contains_or_equals plain_text_expr | ROLE NOT? IS QUOTED_STRING | NAME NOT? contains_or_equals plain_text_expr | AGE NOT? (EQUALS|GREATER THAN|LESS THAN) period_expr | BIRTHDAY NOT? (EQUALS|BEFORE|AFTER) date_expr | SEX NOT? IS (MALE|FEMALE) | LANGUAGE NOT? contains_or_equals plain_text_expr | EDUCATION NOT? contains_or_equals plain_text_expr | SES NOT? contains_or_equals plain_text_expr | OPEN_PAREN where_speaker_stmt CLOSE_PAREN ; where_group : WHERE GROUP OPEN_BRACE where_group_stmt CLOSE_BRACE ; where_group_stmt : where_group_or_stmt ; where_group_or_stmt : where_group_and_stmt (OR where_group_and_stmt)* ; where_group_and_stmt : where_group_unary_stmt (AND where_group_unary_stmt)* ; where_group_unary_stmt : tier_name? contains_or_equals expr | tier_name? WORD COUNT NOT? (EQUALS|GREATER THAN|LESS THAN) integer | SEGMENT LENGTH NOT? (EQUALS|GREATER THAN|LESS THAN) (number | period_expr) | SEGMENT START NOT? (EQUALS|GREATER THAN|LESS THAN) (number | period_expr) | SEGMENT END NOT? (EQUALS|GREATER THAN|LESS THAN) (number | period_expr) | OPEN_PAREN where_group_stmt CLOSE_PAREN ; where_word : WHERE WORD OPEN_BRACE where_word_stmt CLOSE_BRACE ; where_word_stmt : where_word_or_stmt ; where_word_or_stmt : where_word_and_stmt (OR where_word_and_stmt)* ; where_word_and_stmt : where_word_unary_stmt (AND where_word_unary_stmt)* ; where_word_unary_stmt : tier_name? contains_or_equals expr | tier_name? SYLLABLE COUNT NOT? (EQUALS|GREATER THAN|LESS THAN) number | tier_name? POSITION NOT? EQUALS (INITIAL|MEDIAL|FINAL|tier_name) | OPEN_PAREN where_word_stmt CLOSE_PAREN ; where_syllable : WHERE SYLLABLE OPEN_BRACE where_syllable_stmt CLOSE_BRACE ; where_syllable_stmt : where_syllable_or_stmt ; where_syllable_or_stmt : where_syllable_and_stmt (OR where_syllable_and_stmt)* ; where_syllable_and_stmt : where_syllable_unary_stmt (AND where_syllable_unary_stmt)* ; where_syllable_unary_stmt : tier_name? contains_or_equals expr | tier_name? STRESS NOT? EQUALS (PRIMARY|SECONDARY|UNSTRESSED|ALIGNED) | tier_name? TONE NUMBER NOT? EQUALS (number | ALIGNED) | tier_name? POSITION NOT? EQUALS (INITIAL|MEDIAL|FINAL|ALIGNED) | OPEN_PAREN where_syllable_stmt CLOSE_PAREN ; period_expr : QUOTED_STRING ; date_expr : QUOTED_STRING ; includes : include_stmt* ; include_stmt : INCLUDE ALIGNED PHONES # IncludeAlignedPhones | INCLUDE tier_list # IncludeTiers ; integer : DIGIT+ ; number : DIGIT+ (DOT DIGIT+) ;
Source code/sound.asm
madztheo/piano-assembly
5
161310
name "kernel" ; directive to create bin file #make_bin# ;where our kernel is located, to help our bootloader to load it properly #load_segment=0800# #load_offset=0000# ;We define default values for the registers #al=0b# #ah=00# #bh=00# #bl=00# #ch=00# #cl=02# #dh=00# #dl=00# #ds=0800# #es=0800# #si=7c02# #di=0000# #bp=0000# #cs=0800# #ip=0000# #ss=07c0# #sp=03fe# org 0000h ;As specified above, the offset of our program is 0000h ;We make sure that ds is equal to cs push cs pop ds ;Set the video mode for text output mov ah, 00h mov al, 03h int 10h ;Blinking disabled for compatibility with dos/bios, ;emulator and windows prompt never blink mov ax, 1003h mov bx, 0 ; disable blinking int 10h nop ;Print the welcoming message showing several options for the user to choose printTheMessage: lea si, msg ;load the address of the welcome message CALL printString mov ah, 00h int 16h ;Interrupt to wait for a keyboard input CMP ah, 01h ;Escape je rebootTheSystem CMP ah, 02h ;Key 1 je goOn CMP ah, 03h ;Key 2 je watchMePlaySubMenu CMP ah, 04h ;Key 3 je trainingSubMenu CMP ah, 05h ;Key 4 je help CALL clearWindow lea si, tryAgainMsg ;load the address of the try again message CALL printString jmp printTheMessage ;jump back to the beginning as the input was unsupported rebootTheSystem: jmp 0ffffh:0000h ;reboot the system, redirecting to our bootloader ;Pre-load free to play mode goOn: CALL getThePianoReady jmp freeToPlay ;Pre-load watch me play mode by asking which music to load watchMePlaySubMenu: CALL clearWindow lea si, watchMePlaySubMenuMsg ;load the address of the watch me play submenu message CALL printString ;We wait for the user to make its choice mov ah, 00h int 16h CMP ah, 01h je rebootTheSystem ;Escape has been pressed, so we reboot CMP ah, 04h jle loadTheTrack ;The user has pressed one of the right key, so we carry on with the right track CALL clearWindow jmp watchMePlaySubMenu ;wrong choice, we get back to ask the user for a right anwser again loadTheTrack: CALL loadTheMusic CALL getThePianoReady jmp watchMePlay ;Everything is ready for the watch me play mode, so we move along ;Pre-load training mode by asking which music to load trainingSubMenu: CALL clearWindow lea si, trainingSubMenuMsg ;load the address of the training submenu message CALL printString ;We wait for the user to make its choice mov ah, 00h int 16h CMP ah, 01h je rebootTheSystem ;Escape, so we reboot CMP ah, 04h jle loadTheTrackTraining ;Right key pressed, so we load the requested track CALL clearWindow jmp trainingSubMenu loadTheTrackTraining: CALL loadTheMusic CALL getThePianoReady jmp trainingMode ;The track has been loaded, so we can start the training mode help: CALL clearWindow lea si, helpMsg ;load the address of the help message CALL printString waitForTheKeyPress: ;We wait for a key to be pressed, mostly escape if the user want to reboot mov ah, 00h int 16h CMP ah,01h je rebootTheSystem ;Escape has been pressed, so we reboot to quit the help jmp waitForTheKeyPress ;The user has pressed another key, so we get back waiting for another ;Free to play mode where the user can play whatever he wants freeToPlay: ;We wait for a key to be pressed mov ah, 00h int 16h CMP ah, 01h je rebootTheSystem ;Escape has been pressed, so we reboot to quit the free to play mode ;Another key has been pressed, so we try to define the corresponding frequency CALL defineSound ;The sound is played and the key is redrawn on the screen if the key is mapped, otherwise nothing happens CALL playSound jmp freeToPlay ;We jump back to the start waiting for the user to press another key ;Watch me play mode where the computer plays a track chosen by the user watchMePlay: CMP [si], 0 ;We compare the current note (key code actually) of the track to zero which is marking the end of the track je rebootTheSystem ;We hit the zero, thus the track is over, so we reboot the system to quit the watch me play mode mov ah, [si] ;We load the value of the current key code in ah at the address store in si, the one of the current key code in our array push si ;We put the value of si in the stack as it's going to be changed in the procedures below ;We play the sound and redraw the key, as the key code has been store in ah CALL defineSound CALL playSound ;We put back the right value of si stored in the stack in it and we increment it to get the next note of the track pop si inc si ;Interrupt to make the system wait for a certain amount of time, here less than a second mov cx, 8h ;high byte -> 1h = 1h x FFFFh microseconds mov ah, 86h int 15h jmp watchMePlay ;We get back to the start to play the next note ;Training mode, where the user must press the right key highlighted on the screen trainingMode: CMP [si], 0 ;We compare the current note (key code actually) of the track to zero which is marking the end of the track je rebootTheSystem ;We hit the zero, thus the track is over, so we reboot the system to quit the watch me play mode CMP [si], 01h je skipThisNote ;The 01h stands here for a pause, as a track can have pauses between some notes, so we skip that one mov ah, [si] ;We load the value of the current key code in ah at the address store in si, the one of the current key code in our array mov bh, ah ;We store ah in bh to keep the value of the key that the computer expect to be pressed push si ;si is going to be altered, so we put it in the stack to keep the right value ;We try to get the frequency corresponding to the current key code CALL defineSound push bx ;We need to keep the right value of bh, so we store bx in the stack (as we can't store 8-bits but only 16-bits values in the stack) mov bl, 1000b ;We define the color of the key to be highlighted, here it's grey CALL redrawKey ;We highlight our key by redrawing it on the screen ;The key to be pressed is now shown, so we ask the user to give it a try mov ah, 00h int 16h CMP ah, 01h je rebootTheSystem ;Escape, the user want to reboot and quit the training mode, thus we do so pop bx ;We get back the right value of bx, and subsenquently bh pop si ;We get back the right value of si CMP bh, ah ;ah now contains the key pressed by the user, so we compare it to bh to see if it's the expected one jne trainingMode ;If it's not the right one, we go on for another tour, waiting for the user to press the right key ;We push the value of si to the stack again, as it's going to be altered push si ;We get the right frequency in ax, from bp where it has been stored temporarily in the defineSound procedure mov ax, bp ;If we get here, it means that the right key has been pressed, so we play the sound CALL playSound ;We get back the correct value of si pop si skipThisNote: inc si ;And we increment it to get the next key jmp trainingMode ;We jump back at the start to ask the user, to do the same process for the next key ;Procedure that take care of playing the sound according to the frequency stored in ax, and also redraw the corresponding key playSound Proc CMP ax, 0 je skip ;If ax equals to 0 it means that the key pressed is not mapped, so we don't play anything and go right to the end of the procedure ;We set the color to brown and redraw the corresponding key with that color mov bl, 0110b CALL redrawKey ;We set the speaker and ask it to play our frequency mov al, 182 ; Prepare the speaker for the out 43h, al ; note out 42h, al ; Output the low byte of our frequency mov al, ah ; Output the high byte of our frequency out 42h, al in al, 61h ; Turn on note (get value from ; port 61h) or al, 00000011b ; Set bits 1 and 0 out 61h, al ; Send new value ;We wait for a short amount of time, to let the sound play a little mov cx, 2h mov ah, 86h int 15h ;And we turn off the sound in al, 61h ; Turn off note (get value from ; port 61h). and al, 11111100b ; Reset bits 1 and 0. out 61h, al ; Send new value ;As the sound has been turn off, we're going to redraw the key to its original state CMP isABlackKey, 1 jne whiteColor ;It's not a black key so we're going to color it in white ;It's a black key, so we color it in black mov bl, 0000h jmp makeTheChange whiteColor: mov bl, 1111b ;And we redraw the key with the previously passed color makeTheChange: CALL redrawKey mov bp, 0 skip: RET playSound ENDP ;This procedure define the sound to play, according to the key pressed defineSound PROC ;Check which key has been pressed CMP ah, 1Eh ;Q je playDo ;It's a do CMP ah, 11h ;Z je playDo2 ;It's a do# (1st black key) CMP ah, 1Fh ;S je playRe ;It's a re CMP ah, 12h ;E je playRe2 ;It's a re# (2nd black key) CMP ah, 20h ;D je playMi ;It's a mi CMP ah, 21h ;F je playFa ;It's a fa CMP ah, 14h ;T je playFa2 ;It's fa# (3rd black key) CMP ah, 22h ;G je playSol ;It's sol CMP ah, 15h ;Y je playSol2 ;It's sol# (4th black key) CMP ah, 23h ;H je playLa ;It's a la CMP ah, 16h ;U je playLa2 ;It's a la# (5th black key) CMP ah, 24h ;J je playSi ;It's a si mov ax, 0 jmp stop ;The key pressed is not supported, so we're going to notify it with 0 in ax ;All of those assign the correct frequency and key graphical dimensions and coordinates, according to the one pressed playDo: mov ax, 4560 ; Frequency number (in decimal) mov bp, ax ;We often change the value of ah, so we're going to need a second register with the value of our frequency mov rightSemiKeyStartAt, 12 ;The right part of the key under a black key start at the column 12 mov leftSemiKeyEndAt, 0 ;There is no part under a black key on the left, so 0 mov keyEndAt, 15 ;The key end at the column 15 mov keyStartAt, 0 ;The key start at the column 0 mov isABlackKey, 0 ;It's a white key, so 0 jmp stop ;We're done here, so we move along to the end of procedure playDo2: mov ax, 4304 mov bp, ax mov keyEndAt, 18 ;The key end at the column 18 mov keyStartAt, 12 ;The key start at the column 12 mov isABlackKey, 1 ;It's a black key, so 1, and therefore we don't need to set the other variables jmp stop playRe: mov ax, 4063 mov bp, ax mov rightSemiKeyStartAt, 28 ;The right part of the key under a black key start at the column 28 mov leftSemiKeyEndAt, 17 ;The left part of the key under a black key end at the column 17 mov keyEndAt, 31 ;The key end at the column 31 mov keyStartAt, 16 ;The key start at the column 16 mov isABlackKey, 0 ;It's a white key, so 0 jmp stop ;And same logic for the rest of the keys... playRe2: mov ax, 3834 mov bp, ax mov keyEndAt, 34 mov keyStartAt, 28 mov isABlackKey, 1 jmp stop playMi: mov ax, 3619 mov bp, ax mov rightSemiKeyStartAt, 48 mov leftSemiKeyEndAt, 33 mov keyEndAt, 47 mov keyStartAt, 32 mov isABlackKey, 0 jmp stop playFa: mov ax, 3416 mov bp, ax mov rightSemiKeyStartAt, 60 mov leftSemiKeyEndAt, 0 mov keyEndAt, 63 mov keyStartAt, 48 mov isABlackKey, 0 jmp stop playFa2: mov ax, 3224 mov bp, ax mov keyEndAt, 66 mov keyStartAt, 60 mov isABlackKey, 1 jmp stop playSol: mov ax, 3043 mov bp, ax mov rightSemiKeyStartAt, 76 mov leftSemiKeyEndAt, 65 mov keyEndAt, 79 mov keyStartAt, 64 mov isABlackKey, 0 jmp stop playSol2: mov ax, 2873 mov bp, ax mov keyEndAt, 82 mov keyStartAt, 76 mov isABlackKey, 1 jmp stop playLa: mov ax, 2711 mov bp, ax mov rightSemiKeyStartAt, 92 mov leftSemiKeyEndAt, 81 mov keyEndAt, 95 mov keyStartAt, 80 mov isABlackKey, 0 jmp stop playLa2: mov ax, 2559 mov bp, ax mov keyEndAt, 98 mov keyStartAt, 92 mov isABlackKey, 1 jmp stop playSi: mov ax, 2415 mov bp, ax mov rightSemiKeyStartAt, 112 mov leftSemiKeyEndAt, 97 mov keyEndAt, 111 mov keyStartAt, 96 mov isABlackKey, 0 stop: RET defineSound ENDP ;This procedure take care of drawing the whole piano drawPiano PROC mov di, 12 ;di determine the number of column we have to draw, until we reach the end of the key mov si, 0 ;Point the starting column ;This part take care of drawing the white keys drawWhiteColumn: mov ah, 0Ch ;This is for the interrupt, that will draw the pixel on the screen mov cx, 100 ;The number of time to loop, therefore the number of lines mov bx, 0 ;Counter that will help us keep track of the current line boucle1: push cx ;We push the value of cx to the stack, as we want to keep the integrity of the loop counter store in cx mov al, 1111b ;White color mov cx, 0 mov cx, si ;si store the current column, so we put it in cx that indicate the column of the pixel mov dx, bx ;bx store the current line, so we put it in dx that indicate the line of the pixel add bx, 1 ;We increment bx int 10h ;We draw the pixel on the screen pop cx ;We get back the right value of cx, to get back the integrity of our loop counter loop boucle1 ;And we loop if cx is greater than 0 add si, 1 ;We've taken care of our column, so increment si CMP si, di ;We compare si and di to know if we're done with our key jl drawWhiteColumn ;We're not done yet, so move on to the next column ;Are we between Mi and Fa keys ? CMP di, 47 jne add6 ;No, so we add 6 to di, as usual, for our next black key ;Yes, so we need to notify that we're going to draw another white key add si, 1 ;We add one to si in order to make a gap between the Mi and Fa keys add di,13 ;We add 13 to di, as the Fa key is 13 pixels large jmp drawWhiteColumn ;We jump back to drawing a white key, our Fa key ;Add 6 to di, in order to draw a 6 pixels large black key add6: add di, 6 CMP di, 111 jge stop2 ;We reached the end of our piano, so we end the procedure ;This part take care of drawing the black key and the part of the white key under them drawBlackAndWhiteColumn: mov ah, 0Ch ;This is for the interrupt, that will draw the pixel on the screen mov cx, 100 ;The number of time to loop, therefore the number of lines mov bx, 0 ;Counter that will help us keep track of the current line boucle4: CMP bx, 80 ;We compare bx to 80, which is the number of lines to "paint in black" jle addOneToBl ;It's lower or equal to 80 jmp whitePixels ;It's greater than 80, so we draw the rest of the previous or next white key ;We add one to bx and skip the iteration to keep the pixel black, as it's the black key addOneToBl: add bx, 1 jmp skipIteration ;We set the color to white whitePixels: mov al, 1111b ;White drawIt: push cx ;We push the value of cx to the stack, as we want to keep the integrity of the loop counter store in cx mov cx, 0 mov cx, si ;si store the current column, so we put it in cx that indicate the column of the pixel mov dx, bx ;bx store the current line, so we put it in dx that indicate the line of the pixel add bx, 1 ;We increment bx int 10h ;We draw the pixel on the screen pop cx ;We get back the right value of cx, to get back the integrity of our loop counter skipIteration: loop boucle4 ;Those comparisons are here to let us draw the gap between the white keys CMP si, 14 je addTwo ;We're between Do and Re CMP si, 30 je addTwo ;We're between Re and Mi CMP si, 62 je addTwo ;We're between Fa and Sol CMP si, 78 je addTwo ;We're between Sol and La CMP si, 94 je addTwo ;We're between La and Si ;No gap so we just add one to si add si, 1 jmp skipAddTwo ;We add 2 to si, in order to make the gap between the two keys addTwo: add si, 2 skipAddTwo: CMP si, di ;We compare si and di to know if we're done with our key jl drawBlackAndWhiteColumn ;We're not done yet, so we move on to the next column ;In order to have all the keys with the same size, we need to draw ;the "raw key" (the white key excluding the parts under the black keys) of Si and Mi a bit larger CMP di, 98 je add13 ;We want to draw the "raw key" of Si to be 13 pixels large CMP di, 34 je add13 ;We want to draw the "raw key" of Mi to be 13 pixels large jmp addJust10 ;For the other keys, the "raw key" just need to be 10 pixels large add13: add di, 13 jmp drawWhiteColumn addJust10: add di, 10 CMP di, 111 jle drawWhiteColumn ;We make sure we didn't reach the end of the piano before continuing stop2: RET drawPiano ENDP ;This procedure redraw the key to highlight it when the user press it or to show which key to press in watch me play mode redrawKey PROC CMP isABlackKey, 1 ;We check if we want to redraw a black key je redrawBlackKey ;It's a black key, so we jump to the proper part to handle that ;This part redraw a whole white key redrawWhiteKey: mov si, keyStartAt ;We indicate to si where to start mov dx, 0 ;We always start at the line 0 mov al, bl ;We pass to al the color, in which to draw the key, that has been stored to bl drawColumnWhiteKey: mov ah, 0Ch mov cx, 100 mov bx, 0 boucleWhiteKey: CMP si, rightSemiKeyStartAt jge semiWhiteKey ;We are in the right part of the key where it's under a black key CMP leftSemiKeyEndAt, 0 je colorTheWhiteKey ;As we can't compare it with si when it's equal to zero for the first key, ;we do a special comparison for it CMP si, leftSemiKeyEndAt jle semiWhiteKey ;We are in the left part of the key where it's under a black key jmp colorTheWhiteKey ;We're not under any black key, so we go on drawing our white key normally semiWhiteKey: CMP bx, 80 jle addOneToBl2 ;If we're here it means that we are under a black key, so if we're currently in the black key, ;we need to do something special jmp colorTheWhiteKey ;We're in the white key, so we carry on drawing our white key ;We're in our black key, so we're got nothing to redraw, thus we add one to bx and skip that iteration addOneToBl2: add bx, 1 jmp skipIteration2 colorTheWhiteKey: ;We already detailed that process several times above push cx mov cx, 0 mov cx, si mov dx, bx add bx, 1 int 10h pop cx skipIteration2: loop boucleWhiteKey add si, 1 CMP si, keyEndAt ;We compare si to the end of the key jl drawColumnWhiteKey ;We're not done with our key, so we move on to the next column jmp stopit ;This part redraw a black key redrawBlackKey: mov si, keyStartAt ;We indicate to si where to start mov dx, 0 ;We always start at the line 0 mov al, bl ;We pass to al the color in which to draw the key that has been stored to bl drawColumnBlackKey: mov ah, 0Ch mov cx, 81 ;The counter is equal to 81 here, as we're redrawing only the black key, and not the part of the white keys below mov bx, 0 boucleBlackKey: ;We already detailed that process several times above push cx mov cx, 0 mov cx, si mov dx, bx add bx, 1 int 10h pop cx loop boucleBlackKey add si, 1 CMP si, keyEndAt ;We compare si to the end of the key jl drawColumnBlackKey ;We're not done with our key, so we move on to the next column stopit: mov ax, bp ;We changed the value of ax by using al and ah, so we restore it by getting it back from bp ;where it has been stored temporarily RET redrawKey ENDP ;This procedure print the message whose address has been passed into si printString PROC ;We're going to edit ax and si, so we add their values to the stack push ax push si nextChar: mov al, [si] ;si represent the address of the current character to print, so we put its value in al CMP al, 0 ;0 indicate the end of our string, so we check if we have reached its end or not je printed ;We reach the end of the string, so we quit the procedure inc si ;We increment si as we already moved the value of our character to al mov ah, 0eh ;For our interrupt which is going to print our character int 10h ;We print the character store in al jmp nextChar ;And we jump to the next character printed: ;We get the original value of si and ax from the stack pop si pop ax RET printString ENDP ;Procedure that clear the window the easy way by redefining the video text mode clearWindow PROC mov ah, 00h mov al, 03h int 10h RET clearWindow ENDP ;This procedure load the right track according to the choice of the user loadTheMusic PROC CMP ah, 02h je loadTrack1 ;First track chosen CMP ah, 03h je loadTrack2 ;Second track chosen CMP ah, 04h je loadTrack3 ;Third track chosen jmp done ;We should never hit that line, but if we do, we don't load anything loadTrack1: lea si, track1 ;We load the address of 'Au clair de la lune' in si jmp done loadTrack2: lea si, track2 ;We load the address of 'Do, re, mi, fa, sol, la, si...' in si jmp done loadTrack3: lea si, track3 ;We load the address of 'Jingle bells' in si done: RET loadTheMusic ENDP ;This procedure take care of setting the piano getThePianoReady PROC ;We're going to edit ax and si, so we add their values to the stack push ax push si ;We set the graphical video mode mov ah, 00h mov al, 13h int 10h ;We call the procedure to draw our piano CALL drawPiano ;We get the original value of si and ax from the stack pop si pop ax RET getThePianoReady ENDP ret ;Variables that store the beginning and end of each key to redraw when pressed keyStartAt dw 0 ;Store the beginning column of a key keyEndAt dw 0 ;Store the end column of a key leftSemiKeyEndAt dw 0 ;Store the end column of the left part of a white key under a black key rightSemiKeyStartAt dw 0 ;Store the beginning column of the right part of a white key under a black key isABlackKey db 0 ;Store if a key is a black key or not ;Store the welcome message with all the option at the launch of our program msg db "Welcome to Piano ASM",0Dh,0Ah db "What do you want to do ?",0Dh,0Ah db "1 - Free to play",0Dh,0Ah db "2 - Watch me play",0Dh,0Ah db "3 - Training mode",0Dh,0Ah db "4 - Help",0Dh,0Ah db "> ",0Dh,0Ah, 0 ;Store a message to indicate the user that he has to enter one of the correct input suggested tryAgainMsg db "Please enter one of the choices below",0Dh,0Ah db " ", 0Dh,0Ah, 0 ;Store the message for the menu of the watch me play mode watchMePlaySubMenuMsg db "Which music do you want the computer to play ?",0Dh,0Ah db "1 - Au clair de la lune",0Dh,0Ah db "2 - Do, re, mi, fa, sol, la, si...",0Dh,0Ah db "3 - Jingle bells",0Dh,0Ah db "> ",0Dh,0Ah, 0 ;Store the message for the menu of the training mode trainingSubMenuMsg db "Which music do you want to train on ?",0Dh,0Ah db "1 - Au clair de la lune",0Dh,0Ah db "2 - Do, re, mi, fa, sol, la, si...",0Dh,0Ah db "3 - Jingle bells",0Dh,0Ah db "> ",0Dh,0Ah, 0 ;Store the message for the help page helpMsg db "Q: How the piano works?",0Dh,0Ah db "A: The keys are mapped with the following pattern (on an AZERTY keyboard):",0Dh,0Ah db " ___________________________",0Dh,0Ah db " | | | | | | | | | | | | | ",0Dh,0Ah db " | | | | | | | | | | | | |",0Dh,0Ah db " | |Z| |E| | |T| |Y| |U| | ",0Dh,0Ah db " | |_| |_| | |_| |_| |_| | ",0Dh,0Ah db " | | | | | | | | ",0Dh,0Ah db " | Q | S | D | F | G | H | J | ",0Dh,0Ah db " |___|___|___|___|___|___|___| ",0Dh,0Ah db "",0Dh,0Ah db "Q: What are the frequencies used?",0Dh,0Ah db "A: The piano starts with the Middle C and displays one octave: ",0Dh,0Ah db " C4 to B4 including the '#' ones.",0Dh,0Ah db "",0Dh,0Ah db "Q: How to come back to the menu?",0Dh,0Ah db "A: Just press 'ESC'.",0Dh,0Ah, 0 ;Au clair de la lune (01h stands for a pause as it's not mapped to any frequency) track1 db 1Eh, 1Eh, 1Eh, 1Fh, 20h, 01h, 1Fh, 01h, 1Eh, 20h, 1Fh, 1Fh, 1Eh, 01h, 01h db 1Fh, 1Fh, 1Fh, 1Fh, 23h, 01h, 23h, 01h, 1Fh, 1Eh, 24h, 23h, 22h, 01h, 01h db 1Eh, 1Eh, 1Eh, 1Fh, 20h, 01h, 1Fh, 01h, 1Eh, 20h, 1Fh, 1Fh, 1Eh, 0 ;Do, re, mi, fa, sol, la, si... track2 db 1Eh, 1Fh, 20h, 21h, 22h, 23h, 24h db 16h, 15h, 14h, 12h, 11h, 0 ;<NAME> track3 db 20h, 20h, 20h, 01h, 20h, 20h, 20h, 01h, 20h, 22h, 1Eh, 1Fh db 20h, 01h, 01h, 21h, 21h, 21h, 01h, 21h, 21h, 01h, 20h, 20h, 20h, 20h db 20h, 1Fh, 1Fh, 20h, 1Fh, 01h, 22h, 01h, 20h, 20h, 20h, 01h, 20h, 20h, 20h, 01h db 20h, 22h, 1Eh, 01h, 1Fh, 20h, 01h, 01h, 21h, 21h, 21h, 21h, 01h db 21h, 01h, 20h, 20h, 01h, 20h, 20h, 01h, 22h, 22h, 01h, 21h, 1Fh, 1Eh, 0
firmware/coreboot/3rdparty/libhwbase/common/hw-pci.ads
fabiojna02/OpenCellular
1
26101
<filename>firmware/coreboot/3rdparty/libhwbase/common/hw-pci.ads -- -- Copyright (C) 2017 <NAME> <<EMAIL>> -- -- This program is free software; you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation; either version 2 of the License, or -- (at your option) any later version. -- -- This program is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- package HW.PCI is type Bus is range 0 .. 255; type Slot is range 0 .. 31; type Func is range 0 .. 7; type Address is record Bus : PCI.Bus; Slot : PCI.Slot; Func : PCI.Func; end record; type Index is range 0 .. 4095; Vendor_Id : constant Index := 16#00#; Device_Id : constant Index := 16#02#; Command : constant Index := 16#04#; Command_Memory : constant := 16#02#; Header_Type : constant Index := 16#0e#; Header_Type_Mask : constant := 16#7f#; Header_Type_Normal : constant := 16#00#; type Resource is (Res0, Res1, Res2, Res3, Res4, Res5); Base_Address : constant array (Resource) of Index := (16#10#, 16#14#, 16#18#, 16#1c#, 16#20#, 16#24#); Base_Address_Space_Mask : constant := 1 * 2 ** 0; Base_Address_Space_IO : constant := 1 * 2 ** 0; Base_Address_Space_Mem : constant := 0 * 2 ** 0; Base_Address_Mem_Type_Mask : constant := 3 * 2 ** 1; Base_Address_Mem_Type_32 : constant := 0 * 2 ** 1; Base_Address_Mem_Type_1M : constant := 1 * 2 ** 1; Base_Address_Mem_Type_64 : constant := 2 * 2 ** 1; Base_Address_Mem_Prefetch : constant := 1 * 2 ** 3; Base_Address_IO_Mask : constant := 16#ffff_fffc#; Base_Address_Mem_Mask : constant := 16#ffff_fff0#; private use type HW.Word64; function Calc_Base_Address (Base_Addr : Word64; Dev : Address) return Word64 is (Base_Addr + Word64 (Dev.Bus) * 32 * 8 * 4096 + Word64 (Dev.Slot) * 8 * 4096 + Word64 (Dev.Func) * 4096); end HW.PCI;
gcc-gcc-7_3_0-release/gcc/testsuite/ada/acats/tests/ce/ce3908a.ada
best08618/asylo
7
22821
<reponame>best08618/asylo -- CE3908A.ADA -- Grant of Unlimited Rights -- -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained -- unlimited rights in the software and documentation contained herein. -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making -- this public release, the Government intends to confer upon all -- recipients unlimited rights equal to those held by the Government. -- These rights include rights to use, duplicate, release or disclose the -- released technical data and computer software in whole or in part, in -- any manner and for any purpose whatsoever, and to have or permit others -- to do so. -- -- DISCLAIMER -- -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A -- PARTICULAR PURPOSE OF SAID MATERIAL. --* -- OBJECTIVE: -- CHECK THAT GET FOR ENUMERATION TYPES CAN OPERATE ON STRINGS. -- CHECK THAT IT RAISES END_ERROR WHEN THE STRING IS NULL OR -- EMPTY. CHECK THAT LAST CONTAINS THE INDEX VALUE OF THE LAST -- CHARACTER READ FROM THE STRING. -- HISTORY: -- SPS 10/11/82 -- VKG 01/06/83 -- JBG 02/22/84 CHANGED TO .ADA TEST -- DWC 09/18/87 ADDED CASES WHICH CONTAIN TABS WITH AND WITHOUT -- ENUMERATION LITERALS. WITH REPORT; USE REPORT; WITH TEXT_IO; USE TEXT_IO; PROCEDURE CE3908A IS BEGIN TEST ("CE3908A", "CHECK THAT GET FOR ENUMERATION TYPES CAN " & "OPERATE ON STRINGS. CHECK THAT IT RAISES " & "END_ERROR WHEN THE STRING IS NULL OR EMPTY. " & "CHECK THAT LAST CONTAINS THE INDEX VALUE OF " & "THE LAST CHARACTER READ FROM THE STRING"); DECLARE TYPE FRUIT IS (APPLE, PEAR, ORANGE, STRAWBERRY); DESSERT : FRUIT; PACKAGE FRUIT_IO IS NEW ENUMERATION_IO (FRUIT); USE FRUIT_IO; L : POSITIVE; BEGIN GET ("APPLE ", DESSERT, L); IF DESSERT /= APPLE THEN FAILED ("ENUMERATION VALUE FROM STRING INCORRECT - 1"); END IF; IF L /= IDENT_INT (5) THEN FAILED ("LAST CONTAINS INCORRECT VALUE AFTER GET - 1"); END IF; GET ("APPLE", DESSERT, L); IF DESSERT /= APPLE THEN FAILED ("ENUMERATION VALUE FROM STRING INCORRECT - 2"); END IF; IF L /= IDENT_INT (5) THEN FAILED ("LAST CONTAINS INCORRECT VALUE AFTER GET - 2"); END IF; BEGIN GET (ASCII.HT & "APPLE", DESSERT, L); IF DESSERT /= APPLE THEN FAILED ("ENUMERATION VALUE FROM STRING " & "INCORRECT - 3"); END IF; IF L /= IDENT_INT(6) THEN FAILED ("LAST CONTAINS INCORRECT VALUE AFTER " & "GET - 3"); END IF; EXCEPTION WHEN END_ERROR => FAILED ("GET DID NOT SKIP LEADING TABS"); WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - 3"); END; -- NULL STRING LITERAL. BEGIN GET ("", DESSERT, L); FAILED ("END_ERROR NOT RAISED - 4"); EXCEPTION WHEN END_ERROR => IF L /= IDENT_INT(6) THEN FAILED ("LAST CONTAINS INCORRECT VALUE " & "AFTER GET - 4"); END IF; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - 4"); END; BEGIN GET (ASCII.HT & "", DESSERT, L); FAILED ("END_ERROR NOT RAISED - 5"); EXCEPTION WHEN END_ERROR => IF L /= IDENT_INT(6) THEN FAILED ("LAST CONTAINS INCORRECT VALUE " & "AFTER GET - 5"); END IF; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - 5"); END; -- STRING LITERAL WITH BLANKS. BEGIN GET(" ", DESSERT, L); FAILED ("END ERROR NOT RAISED - 6"); EXCEPTION WHEN END_ERROR => IF L /= IDENT_INT(6) THEN FAILED ("LAST CONTAINS INCORRECT VALUE " & "AFTER GET - 6"); END IF; WHEN OTHERS => FAILED ("WRONG EXCEPTION RAISED - 6"); END; END; RESULT; END CE3908A;
oeis/331/A331419.asm
neoneye/loda-programs
11
178643
<reponame>neoneye/loda-programs ; A331419: a(n) is the number of subsets of {1..n} that contain 4 odd numbers. ; Submitted by <NAME> ; 0,0,0,0,0,0,8,16,80,160,480,960,2240,4480,8960,17920,32256,64512,107520,215040,337920,675840,1013760,2027520,2928640,5857280,8200192,16400384,22364160,44728320,59637760,119275520,155975680,311951360,401080320,802160640,1016070144,2032140288,2540175360,5080350720,6275727360,12551454720,15340666880,30681333760,37140561920,74281123840,89137348608,178274697216,212231782400,424463564800,501638758400,1003277516800,1177760563200,2355521126400,2748107980800,5496215961600,6375610515456,12751221030912 mov $1,$0 add $0,2 div $0,2 bin $0,4 lpb $1 mul $0,2 sub $1,1 trn $1,1 lpe
programs/oeis/146/A146076.asm
neoneye/loda
22
175596
<reponame>neoneye/loda<filename>programs/oeis/146/A146076.asm<gh_stars>10-100 ; A146076: Sum of even divisors of n. ; 0,2,0,6,0,8,0,14,0,12,0,24,0,16,0,30,0,26,0,36,0,24,0,56,0,28,0,48,0,48,0,62,0,36,0,78,0,40,0,84,0,64,0,72,0,48,0,120,0,62,0,84,0,80,0,112,0,60,0,144,0,64,0,126,0,96,0,108,0,96,0,182,0,76,0,120,0,112,0,180,0,84,0,192,0,88,0,168,0,156,0,144,0,96,0,248,0,114,0,186 lpb $0 div $0,2 mov $1,$0 mul $0,2 seq $1,203 ; a(n) = sigma(n), the sum of the divisors of n. Also called sigma_1(n). lpe mul $1,2 mov $0,$1
source/league/league-character_sets.adb
svn2github/matreshka
24
25362
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Localization, Internationalization, Globalization for Ada -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011, <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 Matreshka.Internals.Unicode; package body League.Character_Sets is use Matreshka.Internals.Code_Point_Sets; function Wrap (Self : Shared_Code_Point_Set_Access) return Universal_Character_Set; --------- -- "-" -- --------- function "-" (Left, Right : Universal_Character_Set) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(Left.Data.all - Right.Data.all)); end "-"; --------- -- "=" -- --------- function "=" (Left, Right : Universal_Character_Set) return Boolean is begin return Left.Data.all = Right.Data.all; end "="; ----------- -- "and" -- ----------- function "and" (Left, Right : Universal_Character_Set) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(Left.Data.all and Right.Data.all)); end "and"; ----------- -- "not" -- ----------- function "not" (Right : Universal_Character_Set) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(not Right.Data.all)); end "not"; ---------- -- "or" -- ---------- function "or" (Left, Right : Universal_Character_Set) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(Left.Data.all or Right.Data.all)); end "or"; ----------- -- "xor" -- ----------- function "xor" (Left, Right : Universal_Character_Set) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(Left.Data.all xor Right.Data.all)); end "xor"; ------------ -- Adjust -- ------------ overriding procedure Adjust (Self : in out Universal_Character_Set) is begin Reference (Self.Data); end Adjust; -------------- -- Finalize -- -------------- overriding procedure Finalize (Self : in out Universal_Character_Set) is begin -- Finalize can be called more than once (as specified by language -- standard), thus implementation should provide protection from -- multiple finalization. if Self.Data /= null then Dereference (Self.Data); end if; end Finalize; --------- -- Has -- --------- function Has (Set : Universal_Character_Set; Element : Wide_Wide_Character) return Boolean is begin return Has (Set, League.Characters.To_Universal_Character (Element)); end Has; --------- -- Has -- --------- function Has (Set : Universal_Character_Set; Element : League.Characters.Universal_Character) return Boolean is begin return Has (Set.Data.all, Element); end Has; -------------- -- Is_Empty -- -------------- function Is_Empty (Set : Universal_Character_Set) return Boolean is begin return Is_Empty (Set.Data.all); end Is_Empty; --------------- -- Is_Subset -- --------------- function Is_Subset (Elements : Universal_Character_Set; Set : Universal_Character_Set) return Boolean is begin return Is_Subset (Elements.Data.all, Set.Data.all); end Is_Subset; ---------- -- Read -- ---------- procedure Read (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : out Universal_Character_Set) is Last : Second_Stage_Array_Index; begin Second_Stage_Array_Index'Read (Stream, Last); Dereference (Item.Data); Item.Data := new Shared_Code_Point_Set (Last); First_Stage_Map'Read (Stream, Item.Data.First_Stage); Second_Stage_Array'Read (Stream, Item.Data.Second_Stages); end Read; ------------ -- To_Set -- ------------ function To_Set (Sequence : Wide_Wide_String) return Universal_Character_Set is begin return Wrap (new Shared_Code_Point_Set'(To_Set (Sequence))); end To_Set; ------------ -- To_Set -- ------------ function To_Set (Sequence : League.Strings.Universal_String) return Universal_Character_Set is begin return To_Set (League.Strings.To_Wide_Wide_String (Sequence)); end To_Set; ------------ -- To_Set -- ------------ function To_Set (Low, High : Wide_Wide_Character) return Universal_Character_Set is use Matreshka.Internals.Unicode; Lo : constant Code_Unit_32 := Code_Point'Min (Code_Point'Last, Wide_Wide_Character'Pos (Low)); Hi : constant Code_Unit_32 := Code_Point'Min (Code_Point'Last, Wide_Wide_Character'Pos (High)); begin return Wrap (new Shared_Code_Point_Set'(To_Set (Lo, Hi))); end To_Set; ---------- -- Wrap -- ---------- function Wrap (Self : Shared_Code_Point_Set_Access) return Universal_Character_Set is begin return Universal_Character_Set' (Ada.Finalization.Controlled with Data => Self); end Wrap; ----------- -- Write -- ----------- procedure Write (Stream : not null access Ada.Streams.Root_Stream_Type'Class; Item : Universal_Character_Set) is begin Second_Stage_Array_Index'Write (Stream, Item.Data.Last); First_Stage_Map'Write (Stream, Item.Data.First_Stage); Second_Stage_Array'Write (Stream, Item.Data.Second_Stages); end Write; end League.Character_Sets;
test/Succeed/UncurryMeta.agda
redfish64/autonomic-agda
3
1265
<filename>test/Succeed/UncurryMeta.agda -- It would be nice if this worked. The constraint we can't solve is -- P x y = ? (x, y) -- Solution: extend the notion of Miller patterns to include record -- constructions. -- -- Andreas, 2012-02-27 works now! (see issues 376 and 456) module UncurryMeta where data Unit : Set where unit : Unit record R : Set where field x : Unit y : Unit _,_ : Unit -> Unit -> R x , y = record {x = x; y = y} data P : Unit -> Unit -> Set where mkP : forall x y -> P x y data D : (R -> Set) -> Set1 where d : {F : R -> Set} -> (forall x y -> F (x , y)) -> D F unD : {F : R -> Set} -> D F -> Unit unD (d _) = unit test : Unit test = unD (d mkP)
Cubical/Homotopy/Group/S3.agda
lpw25/cubical
0
8805
<reponame>lpw25/cubical<filename>Cubical/Homotopy/Group/S3.agda {-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.Homotopy.Group.S3 where {- This file contains a summary of what remains for π₄S³≅ℤ/2 to be proved. See the module π₄S³ at the end of this file. -} open import Cubical.Foundations.Prelude open import Cubical.Foundations.Pointed open import Cubical.Foundations.Equiv open import Cubical.Foundations.Function open import Cubical.Data.Nat open import Cubical.Data.Sum open import Cubical.Data.Sigma open import Cubical.Data.Int renaming (_·_ to _·ℤ_ ; _+_ to _+ℤ_) open import Cubical.Homotopy.Group.Base open import Cubical.Homotopy.HopfInvariant.Base open import Cubical.Homotopy.HopfInvariant.Homomorphism open import Cubical.Homotopy.HopfInvariant.HopfMap open import Cubical.Homotopy.Whitehead open import Cubical.Algebra.Group.Instances.IntMod open import Cubical.Foundations.Isomorphism open import Cubical.HITs.Sn open import Cubical.HITs.SetTruncation open import Cubical.Algebra.Group renaming (ℤ to ℤGroup ; Bool to BoolGroup ; Unit to UnitGroup) open import Cubical.Algebra.Group.ZAction [_]× : ∀ {ℓ} {X : Pointed ℓ} {n m : ℕ} → π' (suc n) X × π' (suc m) X → π' (suc (n + m)) X [_]× (f , g) = [ f ∣ g ]π' -- Some type abbreviations (unproved results) π₃S²-gen : Type π₃S²-gen = gen₁-by (π'Gr 2 (S₊∙ 2)) ∣ HopfMap ∣₂ π₄S³≅ℤ/something : GroupEquiv ℤGroup (π'Gr 2 (S₊∙ 2)) → Type π₄S³≅ℤ/something eq = GroupIso (π'Gr 3 (S₊∙ 3)) (ℤ/ abs (invEq (fst eq) [ ∣ idfun∙ _ ∣₂ , ∣ idfun∙ _ ∣₂ ]×)) miniLem₁ : Type miniLem₁ = (g : ℤ) → gen₁-by ℤGroup g → (g ≡ 1) ⊎ (g ≡ -1) miniLem₂ : Type miniLem₂ = (ϕ : GroupEquiv ℤGroup ℤGroup) (g : ℤ) → (abs g ≡ abs (fst (fst ϕ) g)) -- some minor group lemmas groupLem-help : miniLem₁ → (g : ℤ) → gen₁-by ℤGroup g → (ϕ : GroupHom ℤGroup ℤGroup) → (fst ϕ g ≡ pos 1) ⊎ (fst ϕ g ≡ negsuc 0) → isEquiv (fst ϕ) groupLem-help grlem1 g gen ϕ = main (grlem1 g gen) where isEquiv- : isEquiv (-_) isEquiv- = isoToIsEquiv (iso -_ -_ -Involutive -Involutive) lem : fst ϕ (pos 1) ≡ pos 1 → fst ϕ ≡ idfun _ lem p = funExt lem2 where lem₁ : (x₁ : ℕ) → fst ϕ (pos x₁) ≡ idfun ℤ (pos x₁) lem₁ zero = IsGroupHom.pres1 (snd ϕ) lem₁ (suc zero) = p lem₁ (suc (suc n)) = IsGroupHom.pres· (snd ϕ) (pos (suc n)) 1 ∙ cong₂ _+ℤ_ (lem₁ (suc n)) p lem2 : (x₁ : ℤ) → fst ϕ x₁ ≡ idfun ℤ x₁ lem2 (pos n) = lem₁ n lem2 (negsuc zero) = IsGroupHom.presinv (snd ϕ) 1 ∙ cong (λ x → pos 0 - x) p lem2 (negsuc (suc n)) = (cong (fst ϕ) (sym (+Comm (pos 0) (negsuc (suc n)))) ∙ IsGroupHom.presinv (snd ϕ) (pos (suc (suc n)))) ∙∙ +Comm (pos 0) _ ∙∙ cong (-_) (lem₁ (suc (suc n))) lem₂ : fst ϕ (negsuc 0) ≡ pos 1 → fst ϕ ≡ -_ lem₂ p = funExt lem2 where s = IsGroupHom.presinv (snd ϕ) (negsuc 0) ∙∙ +Comm (pos 0) _ ∙∙ cong -_ p lem2 : (n : ℤ) → fst ϕ n ≡ - n lem2 (pos zero) = IsGroupHom.pres1 (snd ϕ) lem2 (pos (suc zero)) = s lem2 (pos (suc (suc n))) = IsGroupHom.pres· (snd ϕ) (pos (suc n)) 1 ∙ cong₂ _+ℤ_ (lem2 (pos (suc n))) s lem2 (negsuc zero) = p lem2 (negsuc (suc n)) = IsGroupHom.pres· (snd ϕ) (negsuc n) (negsuc 0) ∙ cong₂ _+ℤ_ (lem2 (negsuc n)) p main : (g ≡ pos 1) ⊎ (g ≡ negsuc 0) → (fst ϕ g ≡ pos 1) ⊎ (fst ϕ g ≡ negsuc 0) → isEquiv (fst ϕ) main (inl p) = J (λ g p → (fst ϕ g ≡ pos 1) ⊎ (fst ϕ g ≡ negsuc 0) → isEquiv (fst ϕ)) (λ { (inl x) → subst isEquiv (sym (lem x)) (snd (idEquiv _)) ; (inr x) → subst isEquiv (sym (lem₂ (IsGroupHom.presinv (snd ϕ) (pos 1) ∙ (cong (λ x → pos 0 - x) x)))) isEquiv- }) (sym p) main (inr p) = J (λ g p → (fst ϕ g ≡ pos 1) ⊎ (fst ϕ g ≡ negsuc 0) → isEquiv (fst ϕ)) (λ { (inl x) → subst isEquiv (sym (lem₂ x)) isEquiv- ; (inr x) → subst isEquiv (sym (lem ( IsGroupHom.presinv (snd ϕ) (negsuc 0) ∙ cong (λ x → pos 0 - x) x))) (snd (idEquiv _))}) (sym p) groupLem : {G : Group₀} → miniLem₁ → GroupEquiv ℤGroup G → (g : fst G) → gen₁-by G g → (ϕ : GroupHom G ℤGroup) → (fst ϕ g ≡ 1) ⊎ (fst ϕ g ≡ -1) → isEquiv (fst ϕ) groupLem {G = G} s = GroupEquivJ (λ G _ → (g : fst G) → gen₁-by G g → (ϕ : GroupHom G ℤGroup) → (fst ϕ g ≡ 1) ⊎ (fst ϕ g ≡ -1) → isEquiv (fst ϕ)) (groupLem-help s) -- summary module π₄S³ (mini-lem₁ : miniLem₁) (mini-lem₂ : miniLem₂) (ℤ≅π₃S² : GroupEquiv ℤGroup (π'Gr 2 (S₊∙ 2))) (gen-by-HopfMap : π₃S²-gen) (π₄S³≅ℤ/whitehead : π₄S³≅ℤ/something ℤ≅π₃S²) (hopfWhitehead : abs (HopfInvariant-π' 0 ([ (∣ idfun∙ _ ∣₂ , ∣ idfun∙ _ ∣₂) ]×)) ≡ 2) where π₄S³ = π'Gr 3 (S₊∙ 3) hopfInvariantEquiv : GroupEquiv (π'Gr 2 (S₊∙ 2)) ℤGroup fst (fst hopfInvariantEquiv) = HopfInvariant-π' 0 snd (fst hopfInvariantEquiv) = groupLem mini-lem₁ ℤ≅π₃S² ∣ HopfMap ∣₂ gen-by-HopfMap (GroupHom-HopfInvariant-π' 0) (abs→⊎ _ _ HopfInvariant-HopfMap) snd hopfInvariantEquiv = snd (GroupHom-HopfInvariant-π' 0) lem : ∀ {G : Group₀} (ϕ ψ : GroupEquiv ℤGroup G) (g : fst G) → abs (invEq (fst ϕ) g) ≡ abs (invEq (fst ψ) g) lem = GroupEquivJ (λ G ϕ → (ψ : GroupEquiv ℤGroup G) (g : fst G) → abs (invEq (fst ϕ) g) ≡ abs (invEq (fst ψ) g)) λ ψ → mini-lem₂ (invGroupEquiv ψ) main : GroupIso π₄S³ (ℤ/ 2) main = subst (GroupIso π₄S³) (cong (ℤ/_) (lem ℤ≅π₃S² (invGroupEquiv (hopfInvariantEquiv)) _ ∙ hopfWhitehead)) π₄S³≅ℤ/whitehead
src/third_party/nasm/travis/test/br3028880.asm
Mr-Sheep/naiveproxy
2,219
172276
<reponame>Mr-Sheep/naiveproxy<filename>src/third_party/nasm/travis/test/br3028880.asm ;Testname=br3028880; Arguments=-Ox -fbin -obr3028880.o; Files=stdout stderr br3028880.o %macro import 1 %defstr %%incfile %!PROJECTBASEDIR/%{1}.inc %defstr %%decfile %!'PROJECTBASEDIR'/%{1}.dec db %%incfile, `\n` db %%decfile, `\n` %endmacro %ifenv PROJECTBASEDIR import foo %else %warning No PROJECTBASEDIR defined %endif %ifenv %!PROJECTBASEDIR import foo %else %warning No PROJECTBASEDIR defined %endif %ifenv 'PROJECTBASEDIR' import foo %else %warning No PROJECTBASEDIR defined %endif %ifenv %!'PROJECTBASEDIR' import foo %else %warning No PROJECTBASEDIR defined %endif
GO_OEP.tpl.asm
moldabekov/PyloadAdder
2
6191
<reponame>moldabekov/PyloadAdder use32 pushad pushfd push 0 push 0 push 0 push {{ offset_payload }} push 0 push 0 call dword [{{ imports["CreateThread"] }}] popfd popad push {{ go }} ret
libsrc/_DEVELOPMENT/arch/zx/display/z80/asm_zx_saddrcright.asm
UnivEngineer/z88dk
4
22855
<filename>libsrc/_DEVELOPMENT/arch/zx/display/z80/asm_zx_saddrcright.asm ; =============================================================== ; Jun 2007 ; =============================================================== ; ; void *zx_saddrcright(void *saddr) ; ; Modify screen address to move right one character (eight pixels) ; If at rightmost edge move to leftmost column on next pixel row. ; ; =============================================================== SECTION code_clib SECTION code_arch PUBLIC asm_zx_saddrcright asm_zx_saddrcright: ; enter : hl = screen address ; ; exit : hl = screen address moved to right one character ; carry set if new screen address is off screen ; ; uses : af, hl or a inc l ret nz ld a,$08 add a,h ld h,a and $18 add a,$e8 ret
programs/oeis/070/A070376.asm
neoneye/loda
22
15104
; A070376: a(n) = 5^n mod 26. ; 1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21,1,5,25,21 mov $1,1 mov $2,$0 lpb $2 mul $1,5 mod $1,52 sub $2,1 lpe mov $0,$1
font_zx.asm
jorgicor/altair
0
83878
<reponame>jorgicor/altair<gh_stars>0 ; ---------------------------------------------------------------------------- ; Altair, CIDLESA's 1981 arcade game remade for the ZX Spectrum and ; Amstrad CPC. ; ---------------------------------------------------------------------------- ; ---------------------------------------------------------------------------- ; Customized A - Z characters. ; ---------------------------------------------------------------------------- font_A .db %00000000 .db %00111100 .db %01100010 .db %01111110 .db %01100010 .db %01100010 .db %01100010 .db %00000000 font_B .db %00000000 .db %01111100 .db %01100010 .db %01111100 .db %01100010 .db %01100010 .db %01111100 .db %00000000 font_C .db %00000000 .db %00111100 .db %01100010 .db %01100000 .db %01100000 .db %01100010 .db %00111100 .db %00000000 font_D .db %00000000 .db %01111100 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %01111100 .db %00000000 font_E .db %00000000 .db %01111110 .db %01100000 .db %01111000 .db %01100000 .db %01100000 .db %01111110 .db %00000000 font_F .db %00000000 .db %01111110 .db %01100000 .db %01111000 .db %01100000 .db %01100000 .db %01100000 .db %00000000 font_G .db %00000000 .db %00111100 .db %01100010 .db %01100000 .db %01101110 .db %01100010 .db %00111100 .db %00000000 font_H .db %00000000 .db %01100010 .db %01100010 .db %01111110 .db %01100010 .db %01100010 .db %01100010 .db %00000000 font_I .db %00000000 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00000000 font_J .db %00000000 .db %00000100 .db %00000100 .db %00000100 .db %01100100 .db %01100100 .db %01111100 .db %00000000 font_K .db %00000000 .db %01100100 .db %01101000 .db %01110000 .db %01101000 .db %01100100 .db %01100010 .db %00000000 font_L .db %00000000 .db %01100000 .db %01100000 .db %01100000 .db %01100000 .db %01100000 .db %01111110 .db %00000000 font_M .db %00000000 .db %01100010 .db %01110110 .db %01101010 .db %01100010 .db %01100010 .db %01100010 .db %00000000 font_N .db %00000000 .db %01100010 .db %01100010 .db %01110010 .db %01101010 .db %01100110 .db %01100010 .db %00000000 font_O .db %00000000 .db %00111100 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %00111100 .db %00000000 font_P .db %00000000 .db %01111100 .db %01100010 .db %01100010 .db %01111100 .db %01100000 .db %01100000 .db %00000000 font_Q .db %00000000 .db %00111100 .db %01100010 .db %01100010 .db %01101010 .db %01100110 .db %00111100 .db %00000000 font_R .db %00000000 .db %01111100 .db %01100010 .db %01111100 .db %01101000 .db %01100100 .db %01100010 .db %00000000 font_S .db %00000000 .db %00111100 .db %01100000 .db %00111100 .db %00000110 .db %01000110 .db %00111100 .db %00000000 font_T .db %00000000 .db %01111110 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00000000 font_U .db %00000000 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %00111100 .db %00000000 font_V .db %00000000 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %00110100 .db %00011000 .db %00000000 font_W .db %00000000 .db %01100010 .db %01100010 .db %01100010 .db %01100010 .db %01101010 .db %00110100 .db %00000000 font_X .db %00000000 .db %01100010 .db %00110100 .db %00011000 .db %00011000 .db %00110100 .db %01100010 .db %00000000 font_Y .db %00000000 .db %01100010 .db %00110100 .db %00011000 .db %00011000 .db %00011000 .db %00011000 .db %00000000 font_Z .db %00000000 .db %01111110 .db %00001100 .db %00011000 .db %00110000 .db %01100000 .db %01111110 .db %00000000
libsrc/_DEVELOPMENT/sound/bit/z80/asm_bit_beepfx/_bfx_12.asm
jpoikela/z88dk
640
7823
; BeepFX sound effect by shiru ; http://shiru.untergrund.net SECTION rodata_clib SECTION rodata_sound_bit PUBLIC _bfx_12 _bfx_12: ; Harsh_beep_1 defb 1 ;tone defw 100,100,1000,0,32896 defb 0
3-mid/impact/source/3d/collision/shapes/impact-d3-shape-convex-internal-sphere.adb
charlie5/lace
20
30043
<filename>3-mid/impact/source/3d/collision/shapes/impact-d3-shape-convex-internal-sphere.adb with impact.d3.collision.Proxy; with impact.d3.Vector; with impact.d3.Scalar; package body impact.d3.Shape.convex.internal.sphere is function to_sphere_Shape (radius : in math.Real) return Item is use impact.d3.collision.Proxy; Self : Item; -- := (to_impact.d3.Shape.convex.internal with others => <>); begin Self.setShapeType (SPHERE_SHAPE_PROXYTYPE); Self.setImplicitShapeDimensions ((radius, radius, radius)); Self.setMargin (radius); return Self; end to_sphere_Shape; overriding procedure destruct (Self : in out Item) is begin null; end destruct; overriding function localGetSupportingVertex (Self : in Item; vec : in Vector_3) return Vector_3 is use impact.d3.Vector, impact.d3.Scalar, math.Vectors; supVertex : math.Vector_3 := Self.localGetSupportingVertexWithoutMargin (vec); vecnorm : math.Vector_3 := vec; begin if length2 (vecnorm) < SIMD_EPSILON * SIMD_EPSILON then vecnorm := (-1.0, -1.0, -1.0); end if; normalize (vecnorm); supVertex := supVertex + Self.getMargin * vecnorm; return supVertex; end localGetSupportingVertex; overriding function localGetSupportingVertexWithoutMargin (Self : in Item; vec : in Vector_3) return Vector_3 is pragma Unreferenced (Self, vec); begin return (0.0, 0.0, 0.0); end localGetSupportingVertexWithoutMargin; overriding procedure batchedUnitVectorGetSupportingVertexWithoutMargin (Self : in Item; vectors : in Vector_3_array; supportVerticesOut : out Vector_3_array; numVectors : in Integer) is pragma Unreferenced (Self, vectors); begin for i in 1 .. numVectors loop supportVerticesOut (i) := (0.0, 0.0, 0.0); end loop; end batchedUnitVectorGetSupportingVertexWithoutMargin; -- broken due to scaling -- overriding procedure getAabb (Self : in Item; t : in Transform_3d; aabbMin, aabbMax : out Vector_3) is use math.Vectors; center : math.Vector_3 renames t.Translation; extent : constant math.Vector_3 := (Self.getMargin, Self.getMargin, Self.getMargin); begin aabbMin := center - extent; aabbMax := center + extent; end getAabb; overriding procedure setMargin (Self : in out Item; margin : in Real) is begin impact.d3.Shape.convex.internal.setMargin (impact.d3.Shape.convex.internal.item (Self), margin); end setMargin; overriding function getMargin (Self : in Item) return Real is begin -- To improve gjk behaviour, use radius+margin as the full margin, so never get into the penetration case. -- This means, non-uniform scaling is not supported anymore. -- return Self.getRadius; end getMargin; overriding procedure calculateLocalInertia (Self : in Item; mass : in math.Real; inertia : out math.Vector_3) is elem : constant math.Real := 0.4 * mass * Self.getMargin * Self.getMargin; begin inertia := (elem, elem, elem); end calculateLocalInertia; overriding function getName (Self : in Item) return String is pragma Unreferenced (Self); begin return "SPHERE"; end getName; function getRadius (Self : in Item) return math.Real is begin return Self.getImplicitShapeDimensions (1) * Self.getLocalScaling (1); end getRadius; procedure setUnscaledRadius (Self : in out Item; To : in math.Real) is begin Self.setImplicitShapeDimensions ((To, To, To)); impact.d3.Shape.convex.internal.setMargin (impact.d3.Shape.convex.internal.Item (Self), To); end setUnscaledRadius; end impact.d3.Shape.convex.internal.sphere;
src/test/resources/EQL.g4
mrmx/ebean
0
4479
grammar EQL; select_statement : select_clause? fetch_clause* where_clause? orderby_clause? limit_clause? EOF ; select_properties : '(' fetch_property_group ')' | fetch_property_group ; select_clause : 'select' distinct? select_properties ; distinct : 'distinct' ; fetch_clause : fetch_path ; where_clause : 'where' conditional_expression ; orderby_clause : 'order' 'by' orderby_property (',' orderby_property)* ; orderby_property : PATH_VARIABLE asc_desc? nulls_firstlast? ; nulls_firstlast : 'nulls' 'first' | 'nulls' 'last' ; asc_desc : 'asc' | 'desc' ; limit_clause : 'limit' NUMBER_LITERAL offset_clause? ; offset_clause : 'offset' NUMBER_LITERAL ; fetch_path : 'fetch' fetch_option? fetch_path_path fetch_property_set? ; fetch_property_set : '(' fetch_property_group ')' ; fetch_property_group : fetch_property (',' fetch_property)* ; fetch_path_path : PATH_VARIABLE | QUOTED_PATH_VARIABLE ; fetch_property : PATH_VARIABLE | fetch_query_hint | fetch_lazy_hint | PROP_FORMULA ; fetch_query_hint : '+' fetch_query_option ; fetch_lazy_hint : '+' fetch_lazy_option ; fetch_option : fetch_query_option | fetch_lazy_option ; fetch_query_option : 'query' fetch_batch_size? ; fetch_lazy_option : 'lazy' fetch_batch_size? ; fetch_batch_size : '(' NUMBER_LITERAL ')' ; conditional_expression : conditional_term ('or' conditional_term)* ; conditional_term : conditional_factor ('and' conditional_factor)* ; conditional_factor : 'not'? conditional_primary ; conditional_primary : any_expression | '(' conditional_expression ')' ; any_expression : comparison_expression | like_expression | inrange_expression | between_expression | propertyBetween_expression | in_expression | isNull_expression | isNotNull_expression | isEmpty_expression | isNotEmpty_expression | '(' any_expression ')' ; in_expression : PATH_VARIABLE 'in' in_value ; in_value : INPUT_VARIABLE | '(' value_expression (',' value_expression)* ')' ; between_expression : PATH_VARIABLE 'between' value_expression 'and' value_expression ; inrange_expression : PATH_VARIABLE 'inrange' value_expression 'to' value_expression ; propertyBetween_expression : value_expression 'between' PATH_VARIABLE 'and' PATH_VARIABLE ; isNull_expression : PATH_VARIABLE 'is' 'null' | PATH_VARIABLE 'isNull' ; isNotNull_expression : PATH_VARIABLE 'is' 'not' 'null' | PATH_VARIABLE 'isNotNull' | PATH_VARIABLE 'notNull' ; isEmpty_expression : PATH_VARIABLE 'is' 'empty' | PATH_VARIABLE 'isEmpty' ; isNotEmpty_expression : PATH_VARIABLE 'is' 'not' 'empty' | PATH_VARIABLE 'isNotEmpty' | PATH_VARIABLE 'notEmpty' ; like_expression : PATH_VARIABLE like_op value_expression ; like_op : 'like' | 'ilike' | 'contains' | 'icontains' | 'startsWith' | 'istartsWith' | 'endsWith' | 'iendsWith' ; comparison_expression : PATH_VARIABLE comparison_operator value_expression | value_expression comparison_operator PATH_VARIABLE ; comparison_operator : '=' | 'eq' | '>' | 'gt' | '>=' | 'ge' | 'gte' | '<' | 'lt' | '<=' | 'le' | 'lte' | '<>' | '!=' | 'ne' | 'ieq' | 'ine' ; value_expression : literal | INPUT_VARIABLE ; literal : STRING_LITERAL | BOOLEAN_LITERAL | NUMBER_LITERAL ; INPUT_VARIABLE : ':' ('a' .. 'z' | 'A' .. 'Z' | '_') ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_')* ; PATH_VARIABLE : ('a' .. 'z' | 'A' .. 'Z' | '_') ('a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' | '.')* ; QUOTED_PATH_VARIABLE : ('`')(PATH_VARIABLE)('`') ; PROP_FORMULA : 'sum(' PATH_VARIABLE ')' | 'max(' PATH_VARIABLE ')' | 'min(' PATH_VARIABLE ')' | 'avg(' PATH_VARIABLE ')' | 'count(' PATH_VARIABLE ')' ; BOOLEAN_LITERAL : 'true' | 'false' ; NUMBER_LITERAL : '-'? DOUBLE | '-'? INT | ZERO ; DOUBLE : [0-9]+ '.' [0-9]*; INT : [1-9] [0-9]*; ZERO : '0'; STRING_LITERAL : '\'' ( ~'\'' | '\'\'' )* '\'' ; WS : [ \t\r\n] -> skip ;
examples/keyboard-input.asm
KCreate/stackvm
45
13778
<filename>examples/keyboard-input.asm ; Instructions: ; ; ./stackvm build keyboard-input.asm -o out.bc ; ./stackvm run out.bc ; ./stackvm monitor machine.memory -s 2 ; ; Focus the window opened by the monitor command ; and press some keys on your keyboard. You should now ; see some stuff popping up in the terminal off the run command ; Configure the interrupt handler's address .org INTERRUPT_HANDLER_ADDRESS .db _interrupt_handler_address t_address my_interrupt_handler .org INTERRUPT_MEMORY .db _interrupt_memory INTERRUPT_MEMORY_SIZE 0 .org 0x00 .db io_buffer 255 0 .def io_cursor r0 .label entry_addr ; execute the main function push t_size, 0 call main ; exit the program push byte, 0 push t_syscall, sys_exit syscall .label main nop jmp main .label my_interrupt_handler ; skip if this is a keydown readc r2b, INTERRUPT_KEYBOARD_KEYDOWN loadi r3b, 1 cmp r2b, r3b jz read_char ret .label read_char ; calculate the cursor offset mov r1, io_cursor loadi r2, io_buffer add r1, r2 ; copy the char readc r2b, INTERRUPT_KEYBOARD_SYM write r1, r2b ; increment the io cursor push t_size, 0x0 call increment_io_cursor push t_size, 0x0 call print_io_buffer ret .label increment_io_cursor mov r1, io_cursor loadi r2, 1 add r1, r2 mov io_cursor, r1 ret .label print_io_buffer mov r1, INTERRUPT_MEMORY mov r2, io_cursor add r2, r1 .label loop cmp r1, r2 jz loop_end rpush r1 push t_size, byte push t_syscall, sys_write syscall loadi r3, 1 add r1, r3 jmp loop .label loop_end push byte, 13 rpush sp push t_size, 1 push t_syscall, sys_write syscall loadi r59, 1 add sp, r59 ret ; Note to future self ; Somewhere is a bug which causes an invalid jump to 0x3a ; in the case when an interrupt happens inside an interrupt handler ; ; this is likely an issue of us not producing a correct stack frame ; and thus making it jump to some weird address ; ; something worth to investiage: ; 0x3a = 58 = syscall ; ; maybe the ret instruction tries to jump to an opcodes value ???
courses/fundamentals_of_ada/labs/prompts/160_genericity/data_type.adb
AdaCore/training_material
15
23926
package body Data_Type is function "<" (L, R : Record_T) return Boolean is begin return False; end "<"; function Image (Element : Record_T) return String is begin return ""; end Image; end Data_Type;
s3/music-optimized/Continue.asm
Cancer52/flamedriver
9
241923
<reponame>Cancer52/flamedriver Snd_Continue_Header: smpsHeaderStartSong 3 smpsHeaderVoiceUVB smpsHeaderChan $06, $03 smpsHeaderTempo $01, $43 smpsHeaderDAC Snd_Continue_DAC smpsHeaderFM Snd_Continue_FM1, $18, $12 smpsHeaderFM Snd_Continue_FM2, $18, $10 smpsHeaderFM Snd_Continue_FM3, $0C, $14 smpsHeaderFM Snd_Continue_FM4, $0C, $0E smpsHeaderFM Snd_Continue_FM5, $0C, $0E smpsHeaderPSG Snd_Continue_PSG1, $F4, $04, $00, sTone_0C smpsHeaderPSG Snd_Continue_PSG2, $F4, $04, $00, sTone_0C smpsHeaderPSG Snd_Continue_PSG3, $00, $03, $00, sTone_0C ; DAC Data Snd_Continue_DAC: dc.b dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, dSnareS3, nRst, $08, dSnareS3, $02, dSnareS3 dc.b dSnareS3, $04, dSnareS3, dSnareS3 Snd_Continue_Jump00: dc.b dKickS3, nRst, dKickS3, dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst dc.b dKickS3, nRst, $08, dKickS3, $04, dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3 dc.b dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, $08, dKickS3, $04 dc.b nRst, dKickS3, dSnareS3, nRst, dKickS3, nRst, $08, dKickS3, $04, dSnareS3, nRst, $08 dc.b dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3 dc.b nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, dKickS3, nRst, $08, dKickS3 dc.b $04, dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, $08, dKickS3 dc.b $04, nRst, dKickS3, dSnareS3, nRst, $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst dc.b $08, dKickS3, $04, nRst, dKickS3, dSnareS3, nRst, dSnareS3, nRst, $08, dSnareS3, $02 dc.b dSnareS3, dSnareS3, $04, dSnareS3, dSnareS3 smpsJump Snd_Continue_Jump00 ; FM1 Data Snd_Continue_FM1: smpsSetvoice $03 smpsAlterNote $FE smpsModSet $0F, $01, $06, $06 smpsAlterNote $01 smpsPan panRight, $00 smpsCall Snd_Continue_Call00 Snd_Continue_Call00: dc.b nRst, $08, nEb4, $04, nE4, $08, nC4, $04, nD4, $08, nC4, $04 dc.b nA3, $08, nC4, $04 Snd_Continue_Jump04: dc.b nRst, $14, nBb3, $02, nC4, $0E, nA3, $04, nRst, $08, nG3, $0C dc.b nA3, $08, nEb3, $02, nE3, nG3, $08, nA3, $04, nRst, $20, nBb3 dc.b $02, nC4, $0E, nA3, $04, nRst, $08, nEb3, $0C, nD3, $08, nC3 dc.b $04, nRst, $24, nA2, $0C, nC3, nD3, $08, nEb3, $0C, nD3, $04 dc.b nEb3, $08, nD3, $04, nEb3, $08, nD3, $04, nC3, $08, nRst, $0C dc.b nEb4, $04, nE4, $08, nC4, $04, nD4, $08, nC4, $04, nRst, $08 dc.b nEb4, $04, nRst, $08, nEb4, $04, nE4, $08, nC4, $04, nD4, $08 dc.b nC4, $04, nA3, $08, nC4, $04 smpsJump Snd_Continue_Jump04 ; FM2 Data Snd_Continue_FM2: smpsSetvoice $14 smpsAlterNote $00 smpsModSet $02, $01, $01, $02 dc.b nF1, $0B, nRst, $01, nFs1, $07, nRst, $01, nG1, $03, nRst, $09 dc.b nG0, $03, nRst, $01, nG0, $0B, nRst, $01 Snd_Continue_Jump03: dc.b nC1, $0B, nRst, $01, nE1, $0B, nRst, $01, nF1, $0B, nRst, $01 dc.b nFs1, $07, nRst, $01, nG1, $03, nRst, $09, nG1, $03, nRst, $01 dc.b nC1, $0B, nRst, $01, nE1, $0B, nRst, $01, nC1, $0B, nRst, $01 dc.b nA0, $0B, nRst, $01, nC1, $0B, nRst, $01, nD1, $0B, nRst, $01 dc.b nEb1, $07, nRst, $01, nE1, $03, nRst, $09, nE1, $03, nRst, $01 dc.b nA0, $0B, nRst, $01, nC1, $0B, nRst, $01, nA0, $0B, nRst, $01 dc.b nF0, $0B, nRst, $01, nA0, $0B, nRst, $01, nC1, $0B, nRst, $01 dc.b nD1, $07, nRst, $01, nEb1, $03, nRst, $09, nEb1, $03, nRst, $01 dc.b nC1, $0B, nRst, $01, nA0, $0B, nRst, $01, nF0, $0B, nRst, $01 dc.b nD1, $07, nRst, $01, nD1, $03, nRst, $01, nD1, $0B, nRst, $01 dc.b nE1, $07, nRst, $01, nE1, $03, nRst, $01, nE1, $0B, nRst, $01 dc.b nF1, $0B, nRst, $01, nFs1, $07, nRst, $01, nG1, $03, nRst, $09 dc.b nG0, $03, nRst, $01, nG0, $0B, nRst, $01 smpsJump Snd_Continue_Jump03 ; FM3 Data Snd_Continue_FM3: smpsSetvoice $08 smpsAlterNote $01 smpsModSet $0F, $01, $06, $06 smpsAlterNote $FF smpsPan panLeft, $00 dc.b nRst, $01 smpsCall Snd_Continue_Call00 smpsStop ; FM4 Data Snd_Continue_FM4: smpsSetvoice $06 smpsAlterNote $01 smpsModSet $0A, $01, $03, $06 dc.b nRst, $2C, nG3, $03, nRst, $01 Snd_Continue_Jump02: dc.b nRst, $08, nG3, $0A, nF3, $01, nE3, nD3, nC3, nBb2, nA2, nG2 dc.b nF2, nE2, nD2, nRst, $38, nG3, $08, nE3, $03, nRst, $09, nE3 dc.b $0A, nD3, $01, nC3, nBb2, nA2, nG2, nF2, nE2, nD2, nC2, nBb1 dc.b nRst, $38, nE3, $08, nC3, $03, nRst, $09, nC3, $0A, nBb2, $01 dc.b nA2, nG2, nF2, nE2, nD2, nC2, nBb1, nA1, nG1, nRst, $38, nA3 dc.b $0C, nF3, $18, nG3, nA3, $0C, nA3, $08, nB3, $04, nRst, $14 dc.b nG3, $04 smpsJump Snd_Continue_Jump02 ; FM5 Data Snd_Continue_FM5: smpsSetvoice $06 smpsAlterNote $FF smpsModSet $0A, $01, $03, $06 dc.b nRst, $2C, nC4, $03, nRst, $01 Snd_Continue_Jump01: dc.b nRst, $08, nC4, $0A, nBb3, $01, nA3, nG3, nF3, nE3, nD3, nC3 dc.b nBb2, nA2, nG2, nRst, $38, nC4, $08, nA3, $03, nRst, $09, nA3 dc.b $0A, nG3, $01, nF3, nE3, nD3, nC3, nBb2, nA2, nG2, nF2, nE2 dc.b nRst, $38, nA3, $08, nF3, $03, nRst, $09, nF3, $0A, nEb3, $01 dc.b nD3, nC3, nBb2, nA2, nG2, nF2, nEb2, nD2, nC2, nRst, $38, nC4 dc.b $0C, nA3, $18, nB3, nC4, $0C, nC4, $08, nD4, $04, nRst, $14 dc.b nC4, $04 smpsJump Snd_Continue_Jump01 ; PSG1 Data Snd_Continue_PSG1: smpsPSGvoice sTone_04 dc.b nRst, $30 Snd_Continue_Jump07: dc.b nRst, $08, nC4, $02, nRst, nC5, nRst, $06, nC4, $02, nRst, nC5 dc.b nRst, $0A, nC4, $02, nRst, $06, nC5, $02, nRst, $16, nC4, $02 dc.b nRst, nC5, nRst, $12, nC5, $02, nRst, $0A, nA3, $02, nRst, nA4 dc.b nRst, $06, nA3, $02, nRst, nA4, nRst, $0A, nA3, $02, nRst, $06 dc.b nA4, $02, nRst, $0A, nEb4, $02, nRst, nE4, nRst, $06, nG4, $02 dc.b nRst, nA4, nRst, $06, nE4, $02, nRst, $0A, nE4, $02, nRst, $0A dc.b nF3, $02, nRst, nF4, nRst, $06, nF3, $02, nRst, nF4, nRst, $0A dc.b nF3, $02, nRst, $06, nF4, $02, nRst, $16, nF3, $02, nRst, nF4 dc.b nRst, $12, nF4, $02, nRst, $0E, nF4, $02, nRst, $06, nE4, $02 dc.b nRst, $1A, nF4, $02, nRst, $0A, nFs4, $02, nRst, $06, nG4, $02 dc.b nRst, $1A smpsJump Snd_Continue_Jump07 ; PSG2 Data Snd_Continue_PSG2: smpsPSGvoice sTone_04 dc.b nRst, $30 Snd_Continue_Jump06: dc.b nRst, $08, nE3, $02, nRst, nE4, nRst, $06, nE3, $02, nRst, nE4 dc.b nRst, $0A, nE3, $02, nRst, $06, nE4, $02, nRst, $16, nE3, $02 dc.b nRst, nE4, nRst, $12, nE4, $02, nRst, $0A, nC3, $02, nRst, nC4 dc.b nRst, $06, nC3, $02, nRst, nC4, nRst, $0A, nC3, $02, nRst, $06 dc.b nC4, $02, nRst, $0A, nC3, $02, nRst, nC4, nRst, $06, nC3, $02 dc.b nRst, nC4, nRst, $0A, nC3, $02, nRst, $06, nC4, $02, nRst, $0A dc.b nA2, $02, nRst, nA3, nRst, $06, nA2, $02, nRst, nA3, nRst, $0A dc.b nA2, $02, nRst, $06, nA3, $02, nRst, $16, nA2, $02, nRst, nA3 dc.b nRst, $12, nA3, $02, nRst, $0E, nA3, $02, nRst, $06, nG3, $02 dc.b nRst, $1A, nA3, $02, nRst, $0A, nBb3, $02, nRst, $06, nB3, $02 dc.b nRst, $1A smpsJump Snd_Continue_Jump06 ; PSG3 Data Snd_Continue_PSG3: smpsPSGform $E7 Snd_Continue_Jump05: smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $10 smpsPSGvoice sTone_01 dc.b nMaxPSG2, $08 smpsPSGvoice sTone_04 dc.b nMaxPSG2, $18 smpsJump Snd_Continue_Jump05
src/firmware-tests/TestDoubles.asm
pete-restall/Cluck2Sesame-Prototype
1
25332
<reponame>pete-restall/Cluck2Sesame-Prototype #include "Mcu.inc" radix decimal udata global mockCallCounter mockCallCounter res 1 TestDoubles code global initialiseTestDoubles initialiseTestDoubles: banksel mockCallCounter clrf mockCallCounter return end
lab1/bootloader.asm
wannaphongcom/os-dev
1
243339
bits 16 jmp bootloader message db 'Hello World',0 printMessage: push ax .loop: lodsb or al,al jz .quitLoop mov ah,0x0e int 0x10 jmp .loop .quitLoop: pop ax ret bootloader: cli mov ax,0x07c0 mov ds,ax mov gs,ax mov fs,ax mov es,ax mov ax,0x07e0 mov ss,ax mov bp,ax mov sp,0xff sti mov si,message call printMessage cli hlt times 510-($-$$) db 0 DB 0x55 DB 0xAA times 1024*1024 db 0
software/hal/boards/stm32f429_discovery/stm32-board.adb
TUM-EI-RCS/StratoX
12
25552
<filename>software/hal/boards/stm32f429_discovery/stm32-board.adb ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015-2016, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of 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 stm32f429i_discovery.c -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief This file provides set of firmware functions to manage Leds -- -- and push-button available on STM32F429I-Discovery Kit from -- -- STMicroelectronics. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ with HAL.SPI; package body STM32.Board is ------------------ -- All_LEDs_Off -- ------------------ procedure All_LEDs_Off is begin Clear (All_LEDs); end All_LEDs_Off; ----------------- -- All_LEDs_On -- ----------------- procedure All_LEDs_On is begin Set (All_LEDs); end All_LEDs_On; --------------------- -- Initialize_LEDs -- --------------------- procedure Initialize_LEDs is Conf : GPIO_Port_Configuration; begin Enable_Clock (All_LEDs); Conf.Mode := Mode_Out; Conf.Output_Type := Push_Pull; Conf.Speed := Speed_100MHz; Conf.Resistors := Floating; Configure_IO (All_LEDs, Conf); end Initialize_LEDs; ------------------------ -- Initialize_Gyro_IO -- ------------------------ procedure Initialize_Gyro_IO is -- See the STM32F429 Discovery kit User Manual (UM1670) pages 21 and 23. begin Enable_Clock (Gyro_SPI); Enable_Clock (NCS_MEMS_SPI & SPI5_SCK & SPI5_MISO & SPI5_MOSI); Init_Chip_Select : declare Config : GPIO_Port_Configuration; begin Config.Speed := Speed_25MHz; Config.Mode := Mode_Out; Config.Output_Type := Push_Pull; Config.Resistors := Pull_Up; Configure_IO (NCS_MEMS_SPI, Config); end Init_Chip_Select; Init_SPI_IO_Pins : declare Config : GPIO_Port_Configuration; begin Config.Speed := Speed_100MHz; Config.Mode := Mode_AF; Config.Output_Type := Push_Pull; Config.Resistors := Floating; Configure_IO (SPI5_SCK & SPI5_MISO & SPI5_MOSI, Config); Configure_Alternate_Function (SPI5_SCK & SPI5_MISO & SPI5_MOSI, GPIO_AF_SPI5); end Init_SPI_IO_Pins; Init_SPI_Port : declare Config : SPI_Configuration; begin Config := (Direction => D2Lines_FullDuplex, Mode => Master, Data_Size => HAL.SPI.Data_Size_8b, Clock_Polarity => Low, Clock_Phase => P1Edge, Slave_Management => Software_Managed, Baud_Rate_Prescaler => BRP_32, First_Bit => MSB, CRC_Poly => 7); Configure (Gyro_SPI, Config); STM32.SPI.Enable (Gyro_SPI); end Init_SPI_Port; Gyro.Initialize (Port => Gyro_SPI'Access, Chip_Select => NCS_MEMS_SPI'Access); if Gyro.Device_Id /= L3GD20.I_Am_L3GD20 then raise Program_Error with "No L3GD20 found"; end if; end Initialize_Gyro_IO; -------------------------------- -- Configure_User_Button_GPIO -- -------------------------------- procedure Configure_User_Button_GPIO is Config : GPIO_Port_Configuration; begin Enable_Clock (User_Button_Point); Config.Mode := Mode_In; Config.Resistors := Floating; User_Button_Point.Configure_IO (Config); end Configure_User_Button_GPIO; end STM32.Board;
DRUNKEN.asm
LutzGrosshennig/amiga-drunken-coder-intro
0
166085
<reponame>LutzGrosshennig/amiga-drunken-coder-intro INTENA = $9A DMACON = $96 DMACONR = $02 VHPOSR = $06 BLTCON0 = $40 BLTCON1 = $42 BLTCPTH = $48 BLTBPTH = $4C BLTAPTH = $50 BLTAPTL = $52 BLTDPTH = $54 BLTCMOD = $60 BLTBMOD = $62 BLTAMOD = $64 BLTDMOD = $66 BLTSIZE = $58 BLTADAT = $74 BLTBDAT = $72 BLTAFWM = $44 BLTALWM = $46 COLOR00 = $180 ; OFFSETS EXEC FORBID = -132 PERMIT = -138 OPENLIBRARY = -408 CLOSELIBRARY = -414 ALLOCMEM = -198 FREEMEM = -210 ; KONSTANTEN EXECBASE = 4 MOUSEBUTTON = $BFE001 CHIPCLEAR = $10002 SCREENX = 352 SCREENY = 256 PLANES = 6 PLANESIZE = (SCREENX*SCREENY)/8 PLAYFIELD = PLANESIZE*PLANES SCREENB = SCREENX/8 SCREENW = SCREENX/16 TEXTLAENGE = TEXTEND1 - DEMOTEXT -1 SCROLLSPEED = 1 ZEILE = 183 NO_SHADOWS = 10 SHADING = 4 COPPERLINES = 60 COP_START = $E600 ;---------------------------------------------------------- OPENLIB:MACRO *\NAME,*\BASE LEA \NAME(PC),A1 JSR OPENLIBRARY(A6) MOVE.L D0,\BASE ENDM CLOSELIB:MACRO *\BASE MOVE.L EXECBASE,A6 MOVE.L \BASE(PC),A1 JSR CLOSELIBRARY(A6) ENDM WAIT_BLIT:MACRO \1: BTST #14,DMACONR(A5) ;16 BNE.S \1 ; ENDM ;------------ M A I N - P R O G R A M ----------------- CODE START: MOVE.L EXECBASE,A6 JSR FORBID(A6) OPENLIB GFXNAME,GFXBASE BSR MT_INIT LEA $DFF000,A5 MOVE.W #$20,$1DC(A5) ; BACK TO PAL BSR OPENSCR BSR LINE_INIT MAIN_LOOP: MOVE.W $6(A5),D2 AND.W #$FF00,D2 CMP.W #$1000,D2 BNE.S MAIN_LOOP CMP.W #8,ZAEHLER ;20 BEQ PUT_IT ; BACKEBACK: SCROLL_BAR: MOVEQ #0,D4 MOVE.L DUMMYSCREEN1(PC),D1 MOVE.L DUMMYSCREEN11(PC),D0 MOVE.L #SCREENB*22,D2 ; Planesize MOVEQ #2,D7 WAIT_BLIT MOVE.L D4,BLTAMOD(A5) ; ALLE MOD = 0 MOVE.L D4,BLTCMOD(A5) MOVE.L #$C9F00000,BLTCON0(A5) SCROLL_LOOP: MOVEM.L D0/D1,BLTAPTH(A5) MOVE.W #(64*22)+SCREENW,BLTSIZE(A5) ADD.L D2,D0 ADD.L D2,D1 WAIT_BLIT DBRA D7,SCROLL_LOOP ;------------------------------------------------------- PLANES OR MOVE.L DUMMYSCREEN1(PC),D0 ; A MOVE.L DUMMYSCREEN2(PC),D1 ; B,D MOVE.W #$09F0,BLTCON0(A5) ; 1 PLANE DIREKT MOVEM.L D0/D1,BLTAPTH(A5) MOVE.W #(64*22)+SCREENW,BLTSIZE(A5) ADD.L D2,D0 MOVEQ #1,D7 WAIT_BLIT MOVE.W #$0DFC,BLTCON0(A5) DOR_LOOP: MOVEM.L D0/D1,BLTAPTH(A5) MOVE.L D1,BLTBPTH(A5) MOVE.W #(64*22)+SCREENW,BLTSIZE(A5) ADD.L D2,D0 WAIT_BLIT DBRA D7,DOR_LOOP ;---------------------------------------------- COKIE CUT MOVE.L SCREENBASE(PC),D0 ; D ADD.L #ZEILE*SCREENB,D0 MOVE.L DUMMYSCREEN1(PC),D3 ; B MOVE.L DUMMYSCREEN2(PC),D1 ; A MOVE.L BLABASE(PC),D5 ; C MOVE.L #PLANESIZE,D2 ; 10240 MOVEQ #4,D7 MOVE.W #$0FCA,BLTCON0(A5) C_SCROLL2_LOOP: MOVE.L D1,BLTAPTH(A5) MOVE.L D3,BLTBPTH(A5) MOVE.L D5,BLTCPTH(A5) MOVE.L D0,BLTDPTH(A5) MOVE.W #(64*22)+SCREENW,BLTSIZE(A5) ADD.L #SCREENB*22,D3 ADD.L D2,D0 ADD.L #SCREENB*22,D5 WAIT_BLIT DBRA D7,C_SCROLL2_LOOP MOVE.W #SCREENB,BLTCMOD(A5) CLS: MOVE.L SHADOWSCREEN(PC),BLTDPTH(A5) ; 28 MOVE.L #$01000000,BLTCON0(A5) MOVE.W #(64*42)+SCREENW,BLTSIZE(A5) ; 16 SCROLL_SHADOWS: LEA SHADOW_DAT(PC),A0 ; 8 MOVEQ #NO_SHADOWS,D7 ; 4 MOVEQ #8,D0 ; 4 SHADOW_LOOP: ; TST.W (A0) ; 4 BEQ.S NO_SHADOW ; SUBQ.W #4,(A0) ; 4 NO_SHADOW: ; ADD.L D0,A0 ; 6 DBRA D7,SHADOW_LOOP ; DO: LEA SHADOW_DAT(PC),A4 ; 8 MOVE.L MULU4_TAB(PC),A0 MOVE.L MULU5_TAB(PC),A1 MOVEQ #NO_SHADOWS,D7 ; 4 MOVE.W #$402,A6 WAIT_BLIT MOVE.W #-16,BLTAPTL(A5) MOVE.W #-32,BLTAMOD(A5) MOVE.W #SCREENB,BLTDMOD(A5) MOVE.W #$41,BLTCON1(A5) MOVE.W #$8000,BLTADAT(A5) DO_LOOP: MOVE.W (A4),D2 ; 8 TST.W D2 ; 4 BEQ.S NEXT_SHADOW ; MOVE.L 4(A4),A3 ; 16 MOVEQ #21,D6 ; 4 DO_LOOP2: MOVE.W (A3)+,D4 ; 8 TST.W D4 ; 4 BEQ.S KEINE_DATEN ; DRAWLINE: CMP.W #7,D2 ; 8 BLO.S RAUS ; 8/12 CMP.W #310,D2 ; 8 BHI.S RAUS ; 8/12 FAST_LINE: MOVE.W D2,D0 ; 4 ADD.W D0,D0 ; 4 MOVE.W 0(A0,D0.W),D5 ; 12 ADD.W D0,D0 ; 4 MOVE.L 0(A1,D0.W),D1 ; 16 MOVE.W D5,D0 ; 4 WAIT_BLIT MOVE.L D1,BLTCPTH(A5) MOVE.L D1,BLTDPTH(A5) MOVE.W D4,BLTBDAT(A5) MOVE.W D0,BLTCON0(A5) MOVE.W A6,BLTSIZE(A5) RAUS: KEINE_DATEN: ADDQ.W #1,D2 ; 4 DBRA D6,DO_LOOP2 ; NEXT_SHADOW: ADDQ.W #8,A4 ; 4 DBRA D7,DO_LOOP ; BLUB: ADDQ.W #1,ZAEHLER BSR MT_MUSIC LEA $DFF000,A5 BTST #6,MOUSEBUTTON BNE MAIN_LOOP ENDE: BSR CLOSESCR ENDE1: BSR MT_END CLOSELIB GFXBASE JSR PERMIT(A6) MOVEQ #0,D0 RTS ;-------------------------- PUT_IT: BSR.S SETCHAR BSR SET_SHADOW BRA BACKEBACK ;------------------------- SETCHAR: MOVE.W TEXTZAEHLER(PC),D0 CMP.W #TEXTLAENGE,D0 BEQ.S RESET_TEXT BSR GET_ADRESS BSR BLITBACKGROUND ADDQ.L #1,TEXTPOINTER ADDQ.W #1,TEXTZAEHLER CLR.W ZAEHLER RTS RESET_TEXT: MOVE.L #DEMOTEXT,TEXTPOINTER CLR.W TEXTZAEHLER BRA.S SETCHAR ;---------------------------------------------------- SET_SHADOW: LEA SHADOW_DAT(PC),A0 ; 8 LEA MULU3_TAB(PC),A1 ; 8 LEA CHAR_DATA(PC),A2 ; 8 MOVEQ #0,D0 ; 4 MOVEQ #NO_SHADOWS,D7 ; 4 MOVE.B CURRENT_SHADOW(PC),D0 ;12 MOVEQ #8,D1 ; 4 ; SET_SH_LOOP: ; ; TST.W (A0) ; 4 BEQ.S FREIER_SCHATTEN ; ADD.L D1,A0 ; 6 DBRA D7,SET_SH_LOOP ; BACK_SHADOW: RTS ; ; FREIER_SCHATTEN: ; ; CMP.B #50,D0 ; 8 BEQ.S BACK_SHADOW ; ADD.W D0,D0 ; 4 MOVE.W 0(A1,D0.W),D0 ;14 ADD.L A2,D0 ; 8 MOVE.L D0,4(A0) ;16 MOVE.W #320,(A0) ; 8 RTS GET_ADRESS: LEA MULU_TAB(PC),A1 MOVE.L TEXTPOINTER(PC),A0 LEA CHARSET_DATA,A2 MOVEQ #0,D0 MOVE.B (A0),D0 CMP.B #" ",D0 BEQ.S SET_BLANK SUB.B #48,D0 MOVE.B D0,CURRENT_SHADOW ADD.W D0,D0 MOVE.W 0(A1,D0.W),D0 ADD.L A2,D0 MOVE.L D0,DATAPOINTER RTS SET_BLANK: CLR.L DATAPOINTER MOVE.B #50,CURRENT_SHADOW RTS ;------------------------------------ BLITBACKGROUND: MOVEQ #0,D4 MOVE.L DATAPOINTER(PC),D0 BEQ.S FASTBLIT MOVE.L DUMMYSCREEN1(PC),D1 ADD.L #SCREENB-4,D1 MOVE.L #SCREENB*22,D2 MOVEQ #88,D3 MOVEQ #2,D7 WAIT_BLIT MOVE.W D4,BLTAMOD(A5) MOVE.W #SCREENB-4,BLTDMOD(A5) MOVE.L #$09F00000,BLTCON0(A5) BLIT_LOOP: MOVEM.L D0/D1,BLTAPTH(A5) MOVE.W #(64*22)+2,BLTSIZE(A5) ADD.L D2,D1 ADD.L D3,D0 WAIT_BLIT DBRA D7,BLIT_LOOP RTS ;------------------------- FASTBLIT: MOVE.L DUMMYSCREEN1(PC),D0 ; ADD.L #SCREENB-4,D0 MOVE.L #SCREENB*22,D1 ; MOVEQ #2,D7 ; 4 WAIT_BLIT ; MOVE.W #SCREENB-4,BLTDMOD(A5) ; 16 MOVE.L #$01000000,BLTCON0(A5) ; 16 FASTBLIT_LOOP: MOVE.L D0,BLTDPTH(A5) ; 28 MOVE.W #(64*22)+2,BLTSIZE(A5) ; 16 ADD.L D1,D0 ; WAIT_BLIT ; DBRA D7,FASTBLIT_LOOP ; RTS ; ;============================================================== COPY_DESERT: MOVE.L #DESERT_DATA,D0 MOVE.L SCREENBASE(PC),D1 MOVE.L #PLANESIZE,D2 MOVE.L #(40*256),D3 MOVEQ #4,D7 WAIT_BLIT MOVE.W #0,BLTAMOD(A5) MOVE.W #SCREENB-40,BLTDMOD(A5) MOVE.W #0,BLTCON1(A5) MOVE.W #$09F0,BLTCON0(A5) DESERT_LOOP: MOVE.L D0,BLTAPTH(A5) MOVE.L D1,BLTDPTH(A5) MOVE.W #(64*256)+20,BLTSIZE(A5) ADD.L D3,D0 ADD.L D2,D1 WAIT_BLIT DBRA D7,DESERT_LOOP COPY_BLA: MOVE.L SCREENBASE(PC),D0 ADD.L #SCREENB*ZEILE,D0 MOVE.L BLABASE(PC),D1 MOVE.L #PLANESIZE,D2 MOVE.L #SCREENB*22,D3 MOVEQ #4,D7 WAIT_BLIT MOVE.W #0,BLTDMOD(A5) MOVE.W #$09F0,BLTCON0(A5) BLA_LOOP: MOVE.L D0,BLTAPTH(A5) MOVE.L D1,BLTDPTH(A5) MOVE.W #(64*22)+SCREENW,BLTSIZE(A5) ADD.L D3,D1 ADD.L D2,D0 WAIT_BLIT DBRA D7,BLA_LOOP RTS ;-------------------------------------- DO_RAINBOW: LEA COPPER3,A0 LEA RAINBOW_COLORS(PC),A1 MOVE.W #COP_START,D0 MOVEQ #COPPERLINES-1,D7 RAINBOW_LOOP: MOVE.W D0,D1 ADD.W #$3D,D1 ;41 MOVE.W D1,(A0)+ MOVE.W #$FFFE,(A0)+ MOVE.W #$0180,(A0)+ MOVE.W (A1)+,(A0)+ ADD.W #$9A,D1 MOVE.W D1,(A0)+ MOVE.W #$FFFE,(A0)+ MOVE.W #$0180,(A0)+ CLR.W (A0)+ CMP.W #$FFD7,D1 BEQ.S SET_JUMP ADD.W #$0100,D0 BACK_RAINBOW: DBRA D7,RAINBOW_LOOP RTS SET_JUMP: MOVE.L #$FFFEFFFE,(A0)+ MOVEQ #0,D0 BRA.S BACK_RAINBOW ;---------------------------- LINE_INIT: LEA $DFF000,A5 MOVE.L SCREENBASE(PC),A0 ADD.L #PLANESIZE*5,A0 MOVE.L A0,PLANE_5 MOVEQ #%1111,D0 SUBQ.W #SCROLLSPEED,D0 ROR.W #4,D0 MOVE.W D0,CONTROL MOVE.L SCREENBASE(PC),D1 ADD.L #(211*SCREENB)+(5*PLANESIZE),D1 MOVE.L D1,SHADOWSCREEN LEA MULU_TAB(PC),A0 MOVEQ #49,D7 MOVEQ #0,D1 INIT_LOOP: ; SCROLLTEXT MOVE.L D1,D0 MULU #440,D0 MOVE.W D0,(A0)+ ADDQ.W #1,D1 DBRA D7,INIT_LOOP LEA MULU2_TAB(PC),A0 MOVEQ #34,D7 MOVE.L #210,D1 INIT2: ; LINIE MOVE.L D1,D0 MULU #SCREENB,D0 MOVE.W D0,(A0)+ ADDQ.W #1,D1 DBRA D7,INIT2 LEA MULU3_TAB(PC),A0 MOVEQ #49,D7 MOVEQ #0,D1 INIT3: ; SCHATTEN MOVE.L D1,D0 MULU #44,D0 MOVE.W D0,(A0)+ ADDQ.W #1,D1 DBRA D7,INIT3 LEA ALTITUDE(PC),A0 MOVE.L #319,D7 INIT4: SUB.B #207,(A0)+ DBRA D7,INIT4 MOVE.L MULU4_TAB(PC),A0 LEA ALTITUDE(PC),A1 LEA MULU2_TAB(PC),A2 MOVE.L PLANE_5(PC),A3 MOVE.L MULU5_TAB(PC),A4 MOVEQ #0,D2 MOVE.L #319,D7 INIT5: MOVEQ #0,D0 MOVE.W D2,D0 MOVEQ #0,D1 MOVE.B 0(A1,D0.W),D1 ADD.W D1,D1 MOVE.W 0(A2,D1.W),D1 MOVE.L D0,D5 ASR.W #3,D5 AND.B #$FE,D5 ADD.L D5,D1 ADD.L A3,D1 MOVE.L D1,(A4)+ AND.W #$F,D0 ROR.W #4,D0 ADD.W #$0BCA,D0 MOVE.W D0,(A0)+ ADDQ.L #1,D2 DBRA D7,INIT5 WAIT_BLIT CLR.W BLTBMOD(A5) MOVE.W #SCREENB,BLTCMOD(A5) MOVE.L #$FFFFFFFF,BLTAFWM(A5) RTS ;------------------------------- OPENSCR: MOVE.L EXECBASE,A6 ; SPEICHER IM CHIP RAM MOVE.L #PLAYFIELD,D0 ; HOLEN MOVE.L #CHIPCLEAR,D1 JSR ALLOCMEM(A6) MOVE.L D0,SCREENBASE MOVE.L #(SCREENB*22)*5,D0 MOVE.L #CHIPCLEAR,D1 JSR ALLOCMEM(A6) MOVE.L D0,DUMMYSCREEN1 ADDQ.L #2,D0 MOVE.L D0,DUMMYSCREEN11 MOVE.L #(SCREENB*22)*1,D0 MOVE.L #CHIPCLEAR,D1 JSR ALLOCMEM(A6) MOVE.L D0,DUMMYSCREEN2 MOVE.L #(SCREENB*22)*5,D0 MOVE.L #CHIPCLEAR,D1 JSR ALLOCMEM(A6) MOVE.L D0,BLABASE MOVE.L #320*4,D0 MOVEQ #0,D1 JSR ALLOCMEM(A6) MOVE.L D0,MULU5_TAB MOVE.L #320*2,D0 MOVEQ #0,D1 JSR ALLOCMEM(A6) MOVE.L D0,MULU4_TAB MOVE.L #POINTER_DATA,D0 LEA SPRITE_JMP,A0 MOVE.W D0,6(A0) SWAP D0 MOVE.W D0,2(A0) LEA DESERT_DATA,A0 ; FARB PALETTE IN DIE ADD.L #(256*40)*5,A0 LEA COPPER2,A1 ; COPPERLISTE MOVEQ #31,D7 MOVE.L #$180,D0 COLOR_LOOP: MOVE.W D0,(A1)+ MOVE.W (A0)+,(A1)+ ADDQ.L #2,D0 DBRA D7,COLOR_LOOP MOVEQ #PLANES-1,D7 ; BILDSCHIRM ADDRESSEN IN DIE MOVE.L SCREENBASE(PC),D0 ; COPPERLISTE LEA COPPER1,A0 MOVE.W #$E0,D1 POINTER_LOOP: MOVE.W D1,(A0) ADDQ.W #2,D1 MOVE.W D1,4(A0) ADDQ.W #2,D1 MOVE.W D0,6(A0) SWAP D0 MOVE.W D0,2(A0) SWAP D0 ADD.L #PLANESIZE,D0 ADDQ.L #8,A0 DBRA D7,POINTER_LOOP LEA $DFF000,A5 BSR DO_RAINBOW BSR COPY_DESERT MOVE.L GFXBASE,A0 ; COPPERLISTE EINSCHALTEN MOVE.W #$0080,DMACON(A5) MOVE.L $32(A0),OLDCOPPER MOVE.L #NEWCOPPER,$32(A0) MOVE.W #$8480,DMACON(A5) MOVE.L SCREENBASE(PC),D0 RTS ;-------------------------------------------------- INCLUDE "NEWPT.ASM" ;-------------------------------------------------- CLOSESCR: MOVE.L GFXBASE,A0 ; ALTE COPPERLISTE EINSCHALTEN MOVE.W #$0480,DMACON(A5) MOVE.L OLDCOPPER(PC),$32(A0) MOVE.W #$8080,DMACON(A5) MOVE.L EXECBASE,A6 ; SPEICHER FREIGEBEN MOVE.L SCREENBASE(PC),A1 MOVE.L #PLAYFIELD,D0 JSR FREEMEM(A6) MOVE.L DUMMYSCREEN1(PC),A1 MOVE.L #(SCREENB*22)*5,D0 JSR FREEMEM(A6) MOVE.L DUMMYSCREEN2(PC),A1 MOVE.L #(SCREENB*22)*1,D0 JSR FREEMEM(A6) MOVE.L BLABASE(PC),A1 MOVE.L #(SCREENB*22)*5,D0 JSR FREEMEM(A6) MOVE.L MULU5_TAB(PC),A1 MOVE.L #320*4,D0 JSR FREEMEM(A6) MOVE.L MULU4_TAB(PC),A1 MOVE.L #320*2,D0 JMP FREEMEM(A6) ;-------------------------------------- RAINBOW_COLORS: DS.W SHADING,$0001 DS.W SHADING,$0002 DS.W SHADING,$0003 DS.W SHADING,$0004 DS.W SHADING,$0005 DS.W SHADING,$0006 DS.W SHADING,$0007 DS.W SHADING,$0008 DS.W SHADING,$0009 DS.W SHADING,$000A DS.W SHADING,$000B DS.W SHADING,$000C DS.W SHADING,$000D DS.W SHADING,$000E DS.W SHADING,$000F TEXTPOINTER: DC.L DEMOTEXT DATAPOINTER: DC.L CHARSET_DATA GFXBASE: DC.L 0 OLDCOPPER: DC.L 0 SCREENBASE: DC.L 0 BASESCR: DC.L 0 PLANE_5: DC.L 0 SHADOWSCREEN: DC.L 0 DUMMYSCREEN1: DC.L 0 DUMMYSCREEN11: DC.L 0 DUMMYSCREEN2: DC.L 0 BLABASE: DC.L 0 MULU5_TAB: DC.L 0 MULU4_TAB: DC.L 0 SHADOW_DAT: DS.L 30,0 POINTER_DATA: DS.W 4,0 COUNTER: DC.W 0 CONTROL: DC.W 0 TEXTZAEHLER: DC.W 0 ZAEHLER: DC.W 0 MULU_TAB: DS.W 50,0 MULU2_TAB: DS.W 35,0 MULU3_TAB: DS.W 50,0 ALIGN.L CHAR_DATA: IBYTES "BIT/0-8.BIT" IBYTES "BIT/DUM2.BIT" IBYTES "BIT/A-I.BIT" IBYTES "BIT/J-R.BIT" IBYTES "BIT/S-Z.BIT" IBYTES "BIT/DUM1.BIT" CURRENT_SHADOW: DC.B 0 ALIGN.L ALTITUDE: DC.B 231,231,231,232,232,233,233,234,234,234 ;1 DC.B 235,235,235,235,235,235,236,236,236,236 ;2 DC.B 236,236,236,236,236,236,236,236,236,236 ;3 DC.B 236,236,236,236,236,236,236,236,236,236 ;4 DC.B 236,236,235,235,235,235,234,234,234,234 ;5 DC.B 233,233,233,232,232,231,231,230,230,229 ;6 DC.B 229,229,229,228,228,227,227,226,226,225 ;7 DC.B 225,224,224,223,223,222,222,221,221,220 ;8 DC.B 219,219,218,218,217,216,216,215,215,214 ;9 DC.B 214,213,213,212,212,212,211,211,211,210 ;10 DC.B 210,210,210,209,209,209,208,208,208,208 ;11 DC.B 208,208,207,207,207,207,207,207,207,207 ;12 DC.B 208,208,208,209,209,209,210,210,211,212 ;13 DC.B 212,213,214,215,215,216,216,217,218,218 ;14 DC.B 218,219,220,220,220,220,220,220,220,220 ;15 DC.B 220,220,220,220,220,220,220,219,219,219 ;16 DC.B 219,219,219,219,218,218,218,218,218,218 ;17 DC.B 218,218,218,218,218,218,218,218,218,218 ;18 DC.B 218,218,218,218,218,219,219,219,219,219 ;19 DC.B 219,220,220,220,220,221,221,221,222,222 ;20 DC.B 223,223,224,224,225,225,225,226,226,227 ;21 DC.B 227,228,228,229,229,230,230,230,231,231 ;22 DC.B 232,232,233,233,233,233,234,234,234,235 ;23 DC.B 235,235,235,235,236,236,236,236,236,237 ;24 DC.B 237,237,237,237,237,237,237,238,238,238 ;25 DC.B 238,238,238,238,238,238,238,238,238,238 ;26 DC.B 238,238,238,238,238,238,238,238,238,238 ;27 DC.B 238,238,238,237,237,236,236,235,235,234 ;28 DC.B 234,233,232,232,231,231,230,230,229,229 ;29 DC.B 228,228,227,227,226,226,225,225,224,224 ;30 DC.B 223,223,222,222,221,221,220,220,219,219 ;31 DC.B 219,218,218,218,218,217,217,217,217,217 ;32 DC.B 216,216,216,216,216,216,216,216,216,216 ;33 GFXNAME: DC.B "graphics.library",0 ALIGN.L DEMOTEXT: DC.B " YO = HERE COMEZ THE DRUNKEN = CODER = INTRO:" DC.B " THIS IS OUR ENTRY FOR THE PARTY III INTRO COMPETITION:" DC.B " CODING BY YEGGER; GFX BY ILLUSION; SOUND BY SNAKEY:" DC.B " GREETINGS TO MNEMOTRON < SPREADPOINT >; LIGHTFORCE < X=TRADE >; BORIS O: < AD=PC >; CUBIC;" DC.B " LEVI; MAC AND ALL THE OTHER LAMERS:" DC.B " \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ " TEXTEND1: DATA NEWCOPPER: DC.W $8E,$2C89 ; Diplay Window etc DC.W $90,$2CB5 DC.W $92,$38 DC.W $94,$D0 DC.W $100,$6200 DC.W $102,$0 DC.W $104,$0 DC.W $108,4 ;SCREENB-40 DC.W $10A,4 ;SCREENB-40 SPRITE_JMP: DC.W $120,0 DC.W $122,0 COPPER1: DS.W 24,0 ; DC.W $E0,0 ;1 ; Planes ; DC.W $E2,0 ; DC.W $E4,0 ;2 ; DC.W $E6,0 ; DC.W $E8,0 ;3 ; DC.W $EA,0 ; DC.W $EC,0 ;4 ; DC.W $EE,0 ; DC.W $F0,0 ;5 ; DC.W $F2,0 ; DC.W $F4,0 ;6 ; DC.W $F6,0 COPPER2: DS.W 64,0 COPPER3: DS.L (4*COPPERLINES)+1,0 DC.W $FFFF,$FFFE ;-------------------------------------- ALIGN.L CHARSET_DATA: IBYTES "BIT/CHARSET2.BIT" ALIGN.L DESERT_DATA: IBYTES "BIT/NEWDESERT.BIT" ALIGN.L MT_DATA: IBYTES "SFX/MOD.UNMEM" END
oeis/142/A142832.asm
neoneye/loda-programs
11
164464
<reponame>neoneye/loda-programs ; A142832: Primes congruent to 34 mod 61. ; Submitted by <NAME> ; 461,827,1193,1559,2657,3023,3389,3511,3877,4243,6073,6317,7537,8147,8269,8513,9001,9733,10099,10343,10709,10831,11197,11807,12539,13759,14369,15101,15467,16931,17053,17419,18517,19249,20347,21323,22543,22787,24007,24251,24373,25349,25471,26203,26813,27179,28277,28643,29009,29131,29741,29863,30839,31327,32059,32303,33767,33889,34499,35353,35597,35963,36451,37061,37549,38281,38891,39623,39989,40111,41453,41941,42307,43283,43649,44381,47309,47431,47797,48163,48407,49139,49261,49627,49871,49993 mov $1,47 mov $2,$0 add $2,2 pow $2,2 lpb $2 sub $2,1 mov $3,$1 mul $3,2 seq $3,10051 ; Characteristic function of primes: 1 if n is prime, else 0. sub $0,$3 add $1,61 mov $4,$0 max $4,0 cmp $4,$0 mul $2,$4 lpe mov $0,$1 mul $0,2 sub $0,121
oeis/197/A197910.asm
neoneye/loda-programs
11
94243
; A197910: Ceiling((n+1/2)^n). ; Submitted by <NAME>(s4) ; 2,7,43,411,5033,75419,1334839,27249053,630249410,16288946268,465239139607,14551915228367,494696673952512,18161513224841276,716102966059713316,30181658957863752410,1354087807629298185930,64430442087414935111822,3240840189607299761533536,171821387249394349577932211,9576518637861304436190336645,559777448747588114702580242011,34242134771593283503604532573415,2187691224652178611828697385313134,145715083951423621734808129270406291,10101659426560365118044137017756041887 add $0,1 mov $2,1 mov $3,$0 mul $3,5 lpb $3 mul $2,$3 mov $3,$0 mov $5,$0 mul $5,2 add $5,1 mul $2,$5 div $2,$0 lpe pow $2,$0 mov $4,10 pow $4,$0 div $2,$4 mov $0,$2 add $0,1
experiments/realbugs/student2.als
saiema/ARepair
5
702
<gh_stars>1-10 sig List { header: set Node } sig Node { link: set Node, elem: set Int } // Correct fact CardinalityConstraints { all l : List | lone l.header all n : Node | lone n.link all n : Node | one n.elem } // Correct pred Loop ( This : List ) { no This.header || one n : This.header.*link | n.^link = n.*link } // Underconstraint. Should be true if no n.link. pred Sorted ( This : List ) { // Fix: replace "n.elem <= n.link.elem" with "some n.link => n.elem <= n.link.elem" all n: This.header.*link | n.elem <= n.link.elem } pred RepOk ( This : List ) { Loop [This] Sorted [This] } // Correct pred Count ( This : List , x : Int , result : Int ) { RepOk [This] result = #{ n:This.header.*link | n.elem = x } } abstract sig Boolean {} one sig True , False extends Boolean {} // Underconstraint as result can always be true. pred Contains ( This : List , x : Int , result : Boolean ) { RepOk [ This ] // Fix: replace "||" with "else" or replace "( x ! in This.header.*link.elem => result=False ) || result = True" with "x ! in This.header.*link.elem <=> result=False". ( x ! in This.header.*link.elem => result=False ) || result = True } fact IGNORE { one List List.header.*link = Node }
grammar/HexaCParser.g4
tbourvon/HexaC
0
6658
parser grammar HexaCParser; options { tokenVocab = HexaCLexer; } // Rules program : toplevel_item* ; toplevel_item : preproc_dir | decl ; preproc_dir : HASH INCLUDE LT ID DOT ID GT ; decl : func_decl | var_decl ; func_decl : type ID OPEN_PAR param_list CLOSE_PAR block ; type : type_id=INT32_T | type_id=INT64_T | type_id=CHAR | type_id=VOID ; param_list : param (COMMA param)* | ; param : type ID ; block : OPEN_BRACE stmt_list CLOSE_BRACE ; stmt_list : (stmt)* ; stmt : var_decl | expr_stmt | if_stmt | while_stmt | block | return_stmt ; var_decl : type ID (EQ expr)? SEMICOLON ; expr_stmt : expr SEMICOLON ; expr returns[bool postfix] : callee=expr OPEN_PAR arg_list CLOSE_PAR | bin_lhs=expr bin_op=STAR bin_rhs=expr | bin_lhs=expr bin_op=DIV bin_rhs=expr | bin_lhs=expr bin_op=MOD bin_rhs=expr | bin_lhs=expr bin_op=PLUS bin_rhs=expr | bin_lhs=expr bin_op=MINUS bin_rhs=expr | bin_lhs=expr bin_op=EQ bin_rhs=expr | bin_lhs=expr bin_op=STAR_EQ bin_rhs=expr | bin_lhs=expr bin_op=DIV_EQ bin_rhs=expr | bin_lhs=expr bin_op=MOD_EQ bin_rhs=expr | bin_lhs=expr bin_op=PLUS_EQ bin_rhs=expr | bin_lhs=expr bin_op=MINUS_EQ bin_rhs=expr | bin_lhs=expr bin_op=AND_EQ bin_rhs=expr | bin_lhs=expr bin_op=OR_EQ bin_rhs=expr | bin_lhs=expr bin_op=XOR_EQ bin_rhs=expr | bin_lhs=expr bin_op=AND_AND bin_rhs=expr | bin_lhs=expr bin_op=OR_OR bin_rhs=expr | bin_lhs=expr bin_op=OR bin_rhs=expr | bin_lhs=expr bin_op=AND bin_rhs=expr | bin_lhs=expr bin_op=XOR bin_rhs=expr | bin_lhs=expr bin_op=LSH bin_rhs=expr | bin_lhs=expr bin_op=RSH bin_rhs=expr | bin_lhs=expr bin_op=EQ_EQ bin_rhs=expr | bin_lhs=expr bin_op=NOT_EQ bin_rhs=expr | bin_lhs=expr bin_op=GT bin_rhs=expr | bin_lhs=expr bin_op=LT bin_rhs=expr | bin_lhs=expr bin_op=GE bin_rhs=expr | bin_lhs=expr bin_op=LE bin_rhs=expr | bin_lhs=expr bin_op=COMMA bin_rhs=expr | OPEN_PAR group_expr=expr CLOSE_PAR | un_op=PLUS un_expr=expr { $postfix = false; } | un_op=MINUS un_expr=expr { $postfix = false; } | un_op=PLUS_PLUS un_expr=expr { $postfix = false; } | un_op=MINUS_MINUS un_expr=expr { $postfix = false; } | un_op=NOT un_expr=expr { $postfix = false; } | un_op=TILDE un_expr=expr { $postfix = false; } | un_expr=expr un_op=PLUS_PLUS { $postfix = true; } | un_expr=expr un_op=MINUS_MINUS { $postfix = true; } | literal ; arg_list : expr (COMMA expr)* | ; literal : INT_LIT | CHAR_LIT | ID ; if_stmt : IF OPEN_PAR expr CLOSE_PAR stmt_if=stmt (ELSE stmt_else=stmt)? ; while_stmt : WHILE OPEN_PAR expr CLOSE_PAR stmt ; return_stmt : RETURN (expr)? SEMICOLON ;
Task/Program-termination/Ada/program-termination-2.ada
LaudateCorpus1/RosettaCodeData
1
17585
procedure Main is -- Create as many task objects as your program needs begin -- whatever logic is required in your Main procedure if some_condition then -- for each task created by the Main procedure The_task.Stop; -- end the Main procedure return; -- actually, this is not needed end if; end Main;
Working Disassembly/General/Ending/Map - Sonic and Knuckles Pose Banner.asm
TeamASM-Blur/Sonic-3-Blue-Balls-Edition
5
4940
<reponame>TeamASM-Blur/Sonic-3-Blue-Balls-Edition<filename>Working Disassembly/General/Ending/Map - Sonic and Knuckles Pose Banner.asm Map_60644: dc.w word_60646-Map_60644 word_60646: dc.w 7 dc.b $EC, $D, 0, 0, $FF, $C8 dc.b $EC, $D, 0, 8, $FF, $E8 dc.b $EC, $D, 0, $10, 0, 8 dc.b $FC, $E, 0, $18, $FF, $C0 dc.b $FC, $E, 0, $24, $FF, $E0 dc.b $FC, $E, 0, $30, 0, 0 dc.b $FC, $E, 0, $3C, 0, $20
programs/oeis/116/A116729.asm
karttu/loda
1
6163
; A116729: Duplicate of A048840. ; 1,2,5,12,22,34,48,64,82,102,124,148,174,202,232,264,298,334,372,412,454,498,544,592,642,694,748,804,862,922 mov $2,$0 mul $0,3 trn $0,7 add $0,1 mov $1,$0 mov $3,$2 mul $3,$2 add $1,$3