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
oeml-sdk/ada/src/model/-models.adb
Martin-Molinero/coinapi-sdk
0
13365
<gh_stars>0 -- OEML _ REST API -- This section will provide necessary information about the `CoinAPI OEML REST API` protocol. This API is also available in the Postman application: <a href=\"https://postman.coinapi.io/\" target=\"_blank\">https://postman.coinapi.io/</a> -- -- The version of the OpenAPI document: v1 -- Contact: <EMAIL> -- -- NOTE: This package is auto generated by OpenAPI-Generator 5.1.1. -- https://openapi-generator.tech -- Do not edit the class manually. package body .Models is pragma Style_Checks ("-mr"); pragma Warnings (Off, "*use clause for package*"); use Swagger.Streams; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Severity_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Severity_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Severity_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Severity_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Severity_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Message_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("type", Value.P_Type); Serialize (Into, "severity", Value.Severity); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("message", Value.Message); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Message_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Message_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "type", Value.P_Type); Deserialize (Object, "severity", Value.Severity); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "message", Value.Message); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Message_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Message_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("type", Value.P_Type); Into.Write_Entity ("title", Value.Title); Serialize (Into, "status", Value.Status); Into.Write_Entity ("traceId", Value.Trace_Id); Into.Write_Entity ("errors", Value.Errors); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in ValidationError_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "type", Value.P_Type); Swagger.Streams.Deserialize (Object, "title", Value.Title); Swagger.Streams.Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "traceId", Value.Trace_Id); Swagger.Streams.Deserialize (Object, "errors", Value.Errors); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out ValidationError_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : ValidationError_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdType_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdType_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdType_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdStatus_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdStatus_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdStatus_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelAllRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelAllRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderCancelAllRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderCancelSingleRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderCancelSingleRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderCancelSingleRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrdSide_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrdSide_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrdSide_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type) is begin Into.Start_Entity (Name); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in TimeInForce_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out TimeInForce_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : TimeInForce_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "amount_order", Value.Amount_Order); Serialize (Into, "price", Value.Price); Serialize (Into, "side", Value.Side); Serialize (Into, "order_type", Value.Order_Type); Serialize (Into, "time_in_force", Value.Time_In_Force); Serialize (Into, "expire_time", Value.Expire_Time); Serialize (Into, "exec_inst", Value.Exec_Inst); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderNewSingleRequest_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Swagger.Streams.Deserialize (Object, "amount_order", Value.Amount_Order); Swagger.Streams.Deserialize (Object, "price", Value.Price); Deserialize (Object, "side", Value.Side); Deserialize (Object, "order_type", Value.Order_Type); Deserialize (Object, "time_in_force", Value.Time_In_Force); Swagger.Streams.Deserialize (Object, "expire_time", Value.Expire_Time); Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderNewSingleRequest_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderNewSingleRequest_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type) is begin Into.Start_Entity (Name); Serialize (Into, "time", Value.Time); Serialize (Into, "price", Value.Price); Serialize (Into, "amount", Value.Amount); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Fills_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "time", Value.Time); Swagger.Streams.Deserialize (Object, "price", Value.Price); Swagger.Streams.Deserialize (Object, "amount", Value.Amount); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Fills_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Fills_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Into.Write_Entity ("client_order_id", Value.Client_Order_Id); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "amount_order", Value.Amount_Order); Serialize (Into, "price", Value.Price); Serialize (Into, "side", Value.Side); Serialize (Into, "order_type", Value.Order_Type); Serialize (Into, "time_in_force", Value.Time_In_Force); Serialize (Into, "expire_time", Value.Expire_Time); Serialize (Into, "exec_inst", Value.Exec_Inst); Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Serialize (Into, "amount_open", Value.Amount_Open); Serialize (Into, "amount_filled", Value.Amount_Filled); Serialize (Into, "avg_px", Value.Avg_Px); Serialize (Into, "status", Value.Status); Serialize (Into, "status_history", Value.Status_History); Into.Write_Entity ("error_message", Value.Error_Message); Serialize (Into, "fills", Value.Fills); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReport_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Swagger.Streams.Deserialize (Object, "client_order_id", Value.Client_Order_Id); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Swagger.Streams.Deserialize (Object, "amount_order", Value.Amount_Order); Swagger.Streams.Deserialize (Object, "price", Value.Price); Deserialize (Object, "side", Value.Side); Deserialize (Object, "order_type", Value.Order_Type); Deserialize (Object, "time_in_force", Value.Time_In_Force); Swagger.Streams.Deserialize (Object, "expire_time", Value.Expire_Time); Swagger.Streams.Deserialize (Object, "exec_inst", Value.Exec_Inst); Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Swagger.Streams.Deserialize (Object, "amount_open", Value.Amount_Open); Swagger.Streams.Deserialize (Object, "amount_filled", Value.Amount_Filled); Swagger.Streams.Deserialize (Object, "avg_px", Value.Avg_Px); Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "status_history", Value.Status_History); Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message); Deserialize (Object, "fills", Value.Fills); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReport_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderExecutionReport_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Into.Write_Entity ("exchange_order_id", Value.Exchange_Order_Id); Serialize (Into, "amount_open", Value.Amount_Open); Serialize (Into, "amount_filled", Value.Amount_Filled); Serialize (Into, "avg_px", Value.Avg_Px); Serialize (Into, "status", Value.Status); Serialize (Into, "status_history", Value.Status_History); Into.Write_Entity ("error_message", Value.Error_Message); Serialize (Into, "fills", Value.Fills); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in OrderExecutionReportAllOf_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "client_order_id_format_exchange", Value.Client_Order_Id_Format_Exchange); Swagger.Streams.Deserialize (Object, "exchange_order_id", Value.Exchange_Order_Id); Swagger.Streams.Deserialize (Object, "amount_open", Value.Amount_Open); Swagger.Streams.Deserialize (Object, "amount_filled", Value.Amount_Filled); Swagger.Streams.Deserialize (Object, "avg_px", Value.Avg_Px); Deserialize (Object, "status", Value.Status); Swagger.Streams.Deserialize (Object, "status_history", Value.Status_History); Swagger.Streams.Deserialize (Object, "error_message", Value.Error_Message); Deserialize (Object, "fills", Value.Fills); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out OrderExecutionReportAllOf_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : OrderExecutionReportAllOf_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("asset_id_exchange", Value.Asset_Id_Exchange); Into.Write_Entity ("asset_id_coinapi", Value.Asset_Id_Coinapi); Serialize (Into, "balance", Value.Balance); Serialize (Into, "available", Value.Available); Serialize (Into, "locked", Value.Locked); Into.Write_Entity ("last_updated_by", Value.Last_Updated_By); Serialize (Into, "rate_usd", Value.Rate_Usd); Serialize (Into, "traded", Value.Traded); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in BalanceData_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "asset_id_exchange", Value.Asset_Id_Exchange); Swagger.Streams.Deserialize (Object, "asset_id_coinapi", Value.Asset_Id_Coinapi); Swagger.Streams.Deserialize (Object, "balance", Value.Balance); Swagger.Streams.Deserialize (Object, "available", Value.Available); Swagger.Streams.Deserialize (Object, "locked", Value.Locked); Swagger.Streams.Deserialize (Object, "last_updated_by", Value.Last_Updated_By); Swagger.Streams.Deserialize (Object, "rate_usd", Value.Rate_Usd); Swagger.Streams.Deserialize (Object, "traded", Value.Traded); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out BalanceData_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : BalanceData_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Serialize (Into, "data", Value.Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Balance_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Deserialize (Object, "data", Value.Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Balance_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Balance_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("exchange_id", Value.Exchange_Id); Serialize (Into, "data", Value.Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in Position_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "exchange_id", Value.Exchange_Id); Deserialize (Object, "data", Value.Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out Position_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : Position_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type) is begin Into.Start_Entity (Name); Into.Write_Entity ("symbol_id_exchange", Value.Symbol_Id_Exchange); Into.Write_Entity ("symbol_id_coinapi", Value.Symbol_Id_Coinapi); Serialize (Into, "avg_entry_price", Value.Avg_Entry_Price); Serialize (Into, "quantity", Value.Quantity); Serialize (Into, "side", Value.Side); Serialize (Into, "unrealized_pnl", Value.Unrealized_Pnl); Serialize (Into, "leverage", Value.Leverage); Into.Write_Entity ("cross_margin", Value.Cross_Margin); Serialize (Into, "liquidation_price", Value.Liquidation_Price); Into.Write_Entity ("raw_data", Value.Raw_Data); Into.End_Entity (Name); end Serialize; procedure Serialize (Into : in out Swagger.Streams.Output_Stream'Class; Name : in String; Value : in PositionData_Type_Vectors.Vector) is begin Into.Start_Array (Name); for Item of Value loop Serialize (Into, "", Item); end loop; Into.End_Array (Name); end Serialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type) is Object : Swagger.Value_Type; begin Swagger.Streams.Deserialize (From, Name, Object); Swagger.Streams.Deserialize (Object, "symbol_id_exchange", Value.Symbol_Id_Exchange); Swagger.Streams.Deserialize (Object, "symbol_id_coinapi", Value.Symbol_Id_Coinapi); Swagger.Streams.Deserialize (Object, "avg_entry_price", Value.Avg_Entry_Price); Swagger.Streams.Deserialize (Object, "quantity", Value.Quantity); Deserialize (Object, "side", Value.Side); Swagger.Streams.Deserialize (Object, "unrealized_pnl", Value.Unrealized_Pnl); Swagger.Streams.Deserialize (Object, "leverage", Value.Leverage); Swagger.Streams.Deserialize (Object, "cross_margin", Value.Cross_Margin); Swagger.Streams.Deserialize (Object, "liquidation_price", Value.Liquidation_Price); Deserialize (Object, "raw_data", Value.Raw_Data); end Deserialize; procedure Deserialize (From : in Swagger.Value_Type; Name : in String; Value : out PositionData_Type_Vectors.Vector) is List : Swagger.Value_Array_Type; Item : PositionData_Type; begin Value.Clear; Swagger.Streams.Deserialize (From, Name, List); for Data of List loop Deserialize (Data, "", Item); Value.Append (Item); end loop; end Deserialize; end .Models;
libass/x86/rasterizer.asm
enen92/libass
0
166083
;****************************************************************************** ;* rasterizer.asm: SSE2/AVX2 tile rasterization ;****************************************************************************** ;* Copyright (C) 2014 <NAME> <<EMAIL>> ;* ;* This file is part of libass. ;* ;* Permission to use, copy, modify, and distribute this software for any ;* purpose with or without fee is hereby granted, provided that the above ;* copyright notice and this permission notice appear in all copies. ;* ;* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ;* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ;* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ;* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ;* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ;* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ;* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ;****************************************************************************** %include "x86/utils.asm" SECTION_RODATA 32 words_index: dw 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F words_tile16: times 16 dw 1024 words_tile32: times 16 dw 512 SECTION .text ;------------------------------------------------------------------------------ ; FILL_LINE 1:dst, 2:m_src, 3:size ;------------------------------------------------------------------------------ %macro FILL_LINE 3 %if ((%3) & (mmsize - 1)) == 0 %assign %%i 0 %rep (%3) / mmsize mova [%1 + %%i], m%2 %assign %%i %%i + mmsize %endrep %elif (%3) == 16 mova [%1], xm%2 %else %error "invalid line size" %endif %endmacro ;------------------------------------------------------------------------------ ; FILL_SOLID_TILE 1:tile_order, 2:suffix ; void fill_solid_tile%2(uint8_t *buf, ptrdiff_t stride, int set); ;------------------------------------------------------------------------------ %macro FILL_SOLID_TILE 2 cglobal fill_solid_tile%2, 3,4,1 mov r3d, -1 test r2d, r2d cmovnz r2d, r3d movd xm0, r2d %if mmsize == 32 vpbroadcastd m0, xm0 %else pshufd m0, m0, q0000 %endif %rep (1 << %1) - 1 FILL_LINE r0, 0, 1 << %1 add r0, r1 %endrep FILL_LINE r0, 0, 1 << %1 RET %endmacro INIT_XMM sse2 FILL_SOLID_TILE 4,16 FILL_SOLID_TILE 5,32 INIT_YMM avx2 FILL_SOLID_TILE 4,16 FILL_SOLID_TILE 5,32 ;------------------------------------------------------------------------------ ; CALC_LINE 1:tile_order, 2:m_dst, 3:m_src, 4:m_delta, ; 5:m_zero, 6:m_full, 7:m_tmp ; Calculate line using antialiased halfplane algorithm ;------------------------------------------------------------------------------ %macro CALC_LINE 7 paddw m%7, m%3, m%4 pmaxsw m%2, m%3, m%5 pmaxsw m%7, m%5 pminsw m%2, m%6 pminsw m%7, m%6 paddw m%2, m%7 psraw m%2, 7 - %1 %endmacro ;------------------------------------------------------------------------------ ; DEF_A_SHIFT 1:tile_order ; If single mm-register is enough to store the whole line ; then sets a_shift = 0, ; else sets a_shift = log2(mmsize / sizeof(int16_t)). ;------------------------------------------------------------------------------ %macro DEF_A_SHIFT 1 %if mmsize >= (2 << %1) %define a_shift 0 %elif mmsize == 32 %define a_shift 4 %elif mmsize == 16 %define a_shift 3 %else %error "invalid mmsize" %endif %endmacro ;------------------------------------------------------------------------------ ; FILL_HALFPLANE_TILE 1:tile_order, 2:suffix ; void fill_halfplane_tile%2(uint8_t *buf, ptrdiff_t stride, ; int32_t a, int32_t b, int64_t c, int32_t scale); ;------------------------------------------------------------------------------ %macro FILL_HALFPLANE_TILE 2 DEF_A_SHIFT %1 %if ARCH_X86_64 && a_shift cglobal fill_halfplane_tile%2, 6,7,9 %else cglobal fill_halfplane_tile%2, 6,7,8 %endif %if a_shift == 0 SWAP 3, 8 %endif %if ARCH_X86_64 movsxd r2, r2d ; a movsxd r3, r3d ; b sar r4, 7 + %1 ; c >> (tile_order + 7) movsxd r5, r5d ; scale mov r6, 1 << (45 + %1) imul r2, r5 add r2, r6 sar r2, 46 + %1 ; aa imul r3, r5 add r3, r6 sar r3, 46 + %1 ; bb imul r4, r5 shr r6, 1 + %1 add r4, r6 sar r4, 45 ; cc %else mov r0d, r4m ; c_lo mov r2d, r5m ; c_hi mov r1d, r6m ; scale mov r5d, 1 << 12 shr r0d, 7 + %1 shl r2d, 25 - %1 or r0d, r2d ; r0d (eax) = c >> (tile_order + 7) imul r1d ; r2d (edx) = (c >> ...) * scale >> 32 add r2d, r5d sar r2d, 13 mov r4d, r2d ; cc shl r5d, 1 + %1 mov r0d, r3m ; r0d (eax) = b imul r1d ; r2d (edx) = b * scale >> 32 add r2d, r5d sar r2d, 14 + %1 mov r3d, r2d ; bb mov r0d, r2m ; r0d (eax) = a imul r1d ; r2d (edx) = a * scale >> 32 add r2d, r5d sar r2d, 14 + %1 ; aa mov r0d, r0m mov r1d, r1m %endif add r4d, 1 << (13 - %1) mov r6d, r2d add r6d, r3d sar r6d, 1 sub r4d, r6d BCASTW 1, r4d ; cc BCASTW 2, r2d ; aa %if a_shift psllw m3, m2, a_shift ; aa * (mmsize / 2) %endif pmullw m2, [words_index] psubw m1, m2 ; cc - aa * i mov r4d, r2d ; aa mov r6d, r4d sar r6d, 31 xor r4d, r6d sub r4d, r6d ; abs_a mov r5d, r3d ; bb mov r6d, r5d sar r6d, 31 xor r5d, r6d sub r5d, r6d ; abs_b cmp r4d, r5d cmovg r4d, r5d add r4d, 2 sar r4d, 2 ; delta BCASTW 2, r4d psubw m1, m2 ; c1 = cc - aa * i - delta paddw m2, m2 ; 2 * delta %if a_shift MUL r2d, (1 << %1) - (mmsize / 2) sub r3d, r2d ; bb - (tile_size - mmsize / 2) * aa %endif %if ARCH_X86_64 || a_shift == 0 BCASTW 8, r3d %endif pxor m0, m0 mova m4, [words_tile%2] mov r2d, (1 << %1) jmp .loop_entry .loop_start: add r0, r1 %if ARCH_X86_64 || a_shift == 0 psubw m1, m8 %else BCASTW 7, r3d psubw m1, m7 %endif .loop_entry: %assign i 0 %rep (1 << %1) / mmsize %if i psubw m1, m3 %endif CALC_LINE %1, 5, 1,2, 0,4, 7 psubw m1, m3 CALC_LINE %1, 6, 1,2, 0,4, 7 packuswb m5, m6 %if mmsize == 32 vpermq m5, m5, q3120 %endif mova [r0 + i], m5 %assign i i + mmsize %endrep %if (1 << %1) < mmsize CALC_LINE %1, 5, 1,2, 0,4, 7 packuswb m5, m6 vpermq m5, m5, q3120 mova [r0 + i], xm5 %endif sub r2d,1 jnz .loop_start RET %endmacro INIT_XMM sse2 FILL_HALFPLANE_TILE 4,16 FILL_HALFPLANE_TILE 5,32 INIT_YMM avx2 FILL_HALFPLANE_TILE 4,16 FILL_HALFPLANE_TILE 5,32 ;------------------------------------------------------------------------------ ; struct segment { ; int64_t c; ; int32_t a, b, scale, flags; ; int32_t x_min, x_max, y_min, y_max; ; }; ;------------------------------------------------------------------------------ struc line .c: resq 1 .a: resd 1 .b: resd 1 .scale: resd 1 .flags: resd 1 .x_min: resd 1 .x_max: resd 1 .y_min: resd 1 .y_max: resd 1 endstruc ;------------------------------------------------------------------------------ ; ZEROFILL 1:dst, 2:size, 3:tmp ;------------------------------------------------------------------------------ %macro ZEROFILL 3 %assign %%n 128 / mmsize mov %3, (%2) / 128 %%zerofill_loop: %assign %%i 0 %rep %%n mova [%1 + %%i], mm_zero %assign %%i %%i + mmsize %endrep add %1, 128 sub %3, 1 jnz %%zerofill_loop %assign %%i 0 %rep ((%2) / mmsize) & (%%n - 1) mova [%1 + %%i], mm_zero %assign %%i %%i + mmsize %endrep %endmacro ;------------------------------------------------------------------------------ ; CALC_DELTA_FLAG 1:res, 2:line, 3-4:tmp ; Set bits of result register (res): ; bit 3 - for nonzero up_delta, ; bit 2 - for nonzero dn_delta. ;------------------------------------------------------------------------------ %macro CALC_DELTA_FLAG 4 mov %3d, [%2 + line.flags] xor %4d, %4d cmp %4d, [%2 + line.x_min] cmovz %4d, %3d xor %1d, %1d test %3d, 2 ; SEGFLAG_UL_DR cmovnz %1d, %4d shl %3d, 2 xor %1d, %3d and %4d, 4 and %1d, 4 lea %1d, [%1d + 2 * %1d] xor %1d, %4d %endmacro ;------------------------------------------------------------------------------ ; UPDATE_DELTA 1:dn/up, 2:dst, 3:flag, 4:pos, 5:tmp ; Update delta array ;------------------------------------------------------------------------------ %macro UPDATE_DELTA 5 %ifidn %1, dn %define %%op add %define %%opi sub %assign %%flag 1 << 2 %elifidn %1, up %define %%op sub %define %%opi add %assign %%flag 1 << 3 %else %error "dn/up expected" %endif test %3d, %%flag jz %%skip lea %5d, [4 * %4d - 256] %%opi [%2], %5w lea %5d, [4 * %4d] %%op [%2 + 2], %5w %%skip: %endmacro ;------------------------------------------------------------------------------ ; CALC_VBA 1:tile_order, 2:b ; Calculate b - (tile_size - (mmsize / sizeof(int16_t))) * a ;------------------------------------------------------------------------------ %macro CALC_VBA 2 BCASTW m_vba, %2d %rep (2 << %1) / mmsize - 1 psubw mm_vba, mm_van %endrep %endmacro ;------------------------------------------------------------------------------ ; FILL_BORDER_LINE 1:tile_order, 2:res, 3:abs_a[abs_ab], 4:b, 5:[abs_b], ; 6:size, 7:sum, 8-9:tmp, 10-14:m_tmp, 15:[m_tmp] ; Render top/bottom line of the trapezium with antialiasing ;------------------------------------------------------------------------------ %macro FILL_BORDER_LINE 15 mov %8d, %6d shl %8d, 8 - %1 ; size << (8 - tile_order) xor %9d, %9d %if ARCH_X86_64 sub %8d, %3d ; abs_a cmovg %8d, %9d add %8d, 1 << (14 - %1) shl %8d, 2 * %1 - 5 ; w BCASTW %15, %8d mov %9d, %5d ; abs_b imul %9d, %6d sar %9d, 6 ; dc_b cmp %9d, %3d ; abs_a cmovg %9d, %3d %else sub %8w, %3w ; abs_a cmovg %8d, %9d add %8w, 1 << (14 - %1) shl %8d, 2 * %1 - 5 ; w mov %9d, %3d ; abs_ab shr %9d, 16 ; abs_b imul %9d, %6d sar %9d, 6 ; dc_b cmp %9w, %3w cmovg %9w, %3w %endif add %9d, 2 sar %9d, 2 ; dc imul %7d, %4d ; sum * b sar %7d, 7 ; avg * b add %7d, %9d ; avg * b + dc add %9d, %9d ; 2 * dc imul %7d, %8d sar %7d, 16 sub %7d, %6d ; -offs1 BCASTW %10, %7d imul %9d, %8d sar %9d, 16 ; offs2 - offs1 BCASTW %11, %9d add %6d, %6d BCASTW %12, %6d %assign %%i 0 %rep (2 << %1) / mmsize %if %%i psubw mm_c, mm_van %endif %if ARCH_X86_64 pmulhw m%13, mm_c, m%15 %else BCASTW %14, %8d pmulhw m%13, mm_c, m%14 %endif psubw m%13, m%10 ; c1 paddw m%14, m%13, m%11 ; c2 pmaxsw m%13, mm_zero pmaxsw m%14, mm_zero pminsw m%13, m%12 pminsw m%14, m%12 paddw m%13, m%14 paddw m%13, [%2 + %%i] mova [%2 + %%i], m%13 %assign %%i %%i + mmsize %endrep %endmacro ;------------------------------------------------------------------------------ ; SAVE_RESULT 1:tile_order, 2:buf, 3:stride, 4:src, 5:delta, ; 6-7:tmp, 8-11:m_tmp ; Convert and store internal buffer (with delta array) in the result buffer ;------------------------------------------------------------------------------ %macro SAVE_RESULT 11 mov %6d, 1 << %1 xor %7d, %7d %%save_loop: add %7w, [%5] BCASTW %10, %7d add %5, 2 %assign %%i 0 %rep (1 << %1) / mmsize paddw m%8, m%10, [%4 + 2 * %%i] PABSW %8, %11 paddw m%9, m%10, [%4 + 2 * %%i + mmsize] PABSW %9, %11 packuswb m%8, m%9 %if mmsize == 32 vpermq m%8, m%8, q3120 %endif mova [%2 + %%i], m%8 %assign %%i %%i + mmsize %endrep %if (1 << %1) < mmsize paddw m%8, m%10, [%4 + 2 * %%i] PABSW %8, %11 packuswb m%8, m%8 vpermq m%8, m%8, q3120 mova [%2 + %%i], xm%8 %endif add %2, %3 add %4, 2 << %1 sub %6d, 1 jnz %%save_loop %endmacro ;------------------------------------------------------------------------------ ; GET_RES_ADDR 1:dst ; CALC_RES_ADDR 1:tile_order, 2:dst/index, 3:tmp, 4:[skip_calc] ; Calculate position of line in the internal buffer ;------------------------------------------------------------------------------ %macro GET_RES_ADDR 1 %if mmsize <= STACK_ALIGNMENT mov %1, rstk %else lea %1, [rstk + mmsize - 1] and %1, ~(mmsize - 1) %endif %endmacro %macro CALC_RES_ADDR 3-4 noskip shl %2d, 1 + %1 %if mmsize <= STACK_ALIGNMENT add %2, rstk %else %ifidn %4, noskip lea %3, [rstk + mmsize - 1] and %3, ~(mmsize - 1) %endif add %2, %3 %endif %endmacro ;------------------------------------------------------------------------------ ; FILL_GENERIC_TILE 1:tile_order, 2:suffix ; void fill_generic_tile%2(uint8_t *buf, ptrdiff_t stride, ; const struct segment *line, size_t n_lines, ; int winding); ;------------------------------------------------------------------------------ %macro FILL_GENERIC_TILE 2 ; t3=line t4=up/cur t5=dn/end t6=dn_pos t7=up_pos ; t8=a/abs_a/abs_ab t9=b t10=c/abs_b %if ARCH_X86_64 DECLARE_REG_TMP 10,11,5,2, 4,9,6,7, 8,12,13 %else DECLARE_REG_TMP 0,1,5,3, 4,6,6,0, 2,3,5 %endif %assign tile_size 1 << %1 %assign delta_offs 2 * tile_size * tile_size %assign alloc_size 2 * tile_size * (tile_size + 1) + 4 %assign buf_size 2 * tile_size * (tile_size + 1) DEF_A_SHIFT %1 %if ARCH_X86_64 %define m_zero 6 %define m_full 7 %define mm_index m8 %define m_c 9 %define m_vba 10 %if a_shift %define m_van 11 cglobal fill_generic_tile%2, 5,14,12 %else cglobal fill_generic_tile%2, 5,14,11 %endif %else %define m_zero 5 %define m_full 4 ; tmp %define mm_index [words_index] %define m_c 7 %if a_shift %define m_van 6 %define m_vba 3 ; tmp %else %define m_vba 6 %endif %assign alloc_size alloc_size + 8 cglobal fill_generic_tile%2, 0,7,8 %endif %define mm_zero m %+ m_zero %define mm_full m %+ m_full %define mm_c m %+ m_c %define mm_vba m %+ m_vba %if a_shift %define mm_van m %+ m_van %endif %if mmsize <= STACK_ALIGNMENT %assign alloc_size alloc_size + stack_offset + gprsize + (mmsize - 1) %assign alloc_size (alloc_size & ~(mmsize - 1)) - stack_offset - gprsize %else %assign alloc_size alloc_size + 2 * mmsize %assign delta_offs delta_offs + mmsize %assign buf_size buf_size + mmsize %endif SUB rstk, alloc_size GET_RES_ADDR t0 pxor mm_zero, mm_zero ZEROFILL t0, buf_size, t1 %if ARCH_X86_64 == 0 mov r4d, r4m %endif shl r4d, 8 mov [rstk + delta_offs], r4w %if ARCH_X86_64 mova mm_index, [words_index] mova mm_full, [words_tile%2] %define dn_addr t5 %else %define dn_addr [rstk + delta_offs + 2 * tile_size + 4] %define dn_pos [rstk + delta_offs + 2 * tile_size + 8] %endif .line_loop: %if ARCH_X86_64 == 0 mov t3, r2m lea t0, [t3 + line_size] mov r2m, t0 %endif CALC_DELTA_FLAG t0, t3, t1,t2 mov t4d, [t3 + line.y_min] mov t2d, [t3 + line.y_max] %if ARCH_X86_64 mov t8d, t4d mov t6d, t4d and t6d, 63 ; up_pos shr t4d, 6 ; up mov t5d, t2d mov t7d, t2d and t7d, 63 ; dn_pos shr t5d, 6 ; dn UPDATE_DELTA up, rstk + 2 * t4 + delta_offs, t0,t6, t1 UPDATE_DELTA dn, rstk + 2 * t5 + delta_offs, t0,t7, t1 cmp t8d, t2d %else lea t1d, [t0d + 1] cmp t4d, t2d cmovnz t0d, t1d ; bit 0 -- not horz line mov t6d, t2d and t6d, 63 ; dn_pos shr t2d, 6 ; dn UPDATE_DELTA dn, rstk + 2 * t2 + delta_offs, t0,t6, t1 CALC_RES_ADDR %1, t2, t1 mov dn_addr, t2 mov dn_pos, t6d mov t6d, t4d and t6d, 63 ; up_pos shr t4d, 6 ; up UPDATE_DELTA up, rstk + 2 * t4 + delta_offs, t0,t6, t1 test t0d, 1 %endif jz .end_line_loop %if ARCH_X86_64 movsxd t8, dword [t3 + line.a] movsxd t9, dword [t3 + line.b] mov t10, [t3 + line.c] sar t10, 7 + %1 ; c >> (tile_order + 7) movsxd t0, dword [t3 + line.scale] mov t1, 1 << (45 + %1) imul t8, t0 add t8, t1 sar t8, 46 + %1 ; a imul t9, t0 add t9, t1 sar t9, 46 + %1 ; b imul t10, t0 shr t1, 1 + %1 add t10, t1 sar t10, 45 ; c %else mov r0d, [t3 + line.c] mov r2d, [t3 + line.c + 4] mov r1d, [t3 + line.scale] shr r0d, 7 + %1 shl r2d, 25 - %1 or r0d, r2d ; r0d (eax) = c >> (tile_order + 7) imul r1d ; r2d (edx) = (c >> ...) * scale >> 32 add r2d, 1 << 12 sar r2d, 13 mov t10d, r2d ; c mov r0d, [t3 + line.b] ; r0d (eax) imul r1d ; r2d (edx) = b * scale >> 32 add r2d, 1 << (13 + %1) sar r2d, 14 + %1 mov r0d, [t3 + line.a] ; r0d (eax) mov t9d, r2d ; b (overrides t3) imul r1d ; r2d (edx) = a * scale >> 32 add r2d, 1 << (13 + %1) sar r2d, 14 + %1 ; a (t8d) %endif mov t0d, t8d ; a sar t0d, 1 sub t10d, t0d mov t0d, t9d ; b imul t0d, t4d sub t10d, t0d BCASTW m_c, t10d BCASTW 0, t8d %if a_shift psllw mm_van, m0, a_shift ; a * (mmsize / 2) %endif pmullw m0, mm_index psubw mm_c, m0 ; c - a * i mov t0d, t8d ; a sar t0d, 31 xor t8d, t0d sub t8d, t0d ; abs_a mov t0d, t9d ; b mov t10d, t9d sar t0d, 31 xor t10d, t0d sub t10d, t0d ; abs_b %if ARCH_X86_64 == 0 shl t10d, 16 or t8d, t10d ; abs_ab %endif CALC_RES_ADDR %1, t4, t0 %if ARCH_X86_64 CALC_RES_ADDR %1, t5, t0, skip %endif cmp t4, dn_addr jz .single_line %if ARCH_X86_64 || a_shift == 0 CALC_VBA %1, t9 %endif test t6d, t6d jz .generic_fist mov t2d, 64 sub t2d, t6d ; 64 - up_pos add t6d, 64 ; 64 + up_pos FILL_BORDER_LINE %1, t4,t8,t9,t10,t2,t6, t0,t1, 0,1,2,3,4,5 %if ARCH_X86_64 == 0 mov t5, dn_addr %if a_shift CALC_VBA %1, t9 %endif %endif psubw mm_c, mm_vba add t4, 2 << %1 cmp t4, t5 jge .end_loop %if ARCH_X86_64 == 0 jmp .bulk_fill %endif .generic_fist: %if ARCH_X86_64 == 0 mov t5, dn_addr %if a_shift CALC_VBA %1, t9 %endif %endif .bulk_fill: mov t2d, 1 << (13 - %1) mov t0d, t9d ; b sar t0d, 1 sub t2d, t0d ; base %if ARCH_X86_64 mov t0d, t10d ; abs_b cmp t0d, t8d ; abs_a cmovg t0d, t8d %else mov t0d, t8d ; abs_ab shr t0d, 16 ; abs_b cmp t0w, t8w cmovg t0w, t8w %endif add t0d, 2 sar t0d, 2 ; dc %if ARCH_X86_64 sub t2d, t0d ; base - dc %else sub t2w, t0w ; base - dc %endif add t0d, t0d ; 2 * dc BCASTW 2, t0d %if ARCH_X86_64 BCASTW 3, t2d paddw mm_c, m3 %else BCASTW 0, t2d paddw mm_c, m0 mova mm_full, [words_tile%2] %endif .internal_loop: %assign i 0 %rep (2 << %1) / mmsize %if i psubw mm_c, mm_van %endif CALC_LINE %1, 0, m_c,2, m_zero,m_full, 1 paddw m0, [t4 + i] mova [t4 + i], m0 %assign i i + mmsize %endrep psubw mm_c, mm_vba add t4, 2 << %1 cmp t4, t5 jl .internal_loop %if ARCH_X86_64 psubw mm_c, m3 %else BCASTW 0, t2d psubw mm_c, m0 %endif .end_loop: %if ARCH_X86_64 test t7d, t7d jz .end_line_loop xor t6d, t6d %else mov t2d, dn_pos test t2d, t2d jz .end_line_loop mov t6d, t2d jmp .last_line %endif .single_line: %if ARCH_X86_64 == 0 mov t7d, dn_pos %endif mov t2d, t7d sub t2d, t6d ; dn_pos - up_pos add t6d, t7d ; dn_pos + up_pos .last_line: FILL_BORDER_LINE %1, t4,t8,t9,t10,t2,t6, t0,t1, 0,1,2,3,4,5 .end_line_loop: %if ARCH_X86_64 add r2, line_size sub r3, 1 %else sub dword r3m, 1 %endif jnz .line_loop %if ARCH_X86_64 == 0 mov r0, r0m mov r1, r1m %endif GET_RES_ADDR r2 lea r3, [rstk + delta_offs] SAVE_RESULT %1, r0,r1,r2,r3, r4,t2, 0,1,2,3 ADD rstk, alloc_size RET %endmacro INIT_XMM sse2 FILL_GENERIC_TILE 4,16 FILL_GENERIC_TILE 5,32 INIT_YMM avx2 FILL_GENERIC_TILE 4,16 FILL_GENERIC_TILE 5,32
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/array6.adb
best08618/asylo
7
27189
-- { dg-do run } with Interfaces; use Interfaces; procedure Array6 is type buf_t is array (unsigned_32 range <>) of character; type v_str_t (first, last : unsigned_32) is record buf : buf_t (first .. last) := (others => ' '); end record; type v_str_ptr_t is access all v_str_t; v_str : v_str_ptr_t; function build_v_str (f, l : unsigned_32) return v_str_ptr_t is vp : v_str_ptr_t := new v_str_t (f, l); begin return vp; end; begin v_str := build_v_str (unsigned_32'last/2 - 256, unsigned_32'last/2 + 1024*1024); end;
CompStats_Statistics.adb
salmoni/CompStats_Statistics_Ada
0
10716
with Ada.Numerics.Elementary_Functions; Package body CompStats_Statistics is function Get_Count (Values: Values_Array) return Integer is Count: Integer; -- Stores final count begin Count := Values'Length; return Count; end Get_Count; -------------------------------------------------------------- function Get_Minimum (Values: Values_Array) return Float is Count: Integer; -- Length of array Minimum: Float; -- Stores minimum begin Count := Get_Count(Values); Minimum := Values(1); for index in Integer range 2 .. Count loop if Values(index) < Minimum then Minimum := Values(index); end if; end loop; return Minimum; end Get_Minimum; -------------------------------------------------------------- function Get_Maximum (Values: Values_Array) return Float is Count: Integer; -- Length of array Maximum: Float; -- Stores maximum begin Count := Get_Count(Values); Maximum := Values(1); for index in Integer range 2 .. Count loop if Values(index) > Maximum then Maximum := Values(index); end if; end loop; return Maximum; end Get_Maximum; -------------------------------------------------------------- function Get_Range (Values: Values_Array) return Float is CS_Range: Float; -- Stores range Minimum: Float; Maximum: Float; begin Minimum := Get_Minimum(Values); Maximum := Get_Maximum(Values); CS_Range := Maximum - Minimum; return CS_Range; end Get_Range; -------------------------------------------------------------- function Get_Sum (Values: Values_Array) return Float is Sum: Float; Count: Integer; begin Count := Get_Count(values); if count = 0 then return 0.0; -- should throw an error end if; Sum := 0.0; for index in Integer range 1 .. Count loop Sum := Sum + Values(index); end loop; return Sum; end Get_Sum; -------------------------------------------------------------- function Get_Mean (Values: Values_Array) return Float is Mean: Float; Sum: Float; Count: Integer; begin Count := Get_Count(values); if count = 0 then return 0.0; -- should throw an error end if; Sum := Get_Sum(Values); Mean := Sum / Float(count); return Mean; end Get_Mean; -------------------------------------------------------------- function Get_Sum_Of_Squares (Values: Values_Array) return Float is SS: Float; Mean:Float; Difference: Float; Count : Integer; begin SS := 0.0; Count := Get_Count(values); if count = 0 then return 0.0; -- should throw an error end if; Mean := Get_Mean(Values); for index in Integer range 1 .. Count loop Difference := Values(index) - Mean; SS := SS + (Difference * Difference); end loop; return SS; end Get_Sum_Of_Squares; -------------------------------------------------------------- function Get_Population_Variance (Values: Values_Array) return Float is Population_Variance : Float; Count : Integer; begin Count := Get_Count (values); if count = 0 then return 0.0; -- should throw an error end if; Population_Variance := Get_Sum_Of_Squares(Values) / Float(Count); return Population_Variance; end Get_Population_Variance; -------------------------------------------------------------- function Get_Sample_Variance (Values: Values_Array) return Float is Sample_Variance : Float; Count : Integer; begin Count := Get_Count (values); if count = 0 then return 0.0; -- should throw an error end if; Sample_Variance := Get_Sum_Of_Squares(Values) / Float(Count - 1); return Sample_Variance; end Get_Sample_Variance; -------------------------------------------------------------- function Get_Population_Standard_Deviation (Values: Values_Array) return Float is Population_Standard_Deviation : Float; Population_Variance : Float; Count : Integer; begin Count := Get_Count (values); if count = 0 then return 0.0; -- should throw an error end if; Population_Variance := Get_Population_Variance(Values); Population_Standard_Deviation := Ada.Numerics.Elementary_Functions.Sqrt(Population_Variance); return Population_Variance; end Get_Population_Standard_Deviation; -------------------------------------------------------------- function Get_Sample_Standard_Deviation (Values: Values_Array) return Float is Sample_Standard_Deviation : Float; Sample_Variance : Float; Count : Integer; begin Count := Get_Count (values); if count = 0 then return 0.0; -- should throw an error end if; Sample_Variance := Get_Sample_Variance(Values); Sample_Standard_Deviation := Ada.Numerics.Elementary_Functions.Sqrt(Sample_Variance); return Sample_Standard_Deviation; end Get_Sample_Standard_Deviation; -------------------------------------------------------------- function Get_Standard_Error_of_Mean (Values : Values_Array) return Float is Standard_Error : Float; Count : Integer; begin Count := Get_Count(Values); if count = 0 then return 0.0; -- should throw an error end if; Standard_Error := Get_Sample_Standard_Deviation(Values) / Ada.Numerics.Elementary_Functions.Sqrt(Float(Count)); return Standard_Error; end Get_Standard_Error_of_Mean; -------------------------------------------------------------- function Get_Coefficient_Of_Variation (Values : Values_Array) return Float is Sample_Standard_Deviation : Float; Mean : Float; Count : Integer; begin Count := Get_Count(Values); if Count = 0 then return 0.0; -- should throw an error end if; Sample_Standard_Deviation := Get_Sample_Standard_Deviation (Values); Mean := Get_Mean (Values); if Mean /= 0.0 then return Sample_Standard_Deviation / Mean; else return 0.0; end if; end Get_Coefficient_Of_Variation; -------------------------------------------------------------- function Is_Value_In_Array (Values : Values_Array; Value : Float) return Boolean is Count : Integer; begin Count := Get_Count(Values); if Count = 0 then return FALSE; -- should throw an error end if; for index in Integer range 1..Count loop if Values(index) = Value then return True; end if; end loop; return false; end Is_Value_In_Array; -------------------------------------------------------------- function Get_Unique_Values (Values : Values_Array) return Values_Array is Count : INTEGER; Index : INTEGER; Value : FLOAT; Matched : BOOLEAN; Initial_Array : Values_Array (Integer range 1..Values'Length); begin Count := Get_Count(Values); Index := 2; Initial_Array(1) := Values(1); for idx in Integer range 2..Count loop Value := Values(idx); Matched := False; for idy in Integer range 1..Index loop if Value = Initial_Array(idy) then Matched := True; exit; end if; end loop; if Matched = False then Initial_Array(Index) := Value; Index := Index + 1; end if; end loop; Index := Index - 1; -- Return array up to Index return Initial_Array(1..Index); end Get_Unique_Values; -------------------------------------------------------------- -------------------------------------------------------------- end CompStats_Statistics;
MSDOS/Virus.MSDOS.Unknown.pme-gen.asm
fengjixuchui/Family
3
13661
<reponame>fengjixuchui/Family ; Phantasie Mutation Engine --- DEMO ; This program will generate 50 mutation programs. ; (C) Copyright 1995 Written by Burglar. All Rights Reserved. ; Made In Taiwan. .MODEL TINY .CODE ORG 100H EXTRN PME:NEAR, PME_END:NEAR ;must declare PME to external module. BEGIN: MOV DX,OFFSET GEN_MSG MOV AH,9 INT 21H MOV CX,50 GEN: PUSH CX MOV DX,OFFSET FILENAME PUSH CS POP DS XOR CX,CX MOV AH,3CH INT 21H PUSH AX MOV DX,OFFSET PROG ;DS:DX point to the head of program which you ;want to be mutation. MOV CX,OFFSET PROG_END - OFFSET PROG ;CX hold the length of the ;program which you want to ;be mutation. MOV BX,100H ;BX sets the beginning offset when execution. PUSH SS POP AX ADD AX,1000H MOV ES,AX ;ES point to a work segment. ;for putting decryption routine + encrypted code. ;just need the length of origin program + 512 bytes. CALL PME ;OK! when every thing is okay, you can call the PME. ;When PME execute over, it will return : ;DS:DX -> decryption routine + encrypted code. ;CX -> length of the decryption routine + encrypted ;code. (always origin length + 512 bytes) POP BX MOV AH,40H INT 21H MOV AH,3EH INT 21H MOV BX,OFFSET FILENAME INC BYTE PTR CS:BX+7 CMP BYTE PTR CS:BX+7,'9' JBE L0 MOV BYTE PTR CS:BX+7,'0' INC BYTE PTR CS:BX+6 L0: POP CX LOOP GEN INT 20H FILENAME DB '00000000.COM',0 GEN_MSG DB 'Generating 50 mutation programs... $' PROG: CALL $+3 POP DX ADD DX,OFFSET MSG - OFFSET PROG - 3 MOV AH,9 INT 21H INT 20H MSG DB 'I am a mutation program.$' PROG_END: END BEGIN 
Transynther/x86/_processed/NONE/_xt_/i7-7700_9_0xca_notsx.log_21829_248.asm
ljhsiun2/medusa
9
85810
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r14 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x1b9d7, %r8 nop dec %rbp mov $0x6162636465666768, %r11 movq %r11, %xmm4 vmovups %ymm4, (%r8) nop nop nop nop nop xor %r8, %r8 lea addresses_WC_ht+0xced7, %r8 nop nop nop nop nop sub $4111, %r14 mov (%r8), %rdx inc %r8 lea addresses_normal_ht+0xfa57, %r11 nop sub %r9, %r9 mov (%r11), %edx and $30847, %rdx lea addresses_A_ht+0x18957, %rsi lea addresses_WT_ht+0x91d7, %rdi nop nop nop xor $44226, %r11 mov $47, %rcx rep movsl add %r8, %r8 lea addresses_WC_ht+0xd657, %rsi lea addresses_D_ht+0x11c17, %rdi cmp %rdx, %rdx mov $119, %rcx rep movsb nop cmp %rsi, %rsi lea addresses_normal_ht+0x93d7, %rbp cmp $44153, %rcx mov $0x6162636465666768, %r8 movq %r8, %xmm5 and $0xffffffffffffffc0, %rbp vmovaps %ymm5, (%rbp) nop nop nop nop nop add $16942, %r9 lea addresses_WC_ht+0x19987, %r8 nop nop nop nop nop cmp %rbp, %rbp and $0xffffffffffffffc0, %r8 vmovntdqa (%r8), %ymm1 vextracti128 $0, %ymm1, %xmm1 vpextrq $0, %xmm1, %r11 nop nop nop nop nop sub $50760, %rdi lea addresses_normal_ht+0x8de2, %rsi lea addresses_UC_ht+0x1477, %rdi nop sub $6961, %rdx mov $110, %rcx rep movsw nop nop nop nop nop dec %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r14 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r8 push %r9 push %rdi push %rdx // Faulty Load lea addresses_WC+0x14ed7, %r8 nop nop nop and $63016, %rdx movb (%r8), %r9b lea oracles, %r8 and $0xff, %r9 shlq $12, %r9 mov (%r8,%r9,1), %r9 pop %rdx pop %rdi pop %r9 pop %r8 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 0, 'same': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'NT': False, 'AVXalign': False, 'size': 1, 'congruent': 0, 'same': True, 'type': 'addresses_WC'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'NT': False, 'AVXalign': False, 'size': 32, 'congruent': 5, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'STOR'} {'src': {'NT': False, 'AVXalign': False, 'size': 8, 'congruent': 11, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'NT': False, 'AVXalign': False, 'size': 4, 'congruent': 5, 'same': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 7, 'same': False, 'type': 'addresses_A_ht'}, 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM'} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_WC_ht'}, 'dst': {'congruent': 6, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM'} {'dst': {'NT': False, 'AVXalign': True, 'size': 32, 'congruent': 7, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'STOR'} {'src': {'NT': True, 'AVXalign': False, 'size': 32, 'congruent': 3, 'same': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_normal_ht'}, 'dst': {'congruent': 3, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM'} {'38': 21829} 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 38 */
libsrc/stdio/ace/fputc_cons.asm
jpoikela/z88dk
640
89388
; ; Jupiter ACE Routines ; ; Print character to the screen ; ; $Id: fputc_cons.asm,v 1.5 2016-05-15 20:15:45 dom Exp $ ; SECTION code_clib PUBLIC fputc_cons_native ; ; Entry: char to print ; .fputc_cons_native ld hl,2 add hl,sp ld a,(hl) ; Now A contains the char to be printed IF STANDARDESCAPECHARS cp 13 ret z ; ignore CR cp 10 ; LF - map to CR jr nz,nolf ld a,13 ENDIF .nolf cp 12 ; CLS jp z,$a24 cp 8 ; BACKSPACE jr nz,nobs ld hl,$3C1C dec (hl) ret .nobs jp $3ff
msx/apps/romflash/flashloader.asm
zoggins/yellow-msx-series-for-rc2014
19
95510
PUBLIC _flashLoader ; extern void flashLoader(); _flashLoader: LD DE, 0C000H LD HL, ROM_FLASH_WRITER LD BC, ROM_FLASH_WRITER_LENGTH LDIR JP 0C000H ROM_FLASH_WRITER: include "../bin/romflashwriter/romflashwriter.inc" ROM_FLASH_WRITER_LENGTH EQU $-ROM_FLASH_WRITER
oeis/094/A094826.asm
neoneye/loda-programs
11
104692
<reponame>neoneye/loda-programs ; A094826: Number of (s(0), s(1), ..., s(2n)) such that 0 < s(i) < 9 and |s(i) - s(i-1)| = 1 for i = 1,2,....,2n, s(0) = 1, s(2n) = 3. ; Submitted by <NAME> ; 1,3,9,28,90,297,1000,3417,11799,41041,143472,503262,1769365,6230304,21960801,77461435,273351705,964918116,3406804786,12029917377,42483179304,150036624217,529901048943,1871559855009,6610286313784,23347580236566,82464464450349,291268850886784,1028780505504129,3633727839494067,12834611338314025,45332897979941676,160119613674317898,565556211564746329,1997593644299558568,7055675575388952345,24921266865202433287,88024114657013587185,310908961730648575872,1098158005335971603854,3878791491097006027461 mov $1,$0 mul $1,2 add $1,1 seq $1,214699 ; a(n) = 3*a(n-2) - a(n-3) with a(0)=0, a(1)=3, a(2)=0. mov $0,$1 div $0,3
examples/Example.agda
L-TChen/agda-bench
13
10713
module Example where open import Agda.Builtin.Nat open import Agda.Builtin.List open import Agda.Builtin.Equality downFrom : Nat → List Nat downFrom zero = [] downFrom (suc n) = n ∷ downFrom n sum-rec : List Nat → Nat sum-rec [] = 0 sum-rec (x ∷ xs) = x + sum-rec xs sum-acc : Nat → List Nat → Nat sum-acc z [] = z sum-acc z (x ∷ xs) = sum-acc (z + x) xs sum-acc! : Nat → List Nat → Nat sum-acc! z [] = z sum-acc! 0 (x ∷ xs) = sum-acc! x xs sum-acc! z (x ∷ xs) = sum-acc! (z + x) xs n = 10000 bench-rec = sum-rec (downFrom n) bench-acc = sum-acc 0 (downFrom n) bench-acc! = sum-acc! 0 (downFrom n)
Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_1617.asm
ljhsiun2/medusa
9
90559
<filename>Transynther/x86/_processed/AVXALIGN/_st_/i7-7700_9_0xca.log_21829_1617.asm .global s_prepare_buffers s_prepare_buffers: push %r11 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_WT_ht+0xbcd8, %r11 nop dec %rsi mov $0x6162636465666768, %r9 movq %r9, %xmm0 movups %xmm0, (%r11) xor $32333, %r15 lea addresses_WT_ht+0x36d8, %rsi lea addresses_WC_ht+0x19ad8, %rdi nop xor $55682, %r11 mov $76, %rcx rep movsb nop inc %r9 lea addresses_normal_ht+0x71e8, %rsi lea addresses_WC_ht+0x1cb48, %rdi nop nop nop sub $1897, %rbp mov $16, %rcx rep movsl nop nop nop inc %rcx lea addresses_WT_ht+0x9ed8, %r15 nop nop nop nop inc %rdi movb $0x61, (%r15) nop nop nop nop nop sub $53063, %rbp lea addresses_normal_ht+0x2898, %rsi lea addresses_UC_ht+0x120d8, %rdi cmp $29157, %r8 mov $11, %rcx rep movsl nop nop nop and $9581, %rsi lea addresses_A_ht+0x102d8, %rsi lea addresses_UC_ht+0x172d8, %rdi and %rbp, %rbp mov $58, %rcx rep movsl nop nop nop add %rcx, %rcx lea addresses_normal_ht+0xb6d8, %r15 nop nop nop nop and %rsi, %rsi movb (%r15), %cl nop cmp %rsi, %rsi lea addresses_A_ht+0x19ad8, %rbp nop nop nop cmp %r9, %r9 mov $0x6162636465666768, %r8 movq %r8, %xmm7 movups %xmm7, (%rbp) nop add %rbp, %rbp lea addresses_WC_ht+0x258, %r15 nop nop nop sub %rsi, %rsi mov (%r15), %cx nop nop nop add $37085, %rsi lea addresses_A_ht+0x1c518, %rcx nop add %rbp, %rbp mov (%rcx), %r9 nop nop nop nop nop inc %r15 lea addresses_A_ht+0x12d8, %r11 nop nop nop nop nop xor %rdi, %rdi movups (%r11), %xmm6 vpextrq $1, %xmm6, %r8 nop nop nop nop nop add %r8, %r8 lea addresses_normal_ht+0x16a98, %rsi nop nop nop nop cmp $17845, %r11 movb $0x61, (%rsi) nop nop nop nop and $18617, %rcx lea addresses_D_ht+0x138d8, %r15 nop sub $44656, %r9 movb $0x61, (%r15) nop nop nop add $18647, %rcx pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r11 ret .global s_faulty_load s_faulty_load: push %r13 push %r14 push %r15 push %r9 push %rbp push %rdi push %rsi // Store lea addresses_UC+0x10ae, %rdi nop nop nop nop add %r9, %r9 mov $0x5152535455565758, %r15 movq %r15, %xmm6 movups %xmm6, (%rdi) nop nop inc %r15 // Faulty Load lea addresses_RW+0x1aed8, %r13 nop nop xor %rbp, %rbp movb (%r13), %r15b lea oracles, %r13 and $0xff, %r15 shlq $12, %r15 mov (%r13,%r15,1), %r15 pop %rsi pop %rdi pop %rbp pop %r9 pop %r15 pop %r14 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_UC'}} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': True, 'same': True, 'size': 1, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 11, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': True, 'type': 'addresses_WC_ht'}} {'src': {'congruent': 3, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': False, 'type': 'addresses_WC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 9, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 4, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 9, 'same': False, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 10, 'same': True, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'congruent': 10, 'same': True, 'type': 'addresses_UC_ht'}} {'src': {'congruent': 11, 'AVXalign': False, 'same': False, 'size': 1, 'NT': True, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_WC_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 8, 'NT': True, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_A_ht'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_D_ht'}} {'32': 21829} 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 */
programs/oeis/230/A230405.asm
neoneye/loda
22
174360
; A230405: a(n) = A000217(A230404(n+1)); the first differences of A219650. ; 1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,10,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1,1,3,1,1,3,1,1,6,1,1,3,1 seq $0,230404 ; a(n) = the largest k such that (k+1)! divides 2n; the number of trailing zeros in the factorial base representation of even numbers. add $0,1 bin $0,2
programs/oeis/070/A070446.asm
karttu/loda
1
175162
<reponame>karttu/loda ; A070446: a(n) = n^2 mod 24. ; 0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9,4,1,0,1,4,9,16,1,12,1,16,9 pow $0,2 mod $0,24 mov $1,$0
Transynther/x86/_processed/NONE/_ht_/i9-9900K_12_0xa0.log_21829_603.asm
ljhsiun2/medusa
9
8192
.global s_prepare_buffers s_prepare_buffers: push %r14 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rsi lea addresses_D_ht+0x1b787, %rsi lea addresses_WT_ht+0xb7c3, %rdi nop add $57156, %rbp mov $51, %rcx rep movsw nop nop cmp $24317, %r8 lea addresses_UC_ht+0x17953, %r9 nop nop nop nop nop cmp $60804, %rcx mov $0x6162636465666768, %rsi movq %rsi, %xmm5 movups %xmm5, (%r9) nop nop nop nop nop and $39267, %rdi lea addresses_WC_ht+0x435c, %rdi nop nop nop nop cmp %r14, %r14 movw $0x6162, (%rdi) xor $29492, %r14 lea addresses_A_ht+0x1d3b3, %rsi lea addresses_A_ht+0x10143, %rdi nop cmp $44922, %r8 mov $89, %rcx rep movsq nop nop nop sub $12384, %r8 lea addresses_WT_ht+0x14203, %r14 clflush (%r14) nop sub $62978, %rsi mov $0x6162636465666768, %rcx movq %rcx, %xmm1 movups %xmm1, (%r14) nop cmp $64817, %rsi lea addresses_normal_ht+0x9bd7, %rsi nop nop nop nop add %r8, %r8 movw $0x6162, (%rsi) nop nop and $5270, %rsi lea addresses_UC_ht+0xb3e3, %rbp inc %rsi movw $0x6162, (%rbp) nop nop xor %rcx, %rcx lea addresses_A_ht+0x1b783, %rcx nop nop nop nop nop cmp $59156, %r9 mov (%rcx), %rdi nop nop nop nop nop sub $54041, %r8 lea addresses_A_ht+0x19ed3, %rsi lea addresses_D_ht+0x1bd03, %rdi nop nop nop nop nop inc %r9 mov $92, %rcx rep movsq nop nop nop nop nop and $2921, %rdi lea addresses_WT_ht+0x9530, %r14 and $37656, %rcx mov (%r14), %r8d nop xor %rsi, %rsi lea addresses_A_ht+0x3bc3, %rsi lea addresses_D_ht+0x1c85d, %rdi add %r14, %r14 mov $59, %rcx rep movsq inc %rsi lea addresses_WT_ht+0x1e14f, %r9 nop nop nop nop and $41812, %rdi mov $0x6162636465666768, %r14 movq %r14, %xmm1 vmovups %ymm1, (%r9) nop nop dec %rcx lea addresses_normal_ht+0x14fc3, %r8 nop nop nop nop nop inc %r9 mov $0x6162636465666768, %rsi movq %rsi, %xmm6 movups %xmm6, (%r8) xor %r9, %r9 lea addresses_WT_ht+0x370f, %rsi lea addresses_normal_ht+0x14003, %rdi nop nop nop nop cmp $13232, %r15 mov $78, %rcx rep movsw nop nop nop nop cmp %r8, %r8 lea addresses_WT_ht+0x900b, %r9 nop xor %rcx, %rcx mov (%r9), %r15 nop nop nop and %r14, %r14 pop %rsi pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r14 ret .global s_faulty_load s_faulty_load: push %r11 push %r15 push %r9 push %rbx push %rcx push %rdi push %rdx // Store lea addresses_A+0xa979, %rdx nop lfence movl $0x51525354, (%rdx) nop nop nop xor $49088, %r9 // Store mov $0x19c3700000000703, %rbx nop nop add $14874, %rcx movb $0x51, (%rbx) nop inc %rcx // Load lea addresses_WC+0x10d03, %rdi nop nop nop inc %r11 mov (%rdi), %rdx nop nop nop nop nop and %rbx, %rbx // Store lea addresses_RW+0xd743, %rbx xor $38166, %rcx movl $0x51525354, (%rbx) dec %rdx // Faulty Load lea addresses_WC+0x10d03, %rdi cmp $27916, %r15 movups (%rdi), %xmm5 vpextrq $1, %xmm5, %r11 lea oracles, %rcx and $0xff, %r11 shlq $12, %r11 mov (%rcx,%r11,1), %r11 pop %rdx pop %rdi pop %rcx pop %rbx pop %r9 pop %r15 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_A', 'AVXalign': False, 'size': 4}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_NC', 'AVXalign': False, 'size': 1}} {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_RW', 'AVXalign': False, 'size': 4}} [Faulty Load] {'src': {'NT': False, 'same': True, 'congruent': 0, 'type': 'addresses_WC', 'AVXalign': False, 'size': 16}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'same': False, 'congruent': 0, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 0, 'type': 'addresses_WT_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WC_ht', 'AVXalign': False, 'size': 2}} {'src': {'same': False, 'congruent': 4, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 5, 'type': 'addresses_A_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 16}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 2, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 2}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_UC_ht', 'AVXalign': False, 'size': 2}} {'src': {'NT': False, 'same': False, 'congruent': 4, 'type': 'addresses_A_ht', 'AVXalign': True, 'size': 8}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 3, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 11, 'type': 'addresses_D_ht'}} {'src': {'NT': False, 'same': False, 'congruent': 0, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 4}, 'OP': 'LOAD'} {'src': {'same': False, 'congruent': 6, 'type': 'addresses_A_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 1, 'type': 'addresses_D_ht'}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 1, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 32}} {'OP': 'STOR', 'dst': {'NT': False, 'same': False, 'congruent': 6, 'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16}} {'src': {'same': True, 'congruent': 1, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'same': False, 'congruent': 6, 'type': 'addresses_normal_ht'}} {'src': {'NT': True, 'same': False, 'congruent': 3, 'type': 'addresses_WT_ht', 'AVXalign': False, 'size': 8}, 'OP': 'LOAD'} {'46': 99, '49': 1, '45': 21729} 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 46 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 */
src/spdx-licenses.adb
Fabien-Chouteau/spdx_ada
0
9310
<reponame>Fabien-Chouteau/spdx_ada package body SPDX.Licenses is -------------- -- Valid_Id -- -------------- function Valid_Id (Str : String) return Boolean is begin return (for some I in Id => Str = Img (I)); end Valid_Id; ------------- -- From_Id -- ------------- function From_Id (Str : String) return Id is begin for I in Id loop if Str = Img (I) then return I; end if; end loop; raise Program_Error; end From_Id; end SPDX.Licenses;
src/Prelude/Sum.agda
t-more/agda-prelude
111
11730
module Prelude.Sum where open import Agda.Primitive open import Prelude.Empty open import Prelude.Unit open import Prelude.List open import Prelude.Functor open import Prelude.Applicative open import Prelude.Monad open import Prelude.Equality open import Prelude.Decidable open import Prelude.Product open import Prelude.Function data Either {a b} (A : Set a) (B : Set b) : Set (a ⊔ b) where left : A → Either A B right : B → Either A B {-# FOREIGN GHC type AgdaEither a b = Either #-} {-# COMPILE GHC Either = data MAlonzo.Code.Prelude.Sum.AgdaEither (Left | Right) #-} either : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → (A → C) → (B → C) → Either A B → C either f g (left x) = f x either f g (right x) = g x lefts : ∀ {a b} {A : Set a} {B : Set b} → List (Either A B) → List A lefts = concatMap λ { (left x) → [ x ]; (right _) → [] } rights : ∀ {a b} {A : Set a} {B : Set b} → List (Either A B) → List B rights = concatMap λ { (left _) → []; (right x) → [ x ] } mapEither : ∀ {a₁ a₂ b₁ b₂} {A₁ : Set a₁} {A₂ : Set a₂} {B₁ : Set b₁} {B₂ : Set b₂} → (A₁ → A₂) → (B₁ → B₂) → Either A₁ B₁ → Either A₂ B₂ mapEither f g = either (left ∘ f) (right ∘ g) mapLeft : ∀ {a₁ a₂ b} {A₁ : Set a₁} {A₂ : Set a₂} {B : Set b} → (A₁ → A₂) → Either A₁ B → Either A₂ B mapLeft f = either (left ∘ f) right mapRight : ∀ {a b₁ b₂} {A : Set a} {B₁ : Set b₁} {B₂ : Set b₂} → (B₁ → B₂) → Either A B₁ → Either A B₂ mapRight f = either left (right ∘ f) partitionMap : ∀ {a b c} {A : Set a} {B : Set b} {C : Set c} → (A → Either B C) → List A → List B × List C partitionMap f [] = [] , [] partitionMap f (x ∷ xs) = either (first ∘ _∷_) (λ y → second (_∷_ y)) -- second ∘ _∷_ doesn't work for some reason (f x) (partitionMap f xs) --- Equality --- left-inj : ∀ {a} {A : Set a} {x y : A} {b} {B : Set b} → left {B = B} x ≡ left y → x ≡ y left-inj refl = refl right-inj : ∀ {b} {B : Set b} {x y : B} {a} {A : Set a} → right {A = A} x ≡ right y → x ≡ y right-inj refl = refl private eqEither : ∀ {a b} {A : Set a} {B : Set b} {{EqA : Eq A}} {{EqB : Eq B}} (x y : Either A B) → Dec (x ≡ y) eqEither (left x) (right y) = no (λ ()) eqEither (right x) (left y) = no (λ ()) eqEither (left x) (left y) with x == y ... | yes eq = yes (left $≡ eq) ... | no neq = no λ eq → neq (left-inj eq) eqEither (right x) (right y) with x == y ... | yes eq = yes (right $≡ eq) ... | no neq = no λ eq → neq (right-inj eq) instance EqEither : ∀ {a b} {A : Set a} {B : Set b} {{EqA : Eq A}} {{EqB : Eq B}} → Eq (Either A B) _==_ {{EqEither}} = eqEither --- Monad instance --- module _ {a b} {A : Set a} where instance FunctorEither : Functor (Either {b = b} A) fmap {{FunctorEither}} f (left x) = left x fmap {{FunctorEither}} f (right x) = right (f x) ApplicativeEither : Applicative (Either {b = b} A) pure {{ApplicativeEither}} = right _<*>_ {{ApplicativeEither}} (right f) (right x) = right (f x) _<*>_ {{ApplicativeEither}} (right _) (left e) = left e _<*>_ {{ApplicativeEither}} (left e) _ = left e MonadEither : Monad (Either {b = b} A) _>>=_ {{MonadEither}} m f = either left f m
programs/oeis/277/A277644.asm
karttu/loda
0
3140
; A277644: Beatty sequence for sqrt(6)/2. ; 1,2,3,4,6,7,8,9,11,12,13,14,15,17,18,19,20,22,23,24,25,26,28,29,30,31,33,34,35,36,37,39,40,41,42,44,45,46,47,48,50,51,52,53,55,56,57,58,60,61,62,63,64,66,67,68,69,71,72,73,74,75,77,78,79,80,82,83,84,85,86,88,89,90,91,93,94,95,96,97,99,100,101,102,104,105,106,107,109,110,111,112,113,115,116,117,118,120,121,122,123,124,126,127,128,129,131,132,133,134,135,137,138,139,140,142,143,144,145,146,148,149,150,151,153,154,155,156,157,159,160,161,162,164,165,166,167,169,170,171,172,173,175,176,177,178,180,181,182,183,184,186,187,188,189,191,192,193,194,195,197,198,199,200,202,203,204,205,206,208,209,210,211,213,214,215,216,218,219,220,221,222,224,225,226,227,229,230,231,232,233,235,236,237,238,240,241,242,243,244,246,247,248,249,251,252,253,254,255,257,258,259,260,262,263,264,265,266,268,269,270,271,273,274,275,276,278,279,280,281,282,284,285,286,287,289,290,291,292,293,295,296,297,298,300,301,302,303,304,306 mov $4,$0 add $4,1 mov $9,$0 lpb $4,1 mov $0,$9 sub $4,1 sub $0,$4 mov $5,$0 mov $7,2 lpb $7,1 mov $0,$5 sub $7,1 add $0,$7 sub $0,1 mov $3,$0 mov $0,0 add $0,$3 add $0,1 mul $0,20 div $0,89 mov $2,4 mul $2,$0 mov $8,$7 mov $10,$2 lpb $8,1 mov $6,$10 sub $8,1 lpe lpe lpb $5,1 mov $5,0 sub $6,$10 lpe mov $10,$6 div $10,4 add $10,1 add $1,$10 lpe
4-high/gel/source/forge/gel-forge.ads
charlie5/lace
20
6877
with gel.Applet.gui_world, gel.Applet.gui_and_sim_world, gel.Sprite, gel.World, Physics, openGL.Primitive, openGL.Font, openGL.Palette; package gel.Forge -- -- Provides utility constructor functions for various GEL classes. -- is ----------- --- Applets -- function new_gui_Applet (Named : in String; window_Width : in Positive := 500; window_Height : in Positive := 500; space_Kind : in physics.space_Kind := physics.Bullet) return gel.Applet.gui_world.view; function new_gui_and_sim_Applet (Named : in String; window_Width : in Positive := 500; window_Height : in Positive := 500; space_Kind : in physics.space_Kind := physics.Bullet) return gel.Applet.gui_and_sim_World.view; ----------- --- Sprites -- -- 2D -- function new_circle_Sprite (in_World : in gel.World.view; Site : in math.Vector_2 := math.Origin_2D; Mass : in math.Real := 1.0; Friction : in math.Real := 0.5; Bounce : in math.Real := 0.5; Radius : in math.Real := 0.5; Color : in openGL.Color := opengl.Palette.White; Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; function new_polygon_Sprite (in_World : in gel.World.view; Site : in math.Vector_2 := math.Origin_2D; Mass : in math.Real := 1.0; Friction : in math.Real := 0.5; Bounce : in math.Real := 0.5; Vertices : in Geometry_2d.Sites; Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view; function new_rectangle_Sprite (in_World : in gel.World.view; Site : in math.Vector_2 := math.Origin_2D; Mass : in math.Real := 1.0; Friction : in math.Real := 0.5; Bounce : in math.Real := 0.5; Width, Height : in math.Real; Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view; -- 3D -- function new_ball_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 1.0; Radius : in math.Real := 0.5; Color : in openGL.Color := opengl.Palette.White) return gel.Sprite.view; subtype box_Colors is openGL.Colors (1 .. 6); function new_box_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 1.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Colors : in box_Colors := (others => opengl.Palette.random_Color); is_Kinematic : in Boolean := False) return gel.Sprite.view; function new_box_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 1.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name) return gel.Sprite.view; function new_billboard_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 1.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; function new_billboard_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Color : in openGL.lucid_Color; Mass : in math.Real := 1.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name := openGL.null_Asset) return gel.Sprite.view; function new_arrow_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 0.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name := openGL.null_Asset; Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; function new_line_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 0.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name := openGL.null_Asset; Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; function new_segment_line_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Mass : in math.Real := 0.0; Size : in math.Vector_3 := (1.0, 1.0, 1.0); Texture : in openGL.asset_Name := openGL.null_Asset; Color : in openGL.lucid_Color := (openGL.Palette.Black, openGL.Opaque); line_Width : in openGL.Real := openGL.Primitive.unused_line_Width) return gel.Sprite.view; -- Text -- function new_text_Sprite (in_World : in gel.World.view; Site : in math.Vector_3 := math.Origin_3D; Text : in String; Font : in openGL.Font.font_Id; Color : in openGL.Color := opengl.Palette.Black; Scale : in math.Vector_3 := (1.0, 1.0, 1.0); Centered : in Boolean := True) return gel.Sprite.view; end gel.Forge;
Transynther/x86/_processed/NONE/_zr_/i7-7700_9_0xca.log_17601_986.asm
ljhsiun2/medusa
9
243344
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r12 push %r8 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0x8698, %rsi lea addresses_UC_ht+0x144a8, %rdi nop nop nop nop nop inc %rbx mov $120, %rcx rep movsl nop nop nop nop nop inc %r12 lea addresses_D_ht+0x3398, %r8 nop nop add %rcx, %rcx movl $0x61626364, (%r8) nop nop nop nop nop cmp $48698, %rbx lea addresses_UC_ht+0x11538, %rsi lea addresses_A_ht+0x4e16, %rdi nop cmp %r12, %r12 mov $119, %rcx rep movsb nop and $3903, %rdi lea addresses_normal_ht+0x1d558, %rbx nop inc %rax mov (%rbx), %si nop inc %r8 lea addresses_normal_ht+0x10ed8, %rsi lea addresses_WT_ht+0x5b98, %rdi nop nop nop nop cmp %r11, %r11 mov $62, %rcx rep movsl nop nop nop nop inc %rdi lea addresses_WT_ht+0xf4c2, %rsi lea addresses_normal_ht+0x1d26c, %rdi nop nop nop sub $29928, %rax mov $90, %rcx rep movsq nop nop xor %rsi, %rsi lea addresses_normal_ht+0x10f38, %rsi nop nop xor $27218, %r12 movw $0x6162, (%rsi) nop xor %r11, %r11 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r12 pop %r11 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r15 push %r9 push %rax push %rbx push %rsi // Load lea addresses_normal+0xfa8, %r11 nop nop nop nop nop and %r15, %r15 movups (%r11), %xmm4 vpextrq $1, %xmm4, %rax nop nop nop nop nop dec %r11 // Store lea addresses_A+0xa9f8, %rsi nop add $63336, %rbx movb $0x51, (%rsi) nop nop nop nop nop xor %r11, %r11 // Store lea addresses_RW+0x10198, %r11 nop add $63630, %r10 mov $0x5152535455565758, %rbx movq %rbx, %xmm5 movups %xmm5, (%r11) nop nop inc %r15 // Load lea addresses_WT+0x9598, %rbx clflush (%rbx) nop nop nop nop and $59, %r10 vmovups (%rbx), %ymm2 vextracti128 $0, %ymm2, %xmm2 vpextrq $1, %xmm2, %r9 nop add %rbx, %rbx // Faulty Load lea addresses_RW+0x10198, %rsi nop nop nop inc %r10 movups (%rsi), %xmm5 vpextrq $1, %xmm5, %r15 lea oracles, %r9 and $0xff, %r15 shlq $12, %r15 mov (%r9,%r15,1), %r15 pop %rsi pop %rbx pop %rax pop %r9 pop %r15 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'src': {'congruent': 0, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} {'src': {'congruent': 4, 'AVXalign': False, 'same': False, 'size': 16, 'NT': False, 'type': 'addresses_normal'}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 1, 'NT': False, 'type': 'addresses_A'}} {'OP': 'STOR', 'dst': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_RW'}} {'src': {'congruent': 10, 'AVXalign': False, 'same': False, 'size': 32, 'NT': False, 'type': 'addresses_WT'}, 'OP': 'LOAD'} [Faulty Load] {'src': {'congruent': 0, 'AVXalign': False, 'same': True, 'size': 16, 'NT': False, 'type': 'addresses_RW'}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'congruent': 4, 'same': False, 'type': 'addresses_D_ht'}, 'OP': 'REPM', 'dst': {'congruent': 4, 'same': True, 'type': 'addresses_UC_ht'}} {'OP': 'STOR', 'dst': {'congruent': 7, 'AVXalign': False, 'same': False, 'size': 4, 'NT': False, 'type': 'addresses_D_ht'}} {'src': {'congruent': 5, 'same': False, 'type': 'addresses_UC_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_A_ht'}} {'src': {'congruent': 6, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}, 'OP': 'LOAD'} {'src': {'congruent': 6, 'same': False, 'type': 'addresses_normal_ht'}, 'OP': 'REPM', 'dst': {'congruent': 8, 'same': False, 'type': 'addresses_WT_ht'}} {'src': {'congruent': 0, 'same': False, 'type': 'addresses_WT_ht'}, 'OP': 'REPM', 'dst': {'congruent': 1, 'same': False, 'type': 'addresses_normal_ht'}} {'OP': 'STOR', 'dst': {'congruent': 5, 'AVXalign': False, 'same': False, 'size': 2, 'NT': False, 'type': 'addresses_normal_ht'}} {'00': 17601} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
src/base/properties/util-properties.ads
RREE/ada-util
60
13348
<gh_stars>10-100 ----------------------------------------------------------------------- -- util-properties -- Generic name/value property management -- Copyright (C) 2001 - 2020 <NAME> -- Written by <NAME> (<EMAIL>) -- -- Licensed under the Apache License, Version 2.0 (the "License"); -- you may not use this file except in compliance with the License. -- You may obtain a copy of the License at -- -- http://www.apache.org/licenses/LICENSE-2.0 -- -- Unless required by applicable law or agreed to in writing, software -- distributed under the License is distributed on an "AS IS" BASIS, -- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -- See the License for the specific language governing permissions and -- limitations under the License. ----------------------------------------------------------------------- with Ada.Strings.Unbounded; with Ada.Finalization; with Ada.Text_IO; with Util.Beans.Objects; with Util.Beans.Basic; with Util.Strings.Vectors; private with Util.Concurrent.Counters; -- = Property Files = -- The `Util.Properties` package and children implements support to read, write and use -- property files either in the Java property file format or the Windows INI configuration file. -- Each property is assigned a key and a value. The list of properties are stored in the -- `Util.Properties.Manager` tagged record and they are indexed by the key name. A property -- is therefore unique in the list. Properties can be grouped together in sub-properties so -- that a key can represent another list of properties. To use the packages described here, -- use the following GNAT project: -- -- with "utilada_base"; -- -- == File formats == -- The property file consists of a simple name and value pair separated by the `=` sign. -- Thanks to the Windows INI file format, list of properties can be grouped together -- in sections by using the `[section-name]` notation. -- -- test.count=20 -- test.repeat=5 -- [FileTest] -- test.count=5 -- test.repeat=2 -- -- == Using property files == -- An instance of the `Util.Properties.Manager` tagged record must be declared and it provides -- various operations that can be used. When created, the property manager is empty. One way -- to fill it is by using the `Load_Properties` procedure to read the property file. Another -- way is by using the `Set` procedure to insert or change a property by giving its name -- and its value. -- -- In this example, the property file `test.properties` is loaded and assuming that it contains -- the above configuration example, the `Get ("test.count")` will return the string `"20"`. -- The property `test.repeat` is then modified to have the value `"23"` and the properties are -- then saved in the file. -- -- with Util.Properties; -- ... -- Props : Util.Properties.Manager; -- ... -- Props.Load_Properties (Path => "test.properties"); -- Ada.Text_IO.Put_Line ("Count: " & Props.Get ("test.count"); -- Props.Set ("test.repeat", "23"); -- Props.Save_Properties (Path => "test.properties"); -- -- To be able to access a section from the property manager, it is necessary to retrieve it -- by using the `Get` function and giving the section name. For example, to retrieve the -- `test.count` property of the `FileTest` section, the following code is used: -- -- FileTest : Util.Properties.Manager := Props.Get ("FileTest"); -- ... -- Ada.Text_IO.Put_Line ("[FileTest] Count: " -- & FileTest.Get ("test.count"); -- -- When getting or removing a property, the `NO_PROPERTY` exception is raised if the property -- name was not found in the map. To avoid that exception, it is possible to check whether -- the name is known by using the `Exists` function. -- -- if Props.Exists ("test.old_count") then -- ... -- Property exist -- end if; -- -- @include util-properties-json.ads -- @include util-properties-bundles.ads -- -- == Advance usage of properties == -- The property manager holds the name and value pairs by using an Ada Bean object. -- -- It is possible to iterate over the properties by using the `Iterate` procedure that -- accepts as parameter a `Process` procedure that gets the property name as well as the -- property value. The value itself is passed as an `Util.Beans.Objects.Object` type. -- package Util.Properties is NO_PROPERTY : exception; use Ada.Strings.Unbounded; subtype Value is Util.Beans.Objects.Object; function "+" (S : String) return Unbounded_String renames To_Unbounded_String; function "-" (S : Unbounded_String) return String renames To_String; function To_String (V : in Value) return String renames Util.Beans.Objects.To_String; -- The manager holding the name/value pairs and providing the operations -- to get and set the properties. type Manager is new Ada.Finalization.Controlled and Util.Beans.Basic.Bean with private; type Manager_Access is access all Manager'Class; -- Get the value identified by the name. -- If the name cannot be found, the method should return the Null object. overriding function Get_Value (From : in Manager; Name : in String) return Util.Beans.Objects.Object; -- Set the value identified by the name. -- If the map contains the given name, the value changed. -- Otherwise name is added to the map and the value associated with it. overriding procedure Set_Value (From : in out Manager; Name : in String; Value : in Util.Beans.Objects.Object); -- Returns TRUE if the property manager is empty. function Is_Empty (Self : in Manager'Class) return Boolean; -- Returns TRUE if the property exists. function Exists (Self : in Manager'Class; Name : in Unbounded_String) return Boolean; -- Returns TRUE if the property exists. function Exists (Self : in Manager'Class; Name : in String) return Boolean; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in String) return String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in String) return Unbounded_String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in Unbounded_String) return Unbounded_String; -- Returns the property value. Raises an exception if not found. function Get (Self : in Manager'Class; Name : in Unbounded_String) return String; -- Returns the property value or Default if it does not exist. function Get (Self : in Manager'Class; Name : in String; Default : in String) return String; -- Returns a property manager that is associated with the given name. -- Raises NO_PROPERTY if there is no such property manager or if a property exists -- but is not a property manager. function Get (Self : in Manager'Class; Name : in String) return Manager; -- Create a property manager and associated it with the given name. function Create (Self : in out Manager'Class; Name : in String) return Manager; -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in String; Item : in String); -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in String; Item : in Unbounded_String); -- Set the value of the property. The property is created if it -- does not exists. procedure Set (Self : in out Manager'Class; Name : in Unbounded_String; Item : in Unbounded_String); -- Remove the property given its name. If the property does not -- exist, raises NO_PROPERTY exception. procedure Remove (Self : in out Manager'Class; Name : in String); -- Remove the property given its name. If the property does not -- exist, raises NO_PROPERTY exception. procedure Remove (Self : in out Manager'Class; Name : in Unbounded_String); -- Iterate over the properties and execute the given procedure passing the -- property name and its value. procedure Iterate (Self : in Manager'Class; Process : access procedure (Name : in String; Item : in Value)); -- Collect the name of the properties defined in the manager. -- When a prefix is specified, only the properties starting with the prefix are -- returned. procedure Get_Names (Self : in Manager; Into : in out Util.Strings.Vectors.Vector; Prefix : in String := ""); -- Load the properties from the file input stream. The file must follow -- the definition of Java property files. When a prefix is specified, keep -- only the properties that starts with the prefix. When <b>Strip</b> is True, -- the prefix part is removed from the property name. procedure Load_Properties (Self : in out Manager'Class; File : in Ada.Text_IO.File_Type; Prefix : in String := ""; Strip : in Boolean := False); -- Load the properties from the file. The file must follow the -- definition of Java property files. When a prefix is specified, keep -- only the properties that starts with the prefix. When <b>Strip</b> is True, -- the prefix part is removed from the property name. -- Raises NAME_ERROR if the file does not exist. procedure Load_Properties (Self : in out Manager'Class; Path : in String; Prefix : in String := ""; Strip : in Boolean := False); -- Save the properties in the given file path. procedure Save_Properties (Self : in out Manager'Class; Path : in String; Prefix : in String := ""); -- Copy the properties from FROM which start with a given prefix. -- If the prefix is empty, all properties are copied. When <b>Strip</b> is True, -- the prefix part is removed from the property name. procedure Copy (Self : in out Manager'Class; From : in Manager'Class; Prefix : in String := ""; Strip : in Boolean := False); -- Get the property manager represented by the item value. -- Raise the Conversion_Error exception if the value is not a property manager. function To_Manager (Item : in Value) return Manager; -- Returns True if the item value represents a property manager. function Is_Manager (Item : in Value) return Boolean; -- Abstract interface for the implementation of Properties -- (this allows to decouples the implementation from the API) package Implementation is type Manager is limited interface and Util.Beans.Basic.Bean; type Manager_Access is access all Manager'Class; -- Returns TRUE if the property exists. function Exists (Self : in Manager; Name : in String) return Boolean is abstract; -- Remove the property given its name. procedure Remove (Self : in out Manager; Name : in String) is abstract; -- Iterate over the properties and execute the given procedure passing the -- property name and its value. procedure Iterate (Self : in Manager; Process : access procedure (Name : in String; Item : in Value)) is abstract; -- Deep copy of properties stored in 'From' to 'To'. function Create_Copy (Self : in Manager) return Manager_Access is abstract; type Shared_Manager is limited interface and Manager; type Shared_Manager_Access is access all Shared_Manager'Class; function Is_Shared (Self : in Shared_Manager) return Boolean is abstract; procedure Set_Shared (Self : in out Shared_Manager; Shared : in Boolean) is abstract; procedure Adjust (Self : in out Shared_Manager) is abstract; procedure Finalize (Self : in out Shared_Manager; Release : out Boolean) is abstract; generic with function Allocator return Shared_Manager_Access; procedure Create (Self : in out Util.Properties.Manager'Class); generic with function Allocator return Shared_Manager_Access; procedure Initialize (Self : in out Util.Properties.Manager'Class); generic type Manager_Type is limited new Manager with private; package Shared_Implementation is type Manager is limited new Manager_Type and Shared_Manager with private; overriding function Is_Shared (Self : in Manager) return Boolean; overriding procedure Set_Shared (Self : in out Manager; Shared : in Boolean); overriding procedure Adjust (Self : in out Manager); overriding procedure Finalize (Self : in out Manager; Release : out Boolean); private type Manager is limited new Manager_Type and Shared_Manager with record Count : Util.Concurrent.Counters.Counter := Util.Concurrent.Counters.ONE; Shared : Boolean := False; end record; end Shared_Implementation; end Implementation; private type Manager is new Ada.Finalization.Controlled and Util.Beans.Basic.Bean with record Impl : Implementation.Shared_Manager_Access := null; end record; overriding procedure Adjust (Object : in out Manager); overriding procedure Finalize (Object : in out Manager); end Util.Properties;
engine/events/hidden_objects/school_blackboard.asm
opiter09/ASM-Machina
1
104722
<gh_stars>1-10 PrintBlackboardLinkCableText: call EnableAutoTextBoxDrawing ld a, $1 ld [wDoNotWaitForButtonPressAfterDisplayingText], a ld a, [wHiddenObjectFunctionArgument] call PrintPredefTextID ret LinkCableHelp:: text_asm call SaveScreenTilesToBuffer1 ld hl, LinkCableHelpText1 call PrintText xor a ld [wMenuItemOffset], a ; not used ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, 3 ld [wMaxMenuItem], a ld a, 2 ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a .linkHelpLoop ld hl, wd730 set 6, [hl] hlcoord 0, 0 ld b, 8 ld c, 13 call TextBoxBorder hlcoord 2, 2 ld de, HowToLinkText call PlaceString ld hl, LinkCableHelpText2 call PrintText call HandleMenuInput bit 1, a ; pressed b jr nz, .exit ld a, [wCurrentMenuItem] cp 3 ; pressed a on "STOP READING" jr z, .exit ld hl, wd730 res 6, [hl] ld hl, LinkCableInfoTexts add a ld d, 0 ld e, a add hl, de ld a, [hli] ld h, [hl] ld l, a call PrintText jp .linkHelpLoop .exit ld hl, wd730 res 6, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd LinkCableHelpText1: text_far _LinkCableHelpText1 text_end LinkCableHelpText2: text_far _LinkCableHelpText2 text_end HowToLinkText: db "HOW TO LINK" next "COLOSSEUM" next "TRADE CENTER" next "STOP READING@" LinkCableInfoTexts: dw LinkCableInfoText1 dw LinkCableInfoText2 dw LinkCableInfoText3 LinkCableInfoText1: text_far _LinkCableInfoText1 text_end LinkCableInfoText2: text_far _LinkCableInfoText2 text_end LinkCableInfoText3: text_far _LinkCableInfoText3 text_end ViridianSchoolBlackboard:: text_asm call SaveScreenTilesToBuffer1 ld hl, ViridianSchoolBlackboardText1 call PrintText xor a ld [wMenuItemOffset], a ld [wCurrentMenuItem], a ld [wLastMenuItem], a ld a, D_LEFT | D_RIGHT | A_BUTTON | B_BUTTON ld [wMenuWatchedKeys], a ld a, 2 ld [wMaxMenuItem], a ld a, 2 ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a .blackboardLoop ld hl, wd730 set 6, [hl] hlcoord 0, 0 lb bc, 6, 10 call TextBoxBorder hlcoord 1, 2 ld de, StatusAilmentText1 call PlaceString hlcoord 6, 2 ld de, StatusAilmentText2 call PlaceString ld hl, ViridianSchoolBlackboardText2 call PrintText call HandleMenuInput ; pressing up and down is handled in here bit 1, a ; pressed b jr nz, .exitBlackboard bit 4, a ; pressed right jr z, .didNotPressRight ; move cursor to right column ld a, 2 ld [wMaxMenuItem], a ld a, 2 ld [wTopMenuItemY], a ld a, 6 ld [wTopMenuItemX], a ld a, 3 ; in the the right column, use an offset to prevent overlap ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressRight bit 5, a ; pressed left jr z, .didNotPressLeftOrRight ; move cursor to left column ld a, 2 ld [wMaxMenuItem], a ld a, 2 ld [wTopMenuItemY], a ld a, 1 ld [wTopMenuItemX], a xor a ld [wMenuItemOffset], a jr .blackboardLoop .didNotPressLeftOrRight ld a, [wCurrentMenuItem] ld b, a ld a, [wMenuItemOffset] add b cp 5 ; cursor is pointing to "QUIT" jr z, .exitBlackboard ; we must have pressed a on a status condition ; so print the text ld hl, wd730 res 6, [hl] ld hl, ViridianBlackboardStatusPointers add a ld d, 0 ld e, a add hl, de ld a, [hli] ld h, [hl] ld l, a call PrintText jp .blackboardLoop .exitBlackboard ld hl, wd730 res 6, [hl] call LoadScreenTilesFromBuffer1 jp TextScriptEnd ViridianSchoolBlackboardText1: text_far _ViridianSchoolBlackboardText1 text_end ViridianSchoolBlackboardText2: text_far _ViridianSchoolBlackboardText2 text_end StatusAilmentText1: db " SLP" next " PSN" next " PAR@" StatusAilmentText2: db " BRN" next " FRZ" next " QUIT@" db "@" ; unused ViridianBlackboardStatusPointers: dw ViridianBlackboardSleepText dw ViridianBlackboardPoisonText dw ViridianBlackboardPrlzText dw ViridianBlackboardBurnText dw ViridianBlackboardFrozenText ViridianBlackboardSleepText: text_far _ViridianBlackboardSleepText text_end ViridianBlackboardPoisonText: text_far _ViridianBlackboardPoisonText text_end ViridianBlackboardPrlzText: text_far _ViridianBlackboardPrlzText text_end ViridianBlackboardBurnText: text_far _ViridianBlackboardBurnText text_end ViridianBlackboardFrozenText: text_far _ViridianBlackboardFrozenText text_end
ADL/drivers/stm32g474/stm32-rng.ads
JCGobbi/Nucleo-STM32G474RE
0
14049
<reponame>JCGobbi/Nucleo-STM32G474RE<gh_stars>0 ------------------------------------------------------------------------------ -- -- -- Copyright (C) 2015, AdaCore -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions are -- -- met: -- -- 1. Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- 2. Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in -- -- the documentation and/or other materials provided with the -- -- distribution. -- -- 3. Neither the name of STMicroelectronics nor the names of its -- -- contributors may be used to endorse or promote products derived -- -- from this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -- -- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -- -- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -- -- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -- -- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -- -- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- -- -- -- This file is based on: -- -- -- -- @file stm32f4xx_hal_rng.h -- -- @author MCD Application Team -- -- @version V1.1.0 -- -- @date 19-June-2014 -- -- @brief Header file of RNG HAL module. -- -- -- -- COPYRIGHT(c) 2014 STMicroelectronics -- ------------------------------------------------------------------------------ -- This file provides the API for the random number generator on the STM32F4 -- (ARM Cortex M4F) microcontrollers from ST Microelectronics. -- -- See the child packages for routines to initialze the generator and acquire -- numbers, using either polling or interrupts. with STM32_SVD.RNG; package STM32.RNG is type RNG_Generator is limited private; procedure Enable (This : in out RNG_Generator) with Post => Enabled (This); procedure Disable (This : in out RNG_Generator) with Post => not Enabled (This); function Enabled (This : RNG_Generator) return Boolean; procedure Enable_Interrupt (This : in out RNG_Generator) with Inline, Post => Interrupt_Enabled (This); procedure Disable_Interrupt (This : in out RNG_Generator) with Inline, Post => not Interrupt_Enabled (This); function Interrupt_Enabled (This : RNG_Generator) return Boolean; function Read_Data (This : RNG_Generator) return UInt32; type Status_Flag is (Data_Ready, Clock_Error, Seed_Error, Clock_Error_Interrupt, Seed_Error_Interrupt); subtype Clearable_Status_Flag is Status_Flag range Clock_Error_Interrupt .. Seed_Error_Interrupt; function Status (This : RNG_Generator; Flag : Status_Flag) return Boolean; procedure Clear_Interrupt_Pending (This : in out RNG_Generator; Flag : Clearable_Status_Flag) with Inline, Post => not Status (This, Flag); private type RNG_Generator is new STM32_SVD.RNG.RNG_Peripheral; end STM32.RNG;
ECE263/Labs/Lab2/L2main.asm
Reiuiji/UmassdPortfolio
3
174142
<filename>ECE263/Labs/Lab2/L2main.asm<gh_stars>1-10 ;Testing Bit Banging w/Logic Analyzer ;<NAME>, <NAME>, <NAME>, Group 11, Lab 2, Febuary 6th, 2013 ; export symbols XDEF Entry, _Startup ;export 'Entry' symbol ABSENTRY Entry ;for absolute assembly: mark this as entry point ;definitions RAMStart EQU $1000 ;absoolute address of the start of RAM ROMSTART EQU $C000 ;absolute addres to place code/constant data PTA EQU $0000 PTB EQU $0001 DDRA EQU $0002 DDRB EQU $0003 WS_H EQU $03 W_L EQU $01 WS_L EQU $00 S_L EQU $02 ;variable section ORG RAMStart ;code section ORG ROMSTART Entry: _Startup: ;Program 1 LDAA #$FF STAA DDRA LDX #$0 LOOP: LDAA #$00 STAA PTA LDAA #$55 STAA PTA LDAA #$AA STAA PTA LDAA #$FF STAA PTA INX CPX #$100 BNE LOOP NOP ;Program 2 LDAA #$00 LDAB #$FF LDX #$1000 LOOP1: STAA ,X+ INCA STAB ,X- DECB CMPA ,X- BNE LOOP1 STAA DDRA STAA DDRB LDX #$1000 LDAA WS_H STAA PTB LOOP2: LDAA ,X STAA PTA LDAA W_L STAA PTB LDAA WS_L STAA PTB LDAA W_L STAA PTB LDAA WS_H STAA PTB CPX #$1100 BNE LOOP2 ;Interrupt Vectors ORG $FFFE DC.W Entry ;reset vector
Transynther/x86/_processed/AVXALIGN/_zr_/i7-8650U_0xd2_notsx.log_710_400.asm
ljhsiun2/medusa
9
84777
.global s_prepare_buffers s_prepare_buffers: push %r12 push %r15 push %r8 push %rax push %rbx push %rcx push %rdi push %rsi lea addresses_normal_ht+0x1dbfc, %rax nop and $34190, %r8 movups (%rax), %xmm7 vpextrq $1, %xmm7, %rdi nop nop nop and $51112, %rcx lea addresses_D_ht+0xf5e3, %r12 nop nop xor $55254, %r15 mov $0x6162636465666768, %rbx movq %rbx, %xmm3 vmovups %ymm3, (%r12) nop nop nop nop inc %r8 lea addresses_WC_ht+0x5763, %rsi lea addresses_WT_ht+0x15dc3, %rdi clflush (%rdi) nop nop and %r8, %r8 mov $54, %rcx rep movsq nop inc %rax lea addresses_A_ht+0xfd23, %r8 nop nop nop nop add $5065, %r12 mov $0x6162636465666768, %rbx movq %rbx, (%r8) nop inc %r12 lea addresses_WT_ht+0x1d83, %r15 nop nop inc %r8 movb $0x61, (%r15) nop nop and $44036, %r15 pop %rsi pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r15 pop %r12 ret .global s_faulty_load s_faulty_load: push %r12 push %r15 push %r9 push %rbp push %rdi // Faulty Load lea addresses_normal+0xa163, %r12 nop cmp $31505, %rdi vmovntdqa (%r12), %ymm1 vextracti128 $1, %ymm1, %xmm1 vpextrq $1, %xmm1, %r9 lea oracles, %r15 and $0xff, %r9 shlq $12, %r9 mov (%r15,%r9,1), %r9 pop %rdi pop %rbp pop %r9 pop %r15 pop %r12 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_A_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'00': 710} 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 */
win-exec-calc-shellcode.asm
amaranth0203/win-exec-calc-shellcode
0
164789
; Copyright (c) 2009-2014, Berend-Jan "SkyLined" Wever <<EMAIL>> ; and <NAME> <<EMAIL>> ; Project homepage: http://code.google.com/p/win-exec-calc-shellcode/ ; All rights reserved. See COPYRIGHT.txt for details. ; null-free x86/x64 branching code for calc.exe executing shellcode. ; Works in any x86 or x64 application for Windows 5.0-6.3 all service packs. BITS 32 %include 'type-conversion.asm' global _shellcode ; _ is needed because LINKER will add it automatically in 32-bit mode. _shellcode: %undef USE_COMMON ; not allowed as user-supplied %ifdef CLEAN %define FUNC ; force define FUNC is CLEAN is used %endif %ifndef FUNC %define USE_COMMON %endif %ifndef USE_COMMON %ifdef CLEAN PUSH EAX %endif %ifdef STACK_ALIGN %ifdef FUNC PUSH ESP POP EAX %endif %endif %endif %ifdef STACK_ALIGN AND SP, -16 ; cannot set ESP because it might destroy RSP in 64-bit mode PUSH EAX %endif ; x86 ; x64 XOR EAX, EAX ; ---> XOR EAX, EAX %ifdef USE_COMMON PUSH EAX ; Stack = 0 (for 32-bit support) PUSH B2DW('c', 'a', 'l', 'c') ; Stack = "calc", 0 PUSH ESP POP ECX ; ECX = &("calc") PUSH EAX ; Stack = 0, "calc", 0 %endif INC EAX ; \,-> XCHG RDX, RAX XCHG EDX, EAX ; / JE w64_exec_calc_shellcode ; ---> JE w64_exec_calc_shellcode ; Because EDX is set to 0 in x64 mode, a size optimization is possible in the x64 shellcode. %define PLATFORM_INDEPENDENT ; Since EAX gets incremented on x86, the code did not branch but falls through ; into the x86 shellcode. w32_exec_calc_shellcode: %include "w32-exec-calc-shellcode.asm" JMP EOF ; Since EAX does NOT get incremented on x64, the code did branch to the x64 ; shellcode. w64_exec_calc_shellcode: %include "w64-exec-calc-shellcode.asm" EOF:
programs/oeis/014/A014616.asm
karttu/loda
1
85519
; A014616: a(n) = solution to the postage stamp problem with 2 denominations and n stamps. ; 2,4,7,10,14,18,23,28,34,40,47,54,62,70,79,88,98,108,119,130,142,154,167,180,194,208,223,238,254,270,287,304,322,340,359,378,398,418,439,460,482,504,527,550,574,598,623,648,674,700,727,754,782,810,839,868,898,928,959,990,1022,1054,1087,1120,1154,1188,1223,1258,1294,1330,1367,1404,1442,1480,1519,1558,1598,1638,1679,1720,1762,1804,1847,1890,1934,1978,2023,2068,2114,2160,2207,2254,2302,2350,2399,2448,2498,2548,2599,2650,2702,2754,2807,2860,2914,2968,3023,3078,3134,3190,3247,3304,3362,3420,3479,3538,3598,3658,3719,3780,3842,3904,3967,4030,4094,4158,4223,4288,4354,4420,4487,4554,4622,4690,4759,4828,4898,4968,5039,5110,5182,5254,5327,5400,5474,5548,5623,5698,5774,5850,5927,6004,6082,6160,6239,6318,6398,6478,6559,6640,6722,6804,6887,6970,7054,7138,7223,7308,7394,7480,7567,7654,7742,7830,7919,8008,8098,8188,8279,8370,8462,8554,8647,8740,8834,8928,9023,9118,9214,9310,9407,9504,9602,9700,9799,9898,9998,10098,10199,10300,10402,10504,10607,10710,10814,10918,11023,11128,11234,11340,11447,11554,11662,11770,11879,11988,12098,12208,12319,12430,12542,12654,12767,12880,12994,13108,13223,13338,13454,13570,13687,13804,13922,14040,14159,14278,14398,14518,14639,14760,14882,15004,15127,15250,15374,15498,15623,15748,15874,16000 mov $1,8 add $1,$0 mul $1,$0 div $1,4 add $1,2
src/Data/Word8/FromNat.agda
semenov-vladyslav/bytes-agda
0
16865
{-# OPTIONS --without-K #-} module Data.Word8.FromNat where open import Data.Word8.Primitive -- open import Agda.Builtin.Bool using (Bool; true) -- open import Agda.Builtin.Nat using (Nat; _<_) open import Agda.Builtin.Unit using (⊤) open import Agda.Builtin.FromNat using (Number) {- instance NumberNat : Number Nat NumberNat = record { Constraint = λ _ → ⊤ ; fromNat = λ n → n } data IsTrue : Bool → Set where itis : IsTrue true instance indeed : IsTrue true indeed = itis -} instance NumberWord8 : Number Word8 NumberWord8 = record { Constraint = λ n → ⊤ -- IsTrue (n < 256) ; fromNat = λ n → primWord8fromNat n }
Background/metatiles.asm
nesdoug/SNES_13
11
6798
.segment "CODE" ; typed by hand ; 8 bytes per metatile = 4 tiles ; 2 bytes per tile, tile # then attributes (palette) Metatiles: ;tile 0 .byte $02, TILE_PAL_0 .byte $03, TILE_PAL_0 .byte $12, TILE_PAL_0 .byte $13, TILE_PAL_0 ;tile 1 .byte $04, TILE_PAL_1 .byte $05, TILE_PAL_1 .byte $14, TILE_PAL_1 .byte $15, TILE_PAL_1 ;tile 2 .byte $02, TILE_PAL_5 .byte $03, TILE_PAL_5 .byte $12, TILE_PAL_5 .byte $13, TILE_PAL_5
drools-example/src/main/resources/antlr4/AggregateParser.g4
noogel/xyzPlayJava
0
4777
parser grammar AggregateParser; options { // 聚类的语法分析器也可以使用SearchLexer tokenVocab = SearchLexer; } expr: // 多个聚类条件用分号隔开 aggClause (SEMI aggClause)* ; // aggClause表示代表以下聚类的任意一种 aggClause: cardinalityAggClause|termsAggClause|termsAfterAggClause|geoBoundingBoxAggClause ; // 去重值计数 -> (country) cardinalityAggClause: LPAREN ID RPAREN ; // 桶聚类分页 -> province after 湖南 termsAfterAggClause: field = ID AFTER after=ID ; // 桶聚类嵌套子聚类 -> country>province>city termsAggClause: field = ID (GT termsAggClause)? ; // 地理边框聚类 -> [coordinate] geoBoundingBoxAggClause: LBRACKET ID RBRACKET ;
SysCore/Kernel/Debug/panic.asm
pmache/heinanos
0
105483
; Listing generated by Microsoft (R) Optimizing Compiler Version 14.00.50727.42 TITLE c:\Users\Heinan\Desktop\Demo8\Demo_8\SysCore\Kernel\panic.cpp .686P .XMM include listing.inc .model flat INCLUDELIB LIBCMT INCLUDELIB OLDNAMES CONST SEGMENT $SG2620 DB 'HeinanOS has encountered a problem and has been shut dow' DB 'n', 0aH, 09H, 'to prevent damage to your computer. Any unsave' DB 'd work might be lost.', 0aH, 09H, 'We are sorry for the incon' DB 'venience this might have caused.', 0aH, 0aH, 09H, 'Please rep' DB 'ort the following information and restart your computer.', 0aH DB 09H, 'The system has been halted.', 0aH, 0aH, 00H ORG $+1 $SG2621 DB '*** STOP: %s', 00H CONST ENDS PUBLIC ?kernel_panic@@YAXPBDZZ ; kernel_panic EXTRN ?DebugPrintf@@YAHPBDZZ:PROC ; DebugPrintf EXTRN ?DebugPuts@@YAXPAD@Z:PROC ; DebugPuts EXTRN ?DebugSetColor@@YAII@Z:PROC ; DebugSetColor EXTRN ?DebugGotoXY@@YAXII@Z:PROC ; DebugGotoXY EXTRN ?DebugClrScr@@YAXE@Z:PROC ; DebugClrScr EXTRN ?disable@@YAXXZ:PROC ; disable ; Function compile flags: /Ogtpy ; File c:\users\heinan\desktop\demo8\demo_8\syscore\kernel\panic.cpp _TEXT SEGMENT _fmt$ = 8 ; size = 4 ?kernel_panic@@YAXPBDZZ PROC ; kernel_panic ; 13 : ; 14 : disable (); call ?disable@@YAXXZ ; disable ; 15 : ; 16 : va_list args; ; 17 : static char buf[1024]; ; 18 : ; 19 : va_start (args, fmt); ; 20 : ; 21 : // We will need a vsprintf() here. I will see if I can write ; 22 : // one before the tutorial release ; 23 : ; 24 : va_end (args); ; 25 : ; 26 : char* disclamer="HeinanOS has encountered a problem and has been shut down\n\ ; 27 : to prevent damage to your computer. Any unsaved work might be lost.\n\ ; 28 : We are sorry for the inconvenience this might have caused.\n\n\ ; 29 : Please report the following information and restart your computer.\n\ ; 30 : The system has been halted.\n\n"; ; 31 : ; 32 : DebugClrScr (0x1f); push 31 ; 0000001fH call ?DebugClrScr@@YAXE@Z ; DebugClrScr ; 33 : DebugGotoXY (0,0); push 0 push 0 call ?DebugGotoXY@@YAXII@Z ; DebugGotoXY ; 34 : DebugSetColor (0x1f); push 31 ; 0000001fH call ?DebugSetColor@@YAII@Z ; DebugSetColor ; 35 : DebugPuts (disclamer); push OFFSET $SG2620 call ?DebugPuts@@YAXPAD@Z ; DebugPuts ; 36 : ; 37 : DebugPrintf ("*** STOP: %s", fmt); mov eax, DWORD PTR _fmt$[esp+16] push eax push OFFSET $SG2621 call ?DebugPrintf@@YAHPBDZZ ; DebugPrintf add esp, 28 ; 0000001cH $LL2@kernel_pan: ; 38 : ; 39 : for (;;); jmp SHORT $LL2@kernel_pan ?kernel_panic@@YAXPBDZZ ENDP ; kernel_panic _TEXT ENDS END
LaolxLexer.g4
kpfalzer/laolx
0
6384
<filename>LaolxLexer.g4<gh_stars>0 lexer grammar LaolxLexer; channels { SemiNlChan, CommentChan} // Lexer definition // AS : 'as' ; BOOL : 'bool' ; BREAK : 'break' ; CASE : 'case' ; CATCH : 'catch' ; CHAR : 'char' ; CLASS : 'class' ; CONST : 'const' ; DEF : 'def' ; DEFAULT : 'default' ; DO : 'do' ; ELSE : 'else' ; ELSIF : 'elsif' ; FALSE : 'false' ; FLOAT : 'float' ; FOR : 'for' ; FUNCTION : 'function' ; IF : 'if' ; IMPORT : 'import' ; IN : 'in' ; INT : 'int' ; INTERFACE : 'interface' ; NAMESPACE : 'namespace' ; NEW : 'new' ; NIL : 'nil' ; OPERATOR : 'operator' ; PRIVATE : 'private' ; PROTECTED : 'protected' ; PUBLIC : 'public' ; REGEXPK : 'regexp' ; RETURN : 'return' ; STATIC : 'static' ; STRING : 'string' ; SYMBOL : 'symbol' ; THIS : 'this' ; THROW : 'throw' ; TRUE : 'true' ; TRY : 'try' ; TYPEDEF : 'typedef' ; UNLESS : 'unless' ; UNTIL : 'until' ; VAR : 'var' ; VOID : 'void' ; WHEN : 'when' ; WHILE : 'while' ; AND : '&' ; AND2 : '&&' ; RARROW : '->' ; AT : '@' ; CARET : '^' ; COLON : ':' ; COLON2 : '::' ; COMMA : ',' ; DOT : '.' ; DOTQ : '.?' ; //access if not null EQ : '=' ; EQ2 : '==' ; EXCL : '!' ; NOTEQ : '!=' ; GT : '>' ; LBRACK : '[' ; LCURLY : '{' ; LPAREN : '(' ; LT : '<' ; MINUS : '-' ; MINUS2 : '--' ; OR : '|' ; OR2 : '||' ; PCNT : '%' ; PLUS : '+' ; PLUS2 : '++' ; QMARK : '?' ; RBRACK : ']' ; RCURLY : '}' ; RPAREN : ')' ; SEMI : ';' -> channel(SemiNlChan); SLASH : '/' ; STAR : '*' ; TILDE : '~' ; WORDS : '%w{' ; SYMBOLS : '%s{' ; TUPLE : '%t{' ; STAREQ : '*=' ; SLASHEQ : '/=' ; PCNTEQ : '%=' ; PLUSEQ : '+=' ; MINUSEQ : '-=' ; //conflict with '>', '>',... in template >>= // ... <<= ANDEQ : '&=' ; CARETEQ : '^=' ; OREQ : '|=' ; OR2EQ : '||=' ; //conditional (!null) assign SQSTRING : '\'' (ESC | ~['])? '\'' ; DQSTRING : '"' (ESC | ~["])* '"' ; IDENT : ID_LETTER (ID_LETTER | DIGIT)* ; REGEXP : '%r{' (ESC | ~[{])* '}' [i]? ; // // Number values // VINTEGER: INTFRAG ; fragment INTFRAG: [0-9][0-9_]* ; VHEX : '0x' [0-9a-fA-F][0-9_a-fA-F]* ; VFLOAT : INTFRAG '.' INTFRAG ([eE][-+]? INTFRAG)? ; VSIZED : INTFRAG '\'' [bBhHoOdD][0-9a-fA-F][0-9a-fA-F_]* ; fragment ESC : '\\' . ; fragment ID_LETTER : 'a'..'z' | 'A'..'Z' | '_' ; fragment DIGIT : '0'..'9' ; WS : [ \t]+ -> skip; EOLN : ('\r'? '\n')+ -> channel(SemiNlChan) ; BLOCK_COMMENT : '/*' .*? '*/' -> channel(CommentChan); LINE_COMMENT : '//' ~[\r\n]* -> channel(CommentChan);
courses/fundamentals_of_ada/labs/solar_system/110_private_types/src/solar_system-graphics.ads
AdaCore/training_material
15
21647
package Solar_System.Graphics is procedure Draw_All (Bodies : Bodies_Array_T; Canvas : Canvas_ID); procedure Draw_Body (Object : Body_T; Canvas : Canvas_ID); end Solar_System.Graphics;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/biased_uc.adb
best08618/asylo
7
18317
<gh_stars>1-10 -- { dg-do run } -- { dg-options "-gnatws" } with Unchecked_Conversion; procedure biased_uc is begin -- Case (f) target type is biased, source is unbiased declare type a is new integer range 0 .. 255; for a'size use 8; type b is new integer range 200 .. 455; for b'size use 8; av : a; bv : b; for av'size use 8; for bv'size use 8; function a2b is new Unchecked_Conversion (a,b); begin bv := a2b (200); if bv = 200 then raise Program_Error; end if; end; -- Case (g) target type is biased, source object is biased declare type a is new integer range 1 .. 256; for a'size use 16; type b is new integer range 1 .. 65536; for b'size use 16; av : a; bv : b; for av'size use 8; for bv'size use 16; function a2b is new Unchecked_Conversion (a,b); begin bv := a2b (1); if bv /= 2 then raise Program_Error; end if; end; end;
programs/oeis/017/A017810.asm
neoneye/loda
22
20018
<filename>programs/oeis/017/A017810.asm<gh_stars>10-100 ; A017810: Binomial coefficients C(94,n). ; 1,94,4371,134044,3049501,54891018,814216767,10235867928,111315063717,1063677275518,9041256841903,69042324974532,477542747740513,3012192716517082,17427686431277403,92947660966812816,458929076023638279,2105674584108457986,9007607943130625829,36030431772522503316,135114119146959387435,476116419851190222390,1579840847688040283385,4945588740588647843640,14630700024241416537435,40965960067875966304818,108717355564747756732017,273806673274179535473228,655180253906072459882367,1491099888200026977663318,3230716424433391784937189,6669866166572163685031616,13131299015438947254905994,24670925422945900903156716,44262542670579410443898814,75878644578136132189540824,124356667503056438866191906,194937478788574958222679204,292406218182862437334018806,419865338929238371556539824,577314841027702760890242258,760365888182828026538367852,959509335087854414441273718,1160336870338800687231307752,1344935917892700796563561258,1494373242103000885070623620,1591832366587979203662186030,1625701140345170250548615520,1591832366587979203662186030,1494373242103000885070623620,1344935917892700796563561258,1160336870338800687231307752,959509335087854414441273718,760365888182828026538367852,577314841027702760890242258,419865338929238371556539824,292406218182862437334018806,194937478788574958222679204,124356667503056438866191906,75878644578136132189540824,44262542670579410443898814,24670925422945900903156716,13131299015438947254905994,6669866166572163685031616,3230716424433391784937189,1491099888200026977663318,655180253906072459882367,273806673274179535473228,108717355564747756732017,40965960067875966304818,14630700024241416537435,4945588740588647843640,1579840847688040283385,476116419851190222390,135114119146959387435,36030431772522503316,9007607943130625829,2105674584108457986,458929076023638279,92947660966812816,17427686431277403,3012192716517082,477542747740513,69042324974532,9041256841903,1063677275518,111315063717,10235867928,814216767,54891018,3049501,134044,4371,94,1 mov $1,94 bin $1,$0 mov $0,$1
src/PJ/picdrive/mov/memwstuf.asm
AnimatorPro/Animator-Pro
119
101976
CGROUP group code code segment dword 'CODE' assume cs:CGROUP,ds:CGROUP ;pj_stuff_words(USHORT data, USHORT *buf, unsigned count) ;careful about passing a zero count. It will be interpreted as 4 Gigawords. public pj_stuff_words pj_stuff_words proc near push edi push ecx mov edi,[esp+16] ;buf mov eax,[esp+12] ;value to poke mov ecx,[esp+20] ;count rep stosw pop ecx pop edi ret pj_stuff_words endp code ends end
source/amf/uml/amf-uml-generalization_sets.ads
svn2github/matreshka
24
28441
<gh_stars>10-100 ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ -- A generalization set is a packageable element whose instances define -- collections of subsets of generalization relationships. ------------------------------------------------------------------------------ limited with AMF.UML.Classifiers; limited with AMF.UML.Generalizations.Collections; with AMF.UML.Packageable_Elements; package AMF.UML.Generalization_Sets is pragma Preelaborate; type UML_Generalization_Set is limited interface and AMF.UML.Packageable_Elements.UML_Packageable_Element; type UML_Generalization_Set_Access is access all UML_Generalization_Set'Class; for UML_Generalization_Set_Access'Storage_Size use 0; not overriding function Get_Generalization (Self : not null access constant UML_Generalization_Set) return AMF.UML.Generalizations.Collections.Set_Of_UML_Generalization is abstract; -- Getter of GeneralizationSet::generalization. -- -- Designates the instances of Generalization which are members of a given -- GeneralizationSet. not overriding function Get_Is_Covering (Self : not null access constant UML_Generalization_Set) return Boolean is abstract; -- Getter of GeneralizationSet::isCovering. -- -- Indicates (via the associated Generalizations) whether or not the set -- of specific Classifiers are covering for a particular general -- classifier. When isCovering is true, every instance of a particular -- general Classifier is also an instance of at least one of its specific -- Classifiers for the GeneralizationSet. When isCovering is false, there -- are one or more instances of the particular general Classifier that are -- not instances of at least one of its specific Classifiers defined for -- the GeneralizationSet. not overriding procedure Set_Is_Covering (Self : not null access UML_Generalization_Set; To : Boolean) is abstract; -- Setter of GeneralizationSet::isCovering. -- -- Indicates (via the associated Generalizations) whether or not the set -- of specific Classifiers are covering for a particular general -- classifier. When isCovering is true, every instance of a particular -- general Classifier is also an instance of at least one of its specific -- Classifiers for the GeneralizationSet. When isCovering is false, there -- are one or more instances of the particular general Classifier that are -- not instances of at least one of its specific Classifiers defined for -- the GeneralizationSet. not overriding function Get_Is_Disjoint (Self : not null access constant UML_Generalization_Set) return Boolean is abstract; -- Getter of GeneralizationSet::isDisjoint. -- -- Indicates whether or not the set of specific Classifiers in a -- Generalization relationship have instance in common. If isDisjoint is -- true, the specific Classifiers for a particular GeneralizationSet have -- no members in common; that is, their intersection is empty. If -- isDisjoint is false, the specific Classifiers in a particular -- GeneralizationSet have one or more members in common; that is, their -- intersection is not empty. For example, Person could have two -- Generalization relationships, each with the different specific -- Classifier: Manager or Staff. This would be disjoint because every -- instance of Person must either be a Manager or Staff. In contrast, -- Person could have two Generalization relationships involving two -- specific (and non-covering) Classifiers: Sales Person and Manager. This -- GeneralizationSet would not be disjoint because there are instances of -- Person which can be a Sales Person and a Manager. not overriding procedure Set_Is_Disjoint (Self : not null access UML_Generalization_Set; To : Boolean) is abstract; -- Setter of GeneralizationSet::isDisjoint. -- -- Indicates whether or not the set of specific Classifiers in a -- Generalization relationship have instance in common. If isDisjoint is -- true, the specific Classifiers for a particular GeneralizationSet have -- no members in common; that is, their intersection is empty. If -- isDisjoint is false, the specific Classifiers in a particular -- GeneralizationSet have one or more members in common; that is, their -- intersection is not empty. For example, Person could have two -- Generalization relationships, each with the different specific -- Classifier: Manager or Staff. This would be disjoint because every -- instance of Person must either be a Manager or Staff. In contrast, -- Person could have two Generalization relationships involving two -- specific (and non-covering) Classifiers: Sales Person and Manager. This -- GeneralizationSet would not be disjoint because there are instances of -- Person which can be a Sales Person and a Manager. not overriding function Get_Powertype (Self : not null access constant UML_Generalization_Set) return AMF.UML.Classifiers.UML_Classifier_Access is abstract; -- Getter of GeneralizationSet::powertype. -- -- Designates the Classifier that is defined as the power type for the -- associated GeneralizationSet. not overriding procedure Set_Powertype (Self : not null access UML_Generalization_Set; To : AMF.UML.Classifiers.UML_Classifier_Access) is abstract; -- Setter of GeneralizationSet::powertype. -- -- Designates the Classifier that is defined as the power type for the -- associated GeneralizationSet. end AMF.UML.Generalization_Sets;
Task/Pointers-and-references/Ada/pointers-and-references-7.ada
LaudateCorpus1/RosettaCodeData
1
2840
<gh_stars>1-10 type Container is array (Positive range <>) of Element; for I in Container'Range loop declare Item : Element renames Container (I); begin Do_Something(Item); -- Here Item is a reference to Container (I) end; end loop;
Commands/Miscellaneous Commands suite/system info/boot volume of (get system info).applescript
looking-for-a-job/applescript-examples
1
1609
<filename>Commands/Miscellaneous Commands suite/system info/boot volume of (get system info).applescript<gh_stars>1-10 #!/usr/bin/osascript boot volume of (get system info)
Driver/Font/Bitstream/Main/mainEscape.asm
steakknife/pcgeos
504
11114
COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Copyright (c) Geoworks 1993 -- All Rights Reserved PROJECT: GEOS Bitstream Font Driver MODULE: Main FILE: mainEscape.asm AUTHOR: <NAME> FUNCTIONS: Scope Name Description ----- ---- ----------- EXT BitstremFontEscape Handle any escape functions passed to this font driver. REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/30/93 Initial version. DESCRIPTION: This file contains the GEOS Bitstream Font Driver escape function handler. $Id: mainEscape.asm,v 1.1 97/04/18 11:45:05 newdeal Exp $ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BitstreamFontEscape %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% SYNOPSIS: Handle all of the driver escape functions that have been passed to the Bitstream font driver. CALLED BY: BitstreamStrategy. PASS: DI = Escape function. RETURN: DI = 0 iff escape function not supported Otherwise, unchanged DESTROYED: Escape function dependent PSEUDO CODE/STRATEGY: CHECKS: None. KNOWN BUGS/SIDE EFFECTS/IDEAS: ???? REVISION HISTORY: Name Date Description ---- ---- ----------- brianc 9/30/93 Initial version %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ BitstreamFontEscape proc far ; Pass off the call to FontCallEscape to handle. call FontCallEscape ret BitstreamFontEscape endp ;----------------------------------------------------------------------------- ; Escape function stubs (must be in same segment) ;----------------------------------------------------------------------------- BitstreamInstallInitStub proc near call BitstreamInstallInit ret BitstreamInstallInitStub endp BitstreamInstallExitStub proc near call BitstreamInstallExit ret BitstreamInstallExitStub endp BitstreamInstallGetCharBBoxStub proc near call BitstreamInstallGetCharBBox ret BitstreamInstallGetCharBBoxStub endp BitstreamInstallGetPairKernStub proc near call BitstreamInstallGetPairKern ret BitstreamInstallGetPairKernStub endp COMMENT @%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Escape Function Table %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@ DefEscapeTable 5 DefEscape FontQueryEscape, DRV_ESC_QUERY_ESC DefEscape BitstreamInstallInitStub, FONT_ESC_BITSTREAM_INSTALL_INIT DefEscape BitstreamInstallExitStub, FONT_ESC_BITSTREAM_INSTALL_EXIT DefEscape BitstreamInstallGetCharBBoxStub, FONT_ESC_BITSTREAM_INSTALL_GET_CHAR_BBOX DefEscape BitstreamInstallGetPairKernStub, FONT_ESC_BITSTREAM_INSTALL_GET_PAIR_KERN
oeis/254/A254641.asm
neoneye/loda-programs
11
1889
<filename>oeis/254/A254641.asm ; A254641: Third partial sums of seventh powers (A001015). ; 1,131,2577,23723,141694,636426,2331462,7323954,20396871,51550213,120271151,262391493,540659756,1060489444,1992739932,3605846676,6310148349,10717864983,17722868317,28605158351,45165823626,69899222030,106210179010,158685165990,233427698595,338469587001,484271184411,684325419337,955882168088,1320811430664,1806625821176,2447685077992,3286607644089,4375916869611,5779952051433,7577077353651,9862224653398,12749809533266,16377062999934,20907825053402,26536849967551,33494677075629,42053124988743 lpb $0 mov $2,$0 sub $0,1 seq $2,250212 ; Second partial sums of seventh powers (A001015). add $1,$2 lpe add $1,1 mov $0,$1
test/Succeed/UnquoteExtLam.agda
shlevy/agda
0
15223
<filename>test/Succeed/UnquoteExtLam.agda open import Common.Reflection open import Common.Prelude open import Common.Equality open import Agda.Builtin.Sigma pattern `Nat = def (quote Nat) [] pattern _`→_ a b = pi (vArg a) (abs "_" b) pattern `Set = sort (lit 0) pattern `⊥ = def (quote ⊥) [] pattern `zero = con (quote zero) [] pattern `suc n = con (quote suc) (vArg n ∷ []) prDef : FunDef prDef = funDef (`Nat `→ `Nat) ( clause [] [] (extLam ( clause [] (vArg `zero ∷ []) `zero ∷ clause (("x" , vArg `Nat) ∷ []) (vArg (`suc (var 0)) ∷ []) (var 0 []) ∷ []) []) ∷ [] ) magicDef : FunDef magicDef = funDef (pi (hArg `Set) (abs "A" (`⊥ `→ var 1 []))) ( clause [] [] (extLam ( absurdClause (("()" , vArg `⊥) ∷ []) (vArg absurd ∷ []) ∷ []) []) ∷ [] ) unquoteDecl magic = define (vArg magic) magicDef checkMagic : {A : Set} → ⊥ → A checkMagic = magic unquoteDecl pr = define (vArg pr) prDef magic′ : {A : Set} → ⊥ → A magic′ = unquote (give (extLam (absurdClause (("()" , vArg `⊥) ∷ []) (vArg absurd ∷ []) ∷ []) [])) module Pred (A : Set) where unquoteDecl pr′ = define (vArg pr′) prDef check : pr 10 ≡ 9 check = refl check′ : Pred.pr′ ⊥ 10 ≡ 9 check′ = refl
alloy4fun_models/trainstlt/models/8/CFZoBTevEfQttXBnn.als
Kaixi26/org.alloytools.alloy
0
1187
<reponame>Kaixi26/org.alloytools.alloy open main pred idCFZoBTevEfQttXBnn_prop9 { (all t:Train | no t.pos implies eventually (some (t.pos.prox & Entry ) and some t.pos and t.pos in Entry) ) } pred __repair { idCFZoBTevEfQttXBnn_prop9 } check __repair { idCFZoBTevEfQttXBnn_prop9 <=> prop9o }
source/amf/mof/cmof/amf-internals-factories-cmof_module_factory.adb
svn2github/matreshka
24
19478
<filename>source/amf/mof/cmof/amf-internals-factories-cmof_module_factory.adb ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2010-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ with AMF.Internals.Element_Collections; with AMF.Internals.Links; with AMF.Internals.Tables.CMOF_Attribute_Mappings; with AMF.Internals.Tables.CMOF_Attributes; with AMF.Internals.Tables.CMOF_Element_Table; with AMF.Internals.Tables.CMOF_Metamodel; with AMF.Internals.Tables.CMOF_Types; package body AMF.Internals.Factories.CMOF_Module_Factory is use AMF.Internals.Tables; procedure Construct_Union (Element : AMF.Internals.AMF_Element; Property : AMF.Internals.CMOF_Element; Link : AMF.Internals.AMF_Link); -------------------- -- Connect_Extent -- -------------------- overriding procedure Connect_Extent (Self : not null access constant CMOF_Module_Factory; Element : AMF.Internals.AMF_Element; Extent : AMF.Internals.AMF_Extent) is pragma Unreferenced (Self); begin AMF.Internals.Tables.CMOF_Element_Table.Table (Element).Extent := Extent; end Connect_Extent; ---------------------- -- Connect_Link_End -- ---------------------- overriding procedure Connect_Link_End (Self : not null access constant CMOF_Module_Factory; Element : AMF.Internals.AMF_Element; Property : AMF.Internals.CMOF_Element; Link : AMF.Internals.AMF_Link; Other : AMF.Internals.AMF_Element) is pragma Unreferenced (Self); use AMF.Internals.Tables.CMOF_Attribute_Mappings; begin if AMF.Internals.Tables.CMOF_Attributes.Internal_Get_Upper (Property).Value > 1 then if Property in CMOF_Collection_Offset'Range (2) then AMF.Internals.Element_Collections.Internal_Append (CMOF_Element_Table.Table (Element).Member (0).Collection + CMOF_Collection_Offset (CMOF_Element_Table.Table (Element).Kind, Property), Other, Link); else AMF.Internals.Element_Collections.Internal_Append (CMOF_Element_Table.Table (Element).Member (0).Collection, Other, Link); end if; else if Property in CMOF_Member_Offset'Range (2) then CMOF_Element_Table.Table (Element).Member (CMOF_Member_Offset (CMOF_Element_Table.Table (Element).Kind, Property)).Link := Link; else AMF.Internals.Element_Collections.Internal_Append (CMOF_Element_Table.Table (Element).Member (0).Collection, Other, Link); end if; end if; end Connect_Link_End; --------------------- -- Construct_Union -- --------------------- procedure Construct_Union (Element : AMF.Internals.AMF_Element; Property : AMF.Internals.CMOF_Element; Link : AMF.Internals.AMF_Link) is separate; -------------------------- -- Synchronize_Link_Set -- -------------------------- overriding procedure Synchronize_Link_Set (Self : not null access constant CMOF_Module_Factory; Element : AMF.Internals.AMF_Element; Property : AMF.Internals.CMOF_Element; Link : AMF.Internals.AMF_Link) is pragma Unreferenced (Self); use AMF.Internals.Tables.CMOF_Metamodel; use AMF.Internals.Tables.CMOF_Types; Element_Kind : constant CMOF_Types.Element_Kinds := CMOF_Element_Table.Table (Element).Kind; Opposite : constant AMF_Element := AMF.Internals.Links.Opposite_Element (Link, Element); Opposite_Kind : constant CMOF_Types.Element_Kinds := CMOF_Element_Table.Table (Opposite).Kind; begin -- XXX Experimental code: when element is added to -- CMOF::Package::packagedElement attribute and element is subclass of -- CMOF::Type when add it to CMOF::Package::ownedType attribute also. if Element_Kind = E_CMOF_Package and then Property = MP_CMOF_Package_Packaged_Element_A_Owning_Package and then (Opposite_Kind = E_CMOF_Class or Opposite_Kind = E_CMOF_Enumeration or Opposite_Kind = E_CMOF_Data_Type or Opposite_Kind = E_CMOF_Primitive_Type) then AMF.Internals.Links.Create_Link (MA_CMOF_Package_Owned_Type_Package, Element, Opposite, Link); end if; -- Construct derived unions. Construct_Union (Element, Property, Link); end Synchronize_Link_Set; ---------------- -- To_Element -- ---------------- overriding function To_Element (Self : not null access constant CMOF_Module_Factory; Element : AMF.Internals.AMF_Element) return AMF.Elements.Element_Access is pragma Unreferenced (Self); begin return AMF.Internals.Tables.CMOF_Element_Table.Table (Element).Proxy; end To_Element; end AMF.Internals.Factories.CMOF_Module_Factory;
fracGC/Space.agda
JacquesCarette/pi-dual
14
9550
<filename>fracGC/Space.agda {-# OPTIONS --without-K --allow-unsolved-metas #-} module Space where open import Data.Empty using (⊥; ⊥-elim) open import Data.Nat using (ℕ; suc) renaming (_+_ to _ℕ+_; _*_ to _ℕ*_; _⊔_ to _ℕ⊔_) open import Data.Nat.Properties open import Data.Integer as ℤ using (ℤ; +_; -[1+_]; ∣_∣; _+_; _⊔_; -_) open import Data.Rational using (ℚ) renaming (1/_ to recip) open import Data.Sum using (_⊎_; inj₁; inj₂) open import Data.Product using (_×_; _,_; proj₁; proj₂) open import Data.Maybe open import Relation.Nullary using (¬_; yes; no) open import Relation.Binary.PropositionalEquality renaming ([_] to R[_]) using (_≡_; refl; sym; trans; cong; inspect) open import Data.Unit using (⊤; tt) open import Singleton open import PiFrac ------------------------------------------------------------------------------ -- Space denotational semantics -- for each type, we calculate its memory requirements which are two -- numbers (m , z). The number m represents the amount of space needed -- to store values of the type. The number z represents the effect of -- the value on space when it is interpreted. Ex. a gc process needs m -- bits to be stored but when run it releases z bits. -- Number of points in type card : (t : 𝕌) → ℕ card 𝟘 = 0 card 𝟙 = 1 card (t₁ +ᵤ t₂) = card t₁ ℕ+ card t₂ card (t₁ ×ᵤ t₂) = card t₁ ℕ* card t₂ card ● t [ v ] = 1 card 𝟙/● t [ v ] = 1 -- If number of points is zero then it is impossible to find a value -- of the type 0empty : {t : 𝕌} → card t ≡ 0 → (v : ⟦ t ⟧) → ⊥ 0empty {𝟘} _ () 0empty {𝟙} () tt 0empty {t₁ +ᵤ t₂} s (inj₁ v₁) with card t₁ | card t₂ | inspect card t₁ 0empty {t₁ +ᵤ t₂} refl (inj₁ v₁) | ℕ.zero | ℕ.zero | R[ s₁ ] = 0empty {t₁} s₁ v₁ 0empty {t₁ +ᵤ t₂} s (inj₂ v₂) with card t₁ | card t₂ | inspect card t₂ 0empty {t₁ +ᵤ t₂} refl (inj₂ v₂) | ℕ.zero | ℕ.zero | R[ s₂ ] = 0empty {t₂} s₂ v₂ 0empty {t₁ ×ᵤ t₂} s (v₁ , v₂) with card t₁ | card t₂ | inspect card t₁ | inspect card t₂ 0empty {t₁ ×ᵤ t₂} refl (v₁ , v₂) | ℕ.zero | _ | R[ s₁ ] | _ = 0empty {t₁} s₁ v₁ 0empty {t₁ ×ᵤ t₂} s (v₁ , v₂) | ℕ.suc n₁ | ℕ.zero | R[ s₁ ] | R[ s₂ ] = 0empty {t₂} s₂ v₂ 0empty {● t [ v ]} () (.v , refl) 0empty {𝟙/● t [ v ]} () f -- Space effects -- For a pointed type, even though we only have one value, that value -- could be large and we need just as much space to store it as we -- would need for any value of the given type. For a fractional type, -- the effect is to de-allocate the space above. space : (t : 𝕌) → {¬t≡0 : ¬ card t ≡ 0} → ℤ space 𝟘 {0ne} = ⊥-elim (0ne refl) space 𝟙 = + 0 space (t₁ +ᵤ t₂) {pne} with card t₁ | card t₂ | inspect card t₁ | inspect card t₂ ... | 0 | 0 | R[ s₁ ] | R[ s₂ ] = ⊥-elim (pne refl) ... | 0 | suc n | R[ s₁ ] | R[ s₂ ] = space t₂ {λ t2≡0 → ⊥-elim (pne (trans (sym s₂) t2≡0))} ... | suc m | 0 | R[ s₁ ] | R[ s₂ ] = space t₁ {λ t1≡0 → ⊥-elim (pne (trans (sym (trans s₁ (sym (+-identityʳ (suc m))))) t1≡0))} ... | suc m | suc n | R[ s₁ ] | R[ s₂ ] = + 1 + (space t₁ {λ t1≡0 → ⊥-elim (1+n≢0 (trans (sym s₁) t1≡0))} ⊔ space t₂ {λ t2≡0 → ⊥-elim ((1+n≢0 (trans (sym s₂) t2≡0)))}) space (t₁ ×ᵤ t₂) {pne} with card t₁ | card t₂ | inspect card t₁ | inspect card t₂ ... | 0 | 0 | R[ s₁ ] | R[ s₂ ] = ⊥-elim (pne refl) ... | 0 | suc n | R[ s₁ ] | R[ s₂ ] = ⊥-elim (pne refl) ... | suc m | 0 | R[ s₁ ] | R[ s₂ ] = ⊥-elim (pne (*-zeroʳ (suc m))) ... | suc m | suc n | R[ s₁ ] | R[ s₂ ] = space t₁ {λ t1≡0 → ⊥-elim (1+n≢0 (trans (sym s₁) t1≡0))} + space t₂ {λ t2≡0 → ⊥-elim (1+n≢0 (trans (sym s₂) t2≡0))} space ● t [ v ] = space t {λ t≡0 → 0empty t≡0 v} space 𝟙/● t [ v ] = - space t {λ t≡0 → 0empty t≡0 v} -- TODO -- Every combinator preserves space effects card= : (t₁ t₂ : 𝕌) (C : t₁ ⟷ t₂) → (card t₁ ≡ card t₂) card= .(𝟘 +ᵤ t₂) t₂ unite₊l = refl card= t₁ .(𝟘 +ᵤ t₁) uniti₊l = refl card= .(t₂ +ᵤ 𝟘) t₂ unite₊r rewrite +-identityʳ (card t₂) = refl card= t₁ .(t₁ +ᵤ 𝟘) uniti₊r rewrite +-identityʳ (card t₁) = refl card= (t₁ +ᵤ t₂) _ swap₊ rewrite +-comm (card t₁) (card t₂) = refl card= (t₁ +ᵤ t₂ +ᵤ t₃) _ assocl₊ rewrite +-assoc (card t₁) (card t₂) (card t₃) = refl card= ((t₁ +ᵤ t₂) +ᵤ t₃) _ assocr₊ rewrite +-assoc (card t₁) (card t₂) (card t₃) = refl card= (𝟙 ×ᵤ t₂) t₂ unite⋆l rewrite +-identityʳ (card t₂) = refl card= t₁ (𝟙 ×ᵤ t₁) uniti⋆l rewrite +-identityʳ (card t₁) = refl card= (t₂ ×ᵤ 𝟙) t₂ unite⋆r rewrite *-identityʳ (card t₂) = refl card= t₁ (t₁ ×ᵤ 𝟙) uniti⋆r rewrite *-identityʳ (card t₁) = refl card= (t₁ ×ᵤ t₂) _ swap⋆ rewrite *-comm (card t₁) (card t₂) = refl card= (t₁ ×ᵤ t₂ ×ᵤ t₃) _ assocl⋆ rewrite *-assoc (card t₁) (card t₂) (card t₃) = refl card= ((t₁ ×ᵤ t₂) ×ᵤ t₃) _ assocr⋆ rewrite *-assoc (card t₁) (card t₂) (card t₃) = refl card= .(𝟘 ×ᵤ _) .𝟘 absorbr = refl card= (t ×ᵤ 𝟘) .𝟘 absorbl rewrite *-zeroʳ (card t) = refl card= .𝟘 (t ×ᵤ 𝟘) factorzr rewrite *-zeroʳ (card t) = refl card= .𝟘 .(𝟘 ×ᵤ _) factorzl = refl card= ((t₁ +ᵤ t₂) ×ᵤ t₃) _ dist rewrite *-distribʳ-+ (card t₃) (card t₁) (card t₂) = refl card= _ ((t₁ +ᵤ t₂) ×ᵤ t₃) factor rewrite *-distribʳ-+ (card t₃) (card t₁) (card t₂) = refl card= (t₃ ×ᵤ (t₁ +ᵤ t₂)) _ distl rewrite *-distribˡ-+ (card t₃) (card t₁) (card t₂) = refl card= _ (t₃ ×ᵤ (t₁ +ᵤ t₂)) factorl rewrite *-distribˡ-+ (card t₃) (card t₁) (card t₂) = refl card= t₁ .t₁ id⟷ = refl card= t₁ t₂ (c₁ ⊚ c₂) rewrite card= _ _ c₁ | card= _ _ c₂ = refl card= (t₁ +ᵤ t₂) (t₃ +ᵤ t₄) (c₁ ⊕ c₂) rewrite card= _ _ c₁ | card= _ _ c₂ = refl card= (t₁ ×ᵤ t₂) (t₃ ×ᵤ t₄) (c₁ ⊗ c₂) rewrite card= _ _ c₁ | card= _ _ c₂ = refl card= .(● _ [ _ ]) .(● _ [ eval c _ ]) (lift c) = refl card= .(● _ ×ᵤ _ [ _ , _ ]) .(● _ [ _ ] ×ᵤ ● _ [ _ ]) tensorl = refl card= .(● _ [ _ ] ×ᵤ ● _ [ _ ]) .(● _ ×ᵤ _ [ _ , _ ]) tensorr = refl card= .(● _ +ᵤ _ [ inj₁ _ ]) .(● _ [ _ ]) plusll = refl card= .(● _ [ _ ]) .(● _ +ᵤ _ [ inj₁ _ ]) pluslr = refl card= .(● _ +ᵤ _ [ inj₂ _ ]) .(● _ [ _ ]) plusrl = refl card= .(● _ [ _ ]) .(● _ +ᵤ _ [ inj₂ _ ]) plusrr = refl card= .(𝟙/● _ ×ᵤ _ [ _ , _ ]) .(𝟙/● _ [ _ ] ×ᵤ 𝟙/● _ [ _ ]) fracl = refl card= .(𝟙/● _ [ _ ] ×ᵤ 𝟙/● _ [ _ ]) .(𝟙/● _ ×ᵤ _ [ _ , _ ]) fracr = refl card= .𝟙 .(● _ [ v ] ×ᵤ 𝟙/● _ [ v ]) (η v) = refl card= .(● _ [ v ] ×ᵤ 𝟙/● _ [ v ]) .𝟙 (ε v) = refl card= .(● _ [ _ ]) .(● _ [ _ ]) (== c x) = refl card= .(● (● t [ v ]) [ w ]) .(● t [ v ]) (ll {t} {v} {w}) = refl space= : (t₁ t₂ : 𝕌) → (c : t₁ ⟷ t₂) → Set space= t₁ t₂ c with card t₁ ≟ 0 space= t₁ t₂ c | yes _ = ⊤ space= t₁ t₂ c | no nz₁ = space t₁ {nz₁} ≡ space t₂ {λ nz₂ → nz₁ (trans (card= _ _ c) nz₂)} space≡ : (t₁ t₂ : 𝕌) → (c : t₁ ⟷ t₂) → space= t₁ t₂ c space≡ t₁ t₂ c with card t₁ ≟ 0 space≡ t₁ t₂ c | yes _ = tt space≡ t₁ t₂ c | no nz₁ = {!!} -- Groupoid interpretation ???? Groupoid for pointed 1/A is point and -- (size A) loops on point labeled (= a1), (= a2), (= a3), etc. ------------------------------------------------------------------------------
Scripts Pack Source Items/Scripts Pack/Dock/Always Allow Emptying Trash.applescript
Phorofor/ScriptsPack.macOS
1
4425
<filename>Scripts Pack Source Items/Scripts Pack/Dock/Always Allow Emptying Trash.applescript # Scripts Pack - Tweak various preference variables in macOS # <Phorofor, https://github.com/Phorofor/> -- Always allow emptying of the Trash regardless if it has files or not. -- Trash Always Full -- Version compatible: -- -- Preference Identifier: com.apple.dock -- Preference Key: no-glass -- Default value (boolean): NO -- Preference location: ~/Library/Preferences/com.apple.dock.plist set toggleBut to "Always Show as Full" set tZ to "always show the Trash as full?" set sTz to "YES" set bT to "You've decided to use the full trash behaviour." try set prValue to do shell script "defaults read com.apple.dock trash-full" if prValue = "1" then set prValue to "The Trash is set to behave as if it was full." set toggleBut to "Use Default Behaviour" set tZ to "use the default behaviour of the Trash?" set sTz to "NO" set bT to "You decided to switch to the 3D Glass Dock." else set prValue to "The Trash behaviour is set to be always full." end if on error set prValue to "The trash uses its default behaviour by default." end try display alert "Would you like to " & tZ message "If it is shown as full, the Trash behaves as if it was full so it will always show the full trash icon and will allow you to empty it even while it's empty." & return & return & prValue buttons {"Cancel", "Clear", toggleBut} default button 3 cancel button 1 if the button returned of the result is toggleBut then do shell script "defaults write com.apple.dock trash-full -bool " & sTz else do shell script "defaults delete com.apple.dock trash-full" set bT to "You've decided to clear the preference." end if tell application "System Events" to (name of every process) if the result contains "Dock" then tell application "System Events" display alert "Dock - Restart to see changes." message bT & " The Dock needs to be restarted in order to apply your changes. Would you like to restart the Dock now?" buttons {"Don't Restart", "Restart Dock"} cancel button 1 default button 2 do shell script "killall Dock" end tell else display dialog bT & " You'll be able to see the changes the next time the Dock is running" end if
source/crypto.adb
ytomino/openssl-ada
1
12756
<reponame>ytomino/openssl-ada package body Crypto is use type Ada.Streams.Stream_Element; procedure Value ( Image : String; Result : out Ada.Streams.Stream_Element_Array) is function Digit (C : Character) return Ada.Streams.Stream_Element is begin if C in '0' .. '9' then return Character'Pos (C) - Character'Pos ('0'); elsif C in 'a' .. 'f' then return Character'Pos (C) - Character'Pos ('a') + 10; elsif C in 'A' .. 'F' then return Character'Pos (C) - Character'Pos ('A') + 10; else raise Constraint_Error; end if; end Digit; begin for I in Result'Range loop declare Hi : constant Character := Image (2 * Integer (I) + 1); Lo : constant Character := Image (2 * Integer (I) + 2); begin Result (I) := Digit (Hi) * 16 + Digit (Lo); end; end loop; end Value; procedure Image ( Value : Ada.Streams.Stream_Element_Array; Result : out String) is Hex_Tab : constant array (0 .. 15) of Character := "0123456789abcdef"; begin for I in Value'Range loop declare Item : constant Ada.Streams.Stream_Element := Value (I); begin Result (2 * Integer (I) + 1) := Hex_Tab (Natural (Item / 16)); Result (2 * Integer (I) + 2) := Hex_Tab (Natural (Item mod 16)); end; end loop; end Image; end Crypto;
programs/oeis/165/A165254.asm
neoneye/loda
22
26436
; A165254: a(n) = 9 + n^17. ; 9,10,131081,129140172,17179869193,762939453134,16926659444745,232630513987216,2251799813685257,16677181699666578,100000000000000009,505447028499293780,2218611106740437001,8650415919381337942,30491346729331195913,98526125335693359384,295147905179352825865,827240261886336764186,2185911559738696531977,5480386857784802185948,13107200000000000000009,30041942495081691894750,66249952919459433152521,141050039560662968926112,290797794982682557415433,582076609134674072265634,1133827315385150725554185,2153693963075557766310756,3996561798506898509529097,7257147736730073114838118,12914016300000000000000009,22550116774162743178682920,38685626227668133590597641,65273511648264442971824682,108428035605965932354207753,177482997121587371826171884,286511799958070431838109705,456487940826035155404146926,718325266223569592115396617,1117116121846700839825703088,1717986918400000000000000009,2614120267500775228203738290,3937657486715347520027492361,5874403106360420018879553652,8683513829059386822166052873,12723679885609870147705078134,18487710785295216663082172425,26647936506962193439322192696,38115448583970168165554454537,54116956037952111668959660858,76293945312500000000000000009,106829942260164217198710340860,148613013882162475899836956681,205442259656281392806087233022,282288975128239507545882230793,385625479506907479095458984384,523837348053896201440996622345,707738052117387173214918768066,951208868148684143308060622857,1271991467017507741703714391428,1692665944473600000000000000009,2241853325254885342546716970630,2955688905823059073916326510601,3879621350651476389602631582792,5070602400912917605986812821513,6599743590836592050933837890634,8555529718761317069203003539465,11047694236668359048016134593036,14211879482945166685530717421577,18215225100020464195180876374798,23263051398720700000000000000009,29606831241262271996845213307600,37553674644104207641884714074121,47477585226700098686074966922962,59832787379950079889132344705033,75169468182139098644256591796884,94152329294455713577749264203785,117582402033097174749136828787606,146422644322690772477634553970697,181827912146592045345270516890968,225179981368524800000000000000009,278128389443693511257285776231770,342637971701861610711120383967241,421044084813170691455703581173532,516116642098754030145043477561353,631134233006543551770782470703134,769969763956872972714580855095305,937189241636402729052111114871776,1138165524602471949554948880990217,1379209096840925342723840168019938,1667718169966656900000000000000009,2012350701528798434504842105823140,2423221228050214638463506502909961,2912125755884410842622249251854502,3492798333840548618478838439870473,4181203352191774128676605224609384,4995868076798137881795553463894025,5958260438588051333281183456765546,7093217661806459180673880666800137,8429431933839268832485642678641708 pow $0,17 add $0,9
Transynther/x86/_processed/NONE/_xt_sm_/i7-8650U_0xd2.log_26_1023.asm
ljhsiun2/medusa
9
86064
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r11 push %r14 push %r15 push %rbp push %rcx push %rdi push %rsi lea addresses_normal_ht+0x112b0, %rsi lea addresses_WC_ht+0x17a30, %rdi clflush (%rdi) nop nop and %r14, %r14 mov $111, %rcx rep movsq nop nop nop sub $38868, %r11 lea addresses_WT_ht+0x1a2b0, %rsi lea addresses_WT_ht+0x1aab0, %rdi nop sub $35221, %r11 mov $75, %rcx rep movsl nop nop nop sub %rdi, %rdi lea addresses_normal_ht+0x15481, %rsi nop nop nop nop nop and $23169, %r14 movw $0x6162, (%rsi) and %r14, %r14 lea addresses_UC_ht+0xca30, %rdi nop dec %r15 mov (%rdi), %r11 nop and %rcx, %rcx lea addresses_UC_ht+0x18390, %r14 clflush (%r14) nop nop nop nop sub $13643, %rsi movw $0x6162, (%r14) dec %r14 lea addresses_A_ht+0x32b0, %rsi lea addresses_A_ht+0xd8b0, %rdi nop nop nop nop nop add $17928, %rbp mov $9, %rcx rep movsw nop nop nop sub %rbp, %rbp lea addresses_normal_ht+0x10c30, %rsi lea addresses_UC_ht+0x4cb0, %rdi nop nop nop nop sub %r10, %r10 mov $63, %rcx rep movsw nop nop nop nop xor $11297, %r10 pop %rsi pop %rdi pop %rcx pop %rbp pop %r15 pop %r14 pop %r11 pop %r10 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r13 push %r14 push %r15 push %rbp push %rdx // Store mov $0x3761e800000005b0, %r14 nop nop nop nop and $41902, %rdx movb $0x51, (%r14) nop nop nop xor %r15, %r15 // Store lea addresses_PSE+0x16ab0, %rbp add %r10, %r10 mov $0x5152535455565758, %r13 movq %r13, %xmm6 movups %xmm6, (%rbp) nop nop nop nop xor %rbp, %rbp // Store lea addresses_WT+0x12b26, %r11 nop nop add %r14, %r14 movl $0x51525354, (%r11) nop nop nop nop xor %r14, %r14 // Load lea addresses_US+0x104e8, %r15 nop dec %r14 mov (%r15), %rbp nop nop nop nop dec %r14 // Faulty Load lea addresses_PSE+0x16ab0, %rdx nop and %r15, %r15 movb (%rdx), %r11b lea oracles, %rdx and $0xff, %r11 shlq $12, %r11 mov (%rdx,%r11,1), %r11 pop %rdx pop %rbp pop %r15 pop %r14 pop %r13 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_NC', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_PSE', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_US', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_PSE', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 9, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 8, 'same': False}} {'58': 26} 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 58 */
src/compiling/ANTLR/grammar/Attributes.g4
jecassis/VSCode-SystemVerilog
75
4152
<gh_stars>10-100 grammar Attributes; import Identifiers; attribute_instance : '(*' attr_spec ( ',' attr_spec )* '*)' ; attr_spec : attr_name ( '=' constant_expression )? ; attr_name : identifier ;
gcc-gcc-7_3_0-release/gcc/testsuite/gnat.dg/misaligned_param_pkg.ads
best08618/asylo
7
29540
package Misaligned_Param_Pkg is pragma Elaborate_Body (Misaligned_Param_Pkg); end Misaligned_Param_Pkg;
test/asset/agda-stdlib-1.0/Codata/Musical/Notation.agda
omega12345/agda-mode
5
10184
------------------------------------------------------------------------ -- The Agda standard library -- -- Basic types related to coinduction ------------------------------------------------------------------------ {-# OPTIONS --without-K --safe #-} module Codata.Musical.Notation where open import Agda.Builtin.Coinduction public
src/index.agda
JLimperg/msc-thesis-code
5
16154
<filename>src/index.agda -- # A Reflexive Graph Model of Sized Types -- This is the formalisation of my M.Sc. thesis, available at -- https://limperg.de/paper/msc-thesis/ -- I define λST, a simply typed lambda calculus extended with sized types. I -- then give a reflexive graph model of λST which incorporates a notion of size -- irrelevance. This document lists all modules belonging to the development, -- roughly in dependency order. module index where -- ## Object Language -- The following modules define the syntax and type system of λST. -- Sizes, size contexts, size comparison. import Source.Size -- First formulation of size substitutions. import Source.Size.Substitution.Canonical -- Second formulation of size substitutions. import Source.Size.Substitution.Universe -- An abstraction for things which size substitutions can be applied to. import Source.Size.Substitution.Theory -- Types. import Source.Type -- Terms. import Source.Term -- ## Model -- The following modules define the reflexive graph model of λST. -- Propositional reflexive graphs and their morphisms. import Model.RGraph -- Model of sizes, size contexts, size comparison. import Model.Size -- Families of propositional reflexive graphs (PRGraph families) and their -- morphisms. import Model.Type.Core -- The terminal PRGraph family. import Model.Terminal -- Binary products of PRGraph families. import Model.Product -- Exponentials of PRGraph families (model of the function space). import Model.Exponential -- Model of size quantification. import Model.Quantification -- Model of the natural number type. import Model.Nat -- Model of the stream type. import Model.Stream -- Model of types and type contexts. import Model.Type -- Model of terms. import Model.Term -- ## Utility Library -- The following modules contain utility code. The majority of this is an -- implementation of (parts of) Homotopy Type Theory. import Util.Data.Product import Util.HoTT.Equiv import Util.HoTT.Equiv.Core import Util.HoTT.Equiv.Induction import Util.HoTT.FunctionalExtensionality import Util.HoTT.HLevel import Util.HoTT.HLevel.Core import Util.HoTT.Homotopy import Util.HoTT.Section import Util.HoTT.Singleton import Util.HoTT.Univalence import Util.HoTT.Univalence.Axiom import Util.HoTT.Univalence.Beta import Util.HoTT.Univalence.ContrFormulation import Util.HoTT.Univalence.Statement import Util.Induction.WellFounded import Util.Prelude import Util.Relation.Binary.Closure.SymmetricTransitive import Util.Relation.Binary.LogicalEquivalence import Util.Relation.Binary.PropositionalEquality import Util.Vec -- ## Miscellaneous -- Some terms of λST and their typing derivations. import Source.Examples -- Experiments with a hypothetical Agda without the ∞ < ∞ rule. import irreflexive-lt -- Ordinals as defined in the HoTT book. import Ordinal.HoTT -- Plump ordinals as presented by Shulman. import Ordinal.Shulman
libsrc/target/z9001/stdio/generic_console_MODE1.asm
dikdom/z88dk
1
243274
PUBLIC cls_MODE1 PUBLIC printc_MODE1 PUBLIC vpeek_MODE1 PUBLIC scrollup_MODE1 EXTERN __krt_cls EXTERN __krt_printc EXTERN __krt_vpeek EXTERN __krt_scrollup defc cls_MODE1 = __krt_cls defc printc_MODE1 = __krt_printc defc vpeek_MODE1 = __krt_vpeek defc scrollup_MODE1 = __krt_scrollup EXTERN __z9001_attr PUBLIC __krt_hook_cls_colour PUBLIC __krt_hook_set_colour PUBLIC __krt_hook_scrollup_colour EXTERN KRT_ADDRESS EXTERN KRT_ROWS EXTERN KRT_COLUMNS ; Set colour ; Entry: hl = screen address __krt_hook_set_colour: dec h dec h dec h dec h ld a,(__z9001_attr) ld (hl),a ret __krt_hook_cls_colour: ld hl,KRT_ADDRESS - 1024 ld de,KRT_ADDRESS - 1024 + 1 ld bc,+(KRT_COLUMNS * KRT_ROWS) - 1 ld a,(__z9001_attr) ld (hl),a ldir ret __krt_hook_scrollup_colour: ld hl,KRT_ADDRESS - 1024 + KRT_COLUMNS ld de,KRT_ADDRESS - 1024 ld bc,+(KRT_COLUMNS * (KRT_ROWS-1)) - 1 ldir ex de,hl ld d,h ld e,l inc de ld a,(__z9001_attr) ld (hl),a ld bc,KRT_COLUMNS - 1 ldir ret
Cubical/Codata/Conat/Bounded.agda
thomas-lamiaux/cubical
1
14530
<filename>Cubical/Codata/Conat/Bounded.agda {-# OPTIONS --cubical --no-import-sorts --safe --guardedness #-} module Cubical.Codata.Conat.Bounded where open import Cubical.Foundations.Equiv open import Cubical.Foundations.Function open import Cubical.Foundations.HLevels open import Cubical.Foundations.Isomorphism open import Cubical.Foundations.Prelude open import Cubical.Foundations.Transport open import Cubical.Foundations.Univalence open import Cubical.Codata.Conat.Base renaming (zero to czero; suc to csuc) open import Cubical.Codata.Conat.Properties open import Cubical.Data.Empty as Empty open import Cubical.Data.Sigma open import Cubical.Data.Sum hiding (rec) open import Cubical.Data.Unit open import Cubical.Relation.Nullary open import Cubical.Data.Nat as Nat import Cubical.Data.Fin.Recursive as Fin private variable ℓ : Level _≺_ : ℕ → Conat → Type _ _≺′_ : ℕ → Conat′ → Type _ n ≺ c = n ≺′ force c _ ≺′ czero = ⊥ zero ≺′ csuc _ = Unit suc n ≺′ csuc c = n ≺ c isProp≺ : ∀ n c → isProp (n ≺ c) isProp≺′ : ∀ n c → isProp (n ≺′ c) isProp≺ n c = isProp≺′ n (force c) isProp≺′ n czero = isProp⊥ isProp≺′ zero (csuc _) = isPropUnit isProp≺′ (suc n) (csuc c') = isProp≺ n c' isPropDep≺ : ∀ c → isPropDep (_≺ c) isPropDep≺ c = isOfHLevel→isOfHLevelDep 1 (λ n → isProp≺ n c) {_} {_} isPropDep≺′ : ∀ c → isPropDep (_≺′ c) isPropDep≺′ c = isOfHLevel→isOfHLevelDep 1 (λ n → isProp≺′ n c) {_} {_} private apart : ℕ → ℕ → Type apart zero zero = ⊥ apart (suc m) (suc n) = apart m n apart _ _ = Unit ≢→apart : (i j : ℕ) → ¬ i ≡ j → apart i j ≢→apart zero zero ¬p = ¬p refl ≢→apart (suc i) (suc j) ¬p = ≢→apart i j (¬p ∘ cong suc) ≢→apart zero (suc j) _ = _ ≢→apart (suc i) zero _ = _ apart→≢ : (i j : ℕ) → apart i j → ¬ i ≡ j apart→≢ (suc i) zero _ = snotz apart→≢ zero (suc j) _ = znots apart→≢ (suc i) (suc j) i#j = apart→≢ i j i#j ∘ cong predℕ isPropApart : ∀ m n → isProp (apart m n) isPropApart 0 0 = isProp⊥ isPropApart (suc m) (suc n) = isPropApart m n isPropApart (suc _) 0 = isPropUnit isPropApart 0 (suc _) = isPropUnit _#_ : ∀{P : ℕ → Type ℓ} → (l r : Σ ℕ P) → Type (m , _) # (n , _) = apart m n #→≢ : ∀{P : ℕ → Type ℓ} → (l r : Σ ℕ P) → l # r → ¬ l ≡ r #→≢ (i , _) (j , _) d = apart→≢ i j d ∘ cong fst isProp# : ∀{P : ℕ → Type ℓ} (l r : Σ ℕ P) → isProp (l # r) isProp# (m , _) (n , _) = isPropApart m n isProp#Depᵣ : ∀{P : ℕ → Type ℓ} (r : Σ ℕ P) → isPropDep (_# r) isProp#Depᵣ r = isOfHLevel→isOfHLevelDep 1 (λ l → isProp# l r) {_} {_} Bounded : Conat → Type Bounded m = Σ[ n ∈ ℕ ] n ≺ m Bounded′ : Conat′ → Type Bounded′ m = Σ[ n ∈ ℕ ] n ≺′ m discreteB′ : ∀ m → (i j : Bounded′ m) → (i ≡ j) ⊎ (i # j) discreteB′ m (i , i≺m) (j , j≺m) with discreteℕ i j ... | yes p = inl λ i → p i , isPropDep≺′ m i≺m j≺m p i ... | no ¬p = inr (≢→apart i j ¬p) ≺∞ : ∀ n → n ≺ ∞ ≺∞ zero = _ ≺∞ (suc n) = ≺∞ n Σ≺∞≃ℕ : Bounded ∞ ≃ ℕ Σ≺∞≃ℕ = isoToEquiv λ where .fun → fst .inv n → n , ≺∞ n .rightInv _ → refl .leftInv (n , p) i → λ where .fst → n .snd → isProp≺ n ∞ (≺∞ n) p i where open Iso Σ≺∞≡ℕ : Bounded ∞ ≡ ℕ Σ≺∞≡ℕ = ua Σ≺∞≃ℕ _≺?_ : ∀ n c → Dec (n ≺ c) n ≺? c with force c _ ≺? c | czero = no (idfun ⊥) zero ≺? c | csuc d = yes _ suc n ≺? c | csuc d = n ≺? d ≺-pred : ∀ n c → suc n ≺ c → n ≺ c ≺-pred n c sn≺c with force c ≺-pred zero c sn≺c | csuc d = _ ≺-pred (suc n) c sn≺c | csuc d = ≺-pred n d sn≺c ≺?-yes : ∀ n c → (p : n ≺ c) → n ≺? c ≡ yes p ≺?-yes n c p with force c ≺?-yes zero c p | csuc c' = refl ≺?-yes (suc n) c p | csuc c' = ≺?-yes n c' p ∀≺-same : ∀ m n → (∀ k → (k ≺ m) ≡ (k ≺ n)) → m ≡ n ∀≺-same m n ∀≺ i .force with force m | force n ... | czero | czero = czero ... | csuc o | csuc p = csuc (∀≺-same o p (∀≺ ∘ suc) i) ... | csuc o | czero = Empty.rec {A = csuc o ≡ czero} (transport (∀≺ 0) _) i ... | czero | csuc p = Empty.rec {A = czero ≡ csuc p} (transport⁻ (∀≺ 0) _) i Bounded→Fin : ∀ m → Bounded (embed m) → Fin.Fin m Bounded→Fin (suc m) (0 , 0≺m) = Fin.zero Bounded→Fin (suc m) (suc n , n≺m) = Fin.suc (Bounded→Fin m (n , n≺m)) module Untangle {m n} (f : Bounded′ (csuc m) → Bounded′ (csuc n)) (g : Bounded′ (csuc n) → Bounded′ (csuc m)) (rinv : section f g) (linv : retract f g) where bzro : ∀{k} → Bounded′ (csuc k) bzro = (zero , _) bsuc : ∀{k} → Bounded k → Bounded′ (csuc k) bsuc (l , l≺k) = (suc l , l≺k) #-f : ∀ v u → v # u → f v # f u #-f v u v#u with discreteB′ (csuc n) (f v) (f u) ... | inr fv#fu = fv#fu ... | inl fv≡fu = rec (#→≢ v u v#u (sym (linv v) ∙∙ cong g (fv≡fu) ∙∙ linv u)) #-g : ∀ v u → v # u → g v # g u #-g v u v#u with discreteB′ (csuc m) (g v) (g u) ... | inr gv#gu = gv#gu ... | inl gv≡gu = rec (#→≢ v u v#u (sym (rinv v) ∙∙ cong f (gv≡gu) ∙∙ rinv u)) #-fg : ∀ v u → v # u → f (g v) # f (g u) #-fg v u = #-f (g v) (g u) ∘ #-g v u #-gf : ∀ v u → v # u → g (f v) # g (f u) #-gf v u = #-g (f v) (f u) ∘ #-f v u default : ∀{k} → (v d : Bounded′ (csuc k)) → v # d → Bounded k default (suc l , l≺n) d _ = (l , l≺n) default (0 , _) (suc l , l≺n) _ = (l , l≺n) f- : Bounded m → Bounded n f- v = default (f (bsuc v)) (f bzro) (#-f (bsuc v) bzro _) g- : Bounded n → Bounded m g- v = default (g (bsuc v)) (g bzro) (#-g (bsuc v) bzro _) g-f-z : ∀ v u → g bzro ≡ bsuc v → g (bsuc u) ≡ bzro → g- u ≡ v g-f-z (l , l≺m) u p q with g (bsuc u) | g bzro | #-g (bsuc u) bzro _ ... | zero , _ | suc k , k≺m | #gf = λ where i .fst → predℕ (p i .fst) i .snd → isPropDep≺ m k≺m l≺m (cong (predℕ ∘ fst) p) i ... | w@(suc k , k≺m) | dg | #gf = rec (snotz (cong fst q)) g-f-s : ∀ v u → g (bsuc u) ≡ bsuc v → g- u ≡ v g-f-s (l , l≺m) u p with g (bsuc u) | #-g (bsuc u) bzro _ ... | suc k , k≺m | #gf = λ where i .fst → predℕ (p i .fst) i .snd → isPropDep≺ m k≺m l≺m (cong (predℕ ∘ fst) p) i ... | zero , k≺m | #gf = rec (znots (cong fst p)) g-f- : ∀ v → g- (f- v) ≡ v g-f- v@(i , i≺m) with f (bsuc v) | linv (bsuc v) | #-f (bsuc v) bzro _ ... | suc j , j≺m | p | #f = g-f-s v (j , j≺m) p ... | zero , _ | p | #f with f bzro | linv bzro ... | suc k , k≺n | q = g-f-z v (k , k≺n) p q f-g-z : ∀ v u → f bzro ≡ bsuc v → f (bsuc u) ≡ bzro → f- u ≡ v f-g-z (l , l≺n) u p q with f (bsuc u) | f bzro | #-f (bsuc u) bzro _ ... | zero , _ | suc k , k≺n | #fg = λ where i .fst → predℕ (p i .fst) i .snd → isPropDep≺ n k≺n l≺n (cong (predℕ ∘ fst) p) i ... | w@(suc k , k≺m) | df | #fg = rec (snotz (cong fst q)) f-g-s : ∀ v u → f (bsuc u) ≡ bsuc v → f- u ≡ v f-g-s (l , l≺n) u p with f (bsuc u) | #-f (bsuc u) bzro _ ... | suc k , k≺n | _ = λ where i .fst → predℕ (p i .fst) i .snd → isPropDep≺ n k≺n l≺n (cong (predℕ ∘ fst) p) i ... | zero , k≺m | _ = rec (znots (cong fst p)) f-g- : ∀ v → f- (g- v) ≡ v f-g- v@(i , i≺n) with g (bsuc v) | rinv (bsuc v) | #-g (bsuc v) bzro _ ... | suc j , j≺m | p | #g = f-g-s v (j , j≺m) p ... | zero , _ | p | #g with g bzro | rinv bzro ... | suc k , k≺m | q = f-g-z v (k , k≺m) p q open Iso iso- : Iso (Bounded m) (Bounded n) iso- .fun = f- iso- .inv = g- iso- .rightInv = f-g- iso- .leftInv = g-f- untangled : ∀{m n} → Iso (Bounded′ (csuc m)) (Bounded′ (csuc n)) → Iso (Bounded m) (Bounded n) untangled isom = Untangle.iso- fun inv rightInv leftInv where open Iso isom Bounded-inj-iso : ∀ m n → Iso (Bounded m) (Bounded n) → m ≡ n Bounded-inj-iso m n theIso i .force with force m | force n ... | czero | czero = czero ... | csuc l | csuc r = csuc (Bounded-inj-iso l r (untangled theIso) i) ... | czero | csuc r = rec {A = czero ≡ csuc r} (Iso.inv theIso (zero , _) .snd) i ... | csuc l | czero = rec {A = csuc l ≡ czero} (Iso.fun theIso (zero , _) .snd) i Bounded-inj : ∀ m n → Bounded m ≡ Bounded n → m ≡ n Bounded-inj m n = Bounded-inj-iso m n ∘ pathToIso
tools-src/gnu/gcc/gcc/ada/par-sync.adb
enfoTek/tomato.linksys.e2000.nvram-mod
80
11312
------------------------------------------------------------------------------ -- -- -- GNAT COMPILER COMPONENTS -- -- -- -- P A R . S Y N C -- -- -- -- B o d y -- -- -- -- $Revision$ -- -- -- Copyright (C) 1992-2001 Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- -- ware Foundation; either version 2, or (at your option) any later ver- -- -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- -- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- -- for more details. You should have received a copy of the GNU General -- -- Public License distributed with GNAT; see file COPYING. If not, write -- -- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, -- -- MA 02111-1307, USA. -- -- -- -- GNAT was originally developed by the GNAT team at New York University. -- -- Extensive contributions were provided by Ada Core Technologies Inc. -- -- -- ------------------------------------------------------------------------------ separate (Par) package body Sync is procedure Resync_Init; -- This routine is called on initiating a resynchronization action procedure Resync_Resume; -- This routine is called on completing a resynchronization action ------------------- -- Resync_Choice -- ------------------- procedure Resync_Choice is begin Resync_Init; -- Loop till we get a token that terminates a choice. Note that EOF is -- one such token, so we are sure to get out of this loop eventually! while Token not in Token_Class_Cterm loop Scan; end loop; Resync_Resume; end Resync_Choice; ------------------ -- Resync_Cunit -- ------------------ procedure Resync_Cunit is begin Resync_Init; while Token not in Token_Class_Cunit and then Token /= Tok_EOF loop Scan; end loop; Resync_Resume; end Resync_Cunit; ----------------------- -- Resync_Expression -- ----------------------- procedure Resync_Expression is Paren_Count : Int; begin Resync_Init; Paren_Count := 0; loop -- Terminating tokens are those in class Eterm and also RANGE, -- DIGITS or DELTA if not preceded by an apostrophe (if they are -- preceded by an apostrophe, then they are attributes). In addiion, -- at the outer parentheses level only, we also consider a comma, -- right parenthesis or vertical bar to terminate an expression. if Token in Token_Class_Eterm or else (Token in Token_Class_Atkwd and then Prev_Token /= Tok_Apostrophe) or else (Paren_Count = 0 and then (Token = Tok_Comma or else Token = Tok_Right_Paren or else Token = Tok_Vertical_Bar)) then -- A special check: if we stop on the ELSE of OR ELSE or the -- THEN of AND THEN, keep going, because this is not really an -- expression terminator after all. Also, keep going past WITH -- since this can be part of an extension aggregate if (Token = Tok_Else and then Prev_Token = Tok_Or) or else (Token = Tok_Then and then Prev_Token = Tok_And) or else Token = Tok_With then null; else exit; end if; end if; if Token = Tok_Left_Paren then Paren_Count := Paren_Count + 1; elsif Token = Tok_Right_Paren then Paren_Count := Paren_Count - 1; end if; Scan; -- past token to be skipped end loop; Resync_Resume; end Resync_Expression; ----------------- -- Resync_Init -- ----------------- procedure Resync_Init is begin -- The following check makes sure we do not get stuck in an infinite -- loop resynchonizing and getting nowhere. If we are called to do a -- resynchronize and we are exactly at the same point that we left off -- on the last resynchronize call, then we force at least one token to -- be skipped so that we make progress! if Token_Ptr = Last_Resync_Point then Scan; -- to skip at least one token end if; -- Output extra error message if debug R flag is set if Debug_Flag_R then Error_Msg_SC ("resynchronizing!"); end if; end Resync_Init; --------------------------- -- Resync_Past_Semicolon -- --------------------------- procedure Resync_Past_Semicolon is begin Resync_Init; loop -- Done if we are at a semicolon if Token = Tok_Semicolon then Scan; -- past semicolon exit; -- Done if we are at a token which normally appears only after -- a semicolon. One special glitch is that the keyword private is -- in this category only if it does NOT appear after WITH. elsif Token in Token_Class_After_SM and then (Token /= Tok_Private or else Prev_Token /= Tok_With) then exit; -- Otherwise keep going else Scan; end if; end loop; -- Fall out of loop with resyncrhonization complete Resync_Resume; end Resync_Past_Semicolon; ---------------------------------------------- -- Resync_Past_Semicolon_Or_To_Loop_Or_Then -- ---------------------------------------------- procedure Resync_Past_Semicolon_Or_To_Loop_Or_Then is begin Resync_Init; loop -- Done if at semicolon if Token = Tok_Semicolon then Scan; -- past the semicolon exit; -- Done if we are at a token which normally appears only after -- a semicolon. One special glitch is that the keyword private is -- in this category only if it does NOT appear after WITH. elsif (Token in Token_Class_After_SM and then (Token /= Tok_Private or else Prev_Token /= Tok_With)) then exit; -- Done if we are at THEN or LOOP elsif Token = Tok_Then or else Token = Tok_Loop then exit; -- Otherwise keep going else Scan; end if; end loop; -- Fall out of loop with resyncrhonization complete Resync_Resume; end Resync_Past_Semicolon_Or_To_Loop_Or_Then; ------------------- -- Resync_Resume -- ------------------- procedure Resync_Resume is begin -- Save resync point (see special test in Resync_Init) Last_Resync_Point := Token_Ptr; if Debug_Flag_R then Error_Msg_SC ("resuming here!"); end if; end Resync_Resume; -------------------- -- Resync_To_When -- -------------------- procedure Resync_To_When is begin Resync_Init; loop -- Done if at semicolon, WHEN or IS if Token = Tok_Semicolon or else Token = Tok_When or else Token = Tok_Is then exit; -- Otherwise keep going else Scan; end if; end loop; -- Fall out of loop with resyncrhonization complete Resync_Resume; end Resync_To_When; --------------------------- -- Resync_Semicolon_List -- --------------------------- procedure Resync_Semicolon_List is Paren_Count : Int; begin Resync_Init; Paren_Count := 0; loop if Token = Tok_EOF or else Token = Tok_Semicolon or else Token = Tok_Is or else Token in Token_Class_After_SM then exit; elsif Token = Tok_Left_Paren then Paren_Count := Paren_Count + 1; elsif Token = Tok_Right_Paren then if Paren_Count = 0 then exit; else Paren_Count := Paren_Count - 1; end if; end if; Scan; end loop; Resync_Resume; end Resync_Semicolon_List; end Sync;
bin/themeOpenTerminals.scpt
Flare576/themes
0
4441
<reponame>Flare576/themes # yoinnked from https://superuser.com/questions/187591/os-x-terminal-command-to-change-color-themes on run argv tell application "Terminal" repeat with w from 1 to count windows repeat with t from 1 to count tabs of window w set current settings of tab t of window w to (first settings set whose name is item 1 of argv) end repeat end repeat end tell end run
oeis/173/A173098.asm
neoneye/loda-programs
11
93189
; A173098: a(1)=1, a(2)=2, a(n)=2*a(n-2)*a(n-1)-a(n-1). ; Submitted by <NAME>(s2) ; 1,2,2,6,18,198,6930,2737350,37936933650,207693292716721350,15758493330480878908260133650,6545866736124132578837836330405530973356721350 mov $1,8 mov $2,8 lpb $0 sub $0,1 mod $0,14 mov $3,$2 mov $2,$1 mul $1,$3 div $1,4 sub $2,4 lpe mov $0,$1 div $0,8
acsl2r/grammar/Acsl.g4
acsl2r/acsl2r
1
3445
grammar Acsl; acsl : comment+ PROGRAM (program)* END comment+ #HeadedProgramWithComments | comment+ PROGRAM (program)* END #HeadedProgramWithoutComments | PROGRAM (program)* END comment+ #ProgramWithComments | PROGRAM (program)* END #ProgramWithoutComments ; program : initial | dynamic | discrete | terminal | statement | comment ; statement : constant | schedule | interval | algorithm | maxterval | minterval | cinterval | nsteps | expr_or_assign | if_block | if_logical | table | type | parameter | do_continue | go_to | call | variable ; discrete : DISCRETE ID (initial|procedural|statement|label|comment)* END comment #DiscreteWithComment | DISCRETE ID (initial|procedural|statement|label|comment)* END #DiscreteWithoutCommment ; interval : INTERVAL expr_or_assign ; initial : INITIAL (statement|label|comment)* END comment #InitialWithComment | INITIAL (statement|label|comment)* END #InitialWithoutComment ; terminal : TERMINAL (statement|label|comment)* END comment #TerminalWithComment | TERMINAL (statement|label|comment)* END #TerminalWithoutComment ; constant : CONSTANT expr_or_assign ; schedule : SCHEDULE expr ; dynamic : DYNAMIC (initial|derivative|discrete|procedural|statement|label|comment)* END comment #DynamicWithComment | DYNAMIC (initial|derivative|discrete|procedural|statement|label|comment)* END #DynamicWithoutComment ; algorithm : ALGORITHM expr_or_assign ; maxterval : MAXTERVAL expr_or_assign ; minterval : MINTERVAL expr_or_assign ; cinterval : CINTERVAL expr_or_assign ; nsteps : NSTEPS expr_or_assign ; derivative : DERIVATIVE (initial|procedural|statement|label|comment)* END comment #DerivativeWithComment | DERIVATIVE (initial|procedural|statement|label|comment)* END #DerivativeWithoutComment ; if_block : IF '(' expr ')' then_block else_if_end_block #IfBlock ; else_if_end_block : (END|ENDIF|ENDSPACEIF) #ElseIfEndBlockEnd | ELSE if_block #ElseIfEndBlockElseIf | ELSE (statement|label|comment)* else_if_end_block #ElseIfEndBlockElse ; then_block : THEN (';')? (statement|label|comment)* #ThenBlock ; if_logical : IF '(' expr ')' statement #IfLogical ; table : TABLE expr COMMA expr COMMA expr SLASH expr (COMMA expr)* SLASH ; parameter : PARAMETER '(' expr_or_assign (COMMA expr_or_assign)* ')' (comment)? ; do_continue : DO expr expr_or_assign COMMA expr COMMA expr (statement|comment)* expr ':' CONTINUE #DoContinueIncr | DO expr expr_or_assign COMMA expr (statement|comment)* expr ':' CONTINUE #DoContinue ; go_to : GO TO expr #GoTo ; label : expr ':' statement #LabelStatement | expr ':' CONTINUE #LabelContinue ; call : CALL expr_or_assign ; variable : VARIABLE expr_or_assign ; type : DIMENSION expr (COMMA expr)* #DimensionType | REAL expr (COMMA expr)* #RealType | DOUBLEPRECISION expr (COMMA expr)* #DoublePrecisionType | INTEGER expr (COMMA expr)* #IntegerType | LOGICAL expr (COMMA expr)* #LogicalType | CHARACTER expr (COMMA expr)* #CharacterType ; procedural : PROCEDURAL ('(' ID? (COMMA ID)* EQUALS? ID? (COMMA ID)* ')')? (statement|comment)* END comment #ProceduralWithComment | PROCEDURAL ('(' ID? (COMMA ID)* EQUALS? ID? (COMMA ID)* ')')? (statement|comment)* END #ProceduralWithoutComment ; expr_or_assign : expr EQUALS expr_or_assign (';')* comment #AssignExprOrAssignWithComment | expr EQUALS expr_or_assign (';')* #AssignExprOrAssign | expr EQUALS expr COMMA expr (COMMA expr)* comment #ListExprOrAssignWithComment | expr EQUALS expr COMMA expr (COMMA expr)* #ListExprOrAssign | expr EQUALS expr COMMA expr EQUALS expr (COMMA expr EQUALS expr)* comment #MultipleExprOrAssignWithComment | expr EQUALS expr COMMA expr EQUALS expr (COMMA expr EQUALS expr)* #MultipleExprOrAssign | expr EQUALS expr COMMA expr (COMMA expr)* #ListExprOrAssign | expr #ExprExprOrAssign ; expr : <assoc=right> expr ('**'|'^') expr #ExpExpr | ('-'|'+') expr #UnaryExpr | expr ('*'|'/') expr #MulDivExpr | expr ('+'|'-') expr #AddSubExpr | NOT expr #NotExpr | (TRUE|FALSE) #BoolExpr | expr (AND|EQ|GE|GT|LE|LT|NE|OR|XOR|AT) expr #InfixExpr | ID '(' (expr (COMMA expr)*)? ')' #FnExpr | '(' expr ')' #SubExpr | STRING #StrExpr | ID #IdExpr | INT #IntExpr | FLOAT #FloatExpr ; comment : COMMENT ; fragment A : ('a' | 'A') ; fragment B : ('b' | 'B') ; fragment C : ('c' | 'C') ; fragment D : ('d' | 'D') ; fragment E : ('e' | 'E') ; fragment F : ('f' | 'F') ; fragment G : ('g' | 'G') ; fragment H : ('h' | 'H') ; fragment I : ('i' | 'I') ; fragment J : ('j' | 'J') ; fragment K : ('k' | 'K') ; fragment L : ('l' | 'L') ; fragment M : ('m' | 'M') ; fragment N : ('n' | 'N') ; fragment O : ('o' | 'O') ; fragment P : ('p' | 'P') ; fragment Q : ('q' | 'Q') ; fragment R : ('r' | 'R') ; fragment S : ('s' | 'S') ; fragment T : ('t' | 'T') ; fragment U : ('u' | 'U') ; fragment V : ('v' | 'V') ; fragment W : ('w' | 'W') ; fragment X : ('x' | 'X') ; fragment Y : ('y' | 'Y') ; fragment Z : ('z' | 'Z') ; PROGRAM : P R O G R A M ; END : E N D ; DISCRETE : D I S C R E T E ; INTERVAL : I N T E R V A L ; SCHEDULE : S C H E D U L E ; INITIAL : I N I T I A L ; TERMINAL : T E R M I N A L ; CONSTANT : C O N S T A N T ; DYNAMIC : D Y N A M I C ; ALGORITHM : A L G O R I T H M ; MAXTERVAL : M A X T E R V A L ; MINTERVAL : M I N T E R V A L ; CINTERVAL : C I N T E R V A L ; NSTEPS : N S T E P S ; DERIVATIVE : D E R I V A T I V E ; AND : '__' A N D ; EQ : '__' E Q ; GE : '__' G E ; GT : '__' G T | GREATERTHAN ; LE : '__' L E ; LT : '__' L T | LESSTHAN ; NE : '__' N E ; OR : '__' O R ; XOR : '__' X O R ; AT : '__' A T ; IF : I F ; THEN : T H E N ; ELSE : E L S E ; ENDIF : E N D I F ; ENDSPACEIF : E N D (' ')+ I F ; PROCEDURAL : P R O C E D U R A L ; TRUE : '__' T R U E ; FALSE : '__' F A L S E ; NOT : '__' N O T ; TABLE : T A B L E ; PARAMETER : P A R A M E T E R ; DO : D O ; CONTINUE : C O N T I N U E ; GO : G O ; TO : T O ; CALL : C A L L ; VARIABLE : V A R I A B L E ; DIMENSION : D I M E N S I O N ; REAL : R E A L ; DOUBLEPRECISION : D O U B L E P R E C I S I O N ; INTEGER : I N T E G E R ; LOGICAL : L O G I C A L ; CHARACTER : C H A R A C T E R ; STRING : '\'' (~['\\])* '\'' ; INT : DIGIT+ ; FLOAT : DIGIT+ '.' DIGIT* EXPONENT? | DIGIT+ EXPONENT | '.' DIGIT+ EXPONENT? ; ID : (LETTER|'_') (LETTER|DIGIT|'_')* | LETTER (LETTER|DIGIT|'_')* ; fragment DIGIT : '0'..'9' ; fragment EXPONENT : ('E' | 'e') ('+' | '-')? INT ; fragment LETTER : [a-zA-Z] ; EQUALS : '=' ; LESSTHAN : '<' ; GREATERTHAN : '>' ; COMMA : ',' ; SLASH : '/' ; COMMENT : '!' ~[\r\n]* '\r'? '\n' ; WS : [ \t\n\r]+ -> skip ;
test/Succeed/Issue1470.agda
shlevy/agda
3
4315
-- Andreas, 2015-03-26 -- Andrea discovered that unfold for Lists is typable with sized types -- (and termination checks). -- Dually, fold for Streams should work. Therefore, the restriction -- of coinductive records to recursive records should be lifted. {-# OPTIONS --copatterns #-} open import Common.Size -- StreamF A X i = ∀j<i. A × X j record StreamF (A : Set) (X : Size → Set) (i : Size) : Set where coinductive field head : A tail : ∀{j : Size< i} → X j module F = StreamF record Stream (A : Set) (i : Size) : Set where coinductive field head : A tail : ∀{j : Size< i} → Stream A j module S = Stream module Inlined {A T} (f : ∀ i → StreamF A T i → T i) where fix : ∀ i → Stream A i → StreamF A T i F.head (fix i s) = S.head s F.tail (fix i s) {j = j} = f j (fix j (S.tail s {j = j})) module Mutual {A T} (f : ∀ i → StreamF A T i → T i) where mutual fold : ∀ i → Stream A i → T i fold i s = f i (h i s) h : ∀ i → Stream A i → StreamF A T i F.head (h i s) = S.head s F.tail (h i s) {j = j} = fold j (S.tail s {j = j}) module Local where fold : ∀{A T} → (f : ∀ i → StreamF A T i → T i) → ∀ i → Stream A i → T i fold {A} {T} f i s = f i (h i s) where h : ∀ i → Stream A i → StreamF A T i F.head (h i s) = S.head s F.tail (h i s) {j = j} = fold f j (S.tail s {j = j}) -- Unfold for lists -- ListF A X i = ⊤ + ∃j<i. A × X j data ListF (A : Set) (X : Size → Set) (i : Size) : Set where [] : ListF A X i _∷_ : ∀{j : Size< i} (a : A) (xs : X j) → ListF A X i data List (A : Set) (i : Size) : Set where [] : List A i _∷_ : ∀{j : Size< i} (a : A) (xs : List A j) → List A i module With where unfold : ∀{A}{S : Size → Set} → (f : ∀ i → S i → ListF A S i) → ∀ i → S i → List A i unfold f i s with f i s ... | [] = [] ... | _∷_ {j = j} a s' = a ∷ unfold f j s' unfold : ∀{A}{S : Size → Set} → (f : ∀ i → S i → ListF A S i) → ∀ i → S i → List A i unfold {A}{S} f i s = aux (f i s) where aux : ListF A S i → List A i aux [] = [] aux (_∷_ {j = j} a s') = a ∷ unfold f j s'
Transynther/x86/_processed/AVXALIGN/_st_/i3-7100_9_0x84_notsx.log_142_2668.asm
ljhsiun2/medusa
9
101207
.global s_prepare_buffers s_prepare_buffers: push %r11 push %r13 push %r15 push %r8 push %r9 push %rbp push %rcx push %rdi push %rdx push %rsi lea addresses_D_ht+0x8fcf, %rbp nop nop nop nop nop lfence mov $0x6162636465666768, %r11 movq %r11, (%rbp) nop nop nop nop cmp $32242, %r13 lea addresses_normal_ht+0x1afef, %r15 clflush (%r15) nop sub $32430, %r8 mov (%r15), %r11 nop sub %r13, %r13 lea addresses_D_ht+0x40b, %r13 nop nop nop nop nop and %rbp, %rbp mov $0x6162636465666768, %r15 movq %r15, %xmm5 vmovups %ymm5, (%r13) nop sub %r8, %r8 lea addresses_WT_ht+0x1d33b, %r9 and %rbp, %rbp mov $0x6162636465666768, %r11 movq %r11, %xmm2 vmovups %ymm2, (%r9) nop nop cmp $53129, %rbp lea addresses_UC_ht+0x18885, %r8 nop nop nop inc %r15 movw $0x6162, (%r8) nop nop nop nop and %r9, %r9 lea addresses_normal_ht+0x1a58b, %r9 nop and $33110, %rdx mov (%r9), %r13d nop nop and %r13, %r13 lea addresses_WC_ht+0x758b, %rsi lea addresses_UC_ht+0x172c3, %rdi nop nop nop nop add $36796, %r11 mov $58, %rcx rep movsl nop add %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbp pop %r9 pop %r8 pop %r15 pop %r13 pop %r11 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %r8 push %r9 push %rax push %rbp push %rdi // Load lea addresses_normal+0xd98b, %r11 cmp %rax, %rax mov (%r11), %r9w nop nop nop nop cmp %rax, %rax // Load mov $0x6d872500000003b9, %rdi nop nop nop nop nop xor $27710, %r11 mov (%rdi), %rbp nop nop nop cmp %rax, %rax // Store lea addresses_WC+0x298b, %rax and $50793, %r12 movl $0x51525354, (%rax) and $36405, %r8 // Faulty Load lea addresses_normal+0xd98b, %r12 nop cmp %rbp, %rbp mov (%r12), %r11d lea oracles, %r12 and $0xff, %r11 shlq $12, %r11 mov (%r12,%r11,1), %r11 pop %rdi pop %rbp pop %rax pop %r9 pop %r8 pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_normal', 'same': True, 'size': 2, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_NC', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 4, 'congruent': 0, 'NT': True, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 8, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_D_ht', 'same': False, 'size': 32, 'congruent': 7, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_WT_ht', 'same': False, 'size': 32, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_UC_ht', 'same': False, 'size': 2, 'congruent': 1, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'src': {'type': 'addresses_normal_ht', 'same': False, 'size': 4, 'congruent': 9, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 2, 'same': False}, 'OP': 'REPM'} {'34': 142} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
chapter2/call_hook.asm
SoylentNews/retromalware
2
97202
<reponame>SoylentNews/retromalware ; Call hook - calls int 66 and exits ; For use with the TSR example in this directory ; ; This code is in the public domain via the CC0 public domain decleration ; See LICENSE in the top level directory for more information ; ; Compile with NASM to COM: i.e. nasm call_hook -o callhook.com section .text org 0x100 int 0x66 mov ah, 0x4C mov al, 0 int 0x21
src/Lens/Non-dependent/Higher.agda
nad/dependent-lenses
3
12138
------------------------------------------------------------------------ -- Higher lenses ------------------------------------------------------------------------ {-# OPTIONS --cubical #-} import Equality.Path as P module Lens.Non-dependent.Higher {e⁺} (eq : ∀ {a p} → P.Equality-with-paths a p e⁺) where open P.Derived-definitions-and-properties eq open import Logical-equivalence using (_⇔_) open import Prelude open import Bijection equality-with-J as Bij using (_↔_) import Bool equality-with-J as Bool open import Circle eq as Circle using (𝕊¹) open import Coherently-constant eq as C using (Coherently-constant) open import Equality.Decidable-UIP equality-with-J open import Equality.Decision-procedures equality-with-J open import Equality.Path.Isomorphisms eq open import Equivalence equality-with-J as Eq using (_≃_; Is-equivalence) import Equivalence.Half-adjoint equality-with-J as HA open import Function-universe equality-with-J as F hiding (id; _∘_) open import H-level equality-with-J as H-level open import H-level.Closure equality-with-J open import H-level.Truncation.Propositional eq as Trunc hiding (Coherently-constant) import Nat equality-with-J as Nat open import Preimage equality-with-J as Preimage using (_⁻¹_) open import Quotient eq open import Surjection equality-with-J using (_↠_) open import Univalence-axiom equality-with-J open import Lens.Non-dependent eq as Non-dependent hiding (no-first-projection-lens; no-singleton-projection-lens) import Lens.Non-dependent.Traditional eq as Traditional private variable a b c ℓ p r : Level A A₁ A₂ B B₁ B₂ : Type a P : A → Type p ------------------------------------------------------------------------ -- Higher lenses -- Higher lenses. -- -- A little history: The "lenses" in Lens.Non-dependent.Bijection are -- not very well-behaved. I had previously considered some other -- variants, when <NAME> suggested that I should look at Paolo -- Capriotti's higher lenses, and that I could perhaps use R → ∥ B ∥. -- This worked out nicely. -- -- For performance reasons η-equality is turned off for this record -- type. One can match on the constructor to block evaluation. record Lens (A : Type a) (B : Type b) : Type (lsuc (a ⊔ b)) where constructor ⟨_,_,_⟩ pattern no-eta-equality field -- Remainder type. R : Type (a ⊔ b) -- Equivalence. equiv : A ≃ (R × B) -- The proof of (mere) inhabitance. inhabited : R → ∥ B ∥ -- Remainder. remainder : A → R remainder a = proj₁ (_≃_.to equiv a) -- Getter. get : A → B get a = proj₂ (_≃_.to equiv a) -- Setter. set : A → B → A set a b = _≃_.from equiv (remainder a , b) -- A combination of get and set. modify : (B → B) → A → A modify f x = set x (f (get x)) -- The setter leaves the remainder unchanged. remainder-set : ∀ a b → remainder (set a b) ≡ remainder a remainder-set a b = proj₁ (_≃_.to equiv (_≃_.from equiv (remainder a , b))) ≡⟨ cong proj₁ (_≃_.right-inverse-of equiv (remainder a , b)) ⟩∎ remainder a ∎ -- Lens laws. get-set : ∀ a b → get (set a b) ≡ b get-set a b = proj₂ (_≃_.to equiv (_≃_.from equiv (remainder a , b))) ≡⟨ cong proj₂ (_≃_.right-inverse-of equiv (remainder a , b)) ⟩∎ proj₂ (remainder a , b) ∎ set-get : ∀ a → set a (get a) ≡ a set-get a = _≃_.from equiv (_≃_.to equiv a) ≡⟨ _≃_.left-inverse-of equiv a ⟩∎ a ∎ set-set : ∀ a b₁ b₂ → set (set a b₁) b₂ ≡ set a b₂ set-set a b₁ b₂ = _≃_.from equiv (remainder (set a b₁) , b₂) ≡⟨ cong (λ r → _≃_.from equiv (r , b₂)) (remainder-set a b₁) ⟩∎ _≃_.from equiv (remainder a , b₂) ∎ -- The remainder function is surjective. remainder-surjective : Surjective remainder remainder-surjective r = ∥∥-map (λ b → _≃_.from equiv (r , b) , (remainder (_≃_.from equiv (r , b)) ≡⟨⟩ proj₁ (_≃_.to equiv (_≃_.from equiv (r , b))) ≡⟨ cong proj₁ (_≃_.right-inverse-of equiv (r , b)) ⟩∎ r ∎)) (inhabited r) -- Traditional lens. traditional-lens : Traditional.Lens A B traditional-lens = record { get = get ; set = set ; get-set = get-set ; set-get = set-get ; set-set = set-set } -- The following two coherence laws, which do not necessarily hold -- for traditional lenses (see -- Traditional.getter-equivalence-but-not-coherent), hold -- unconditionally for higher lenses. get-set-get : ∀ a → cong get (set-get a) ≡ get-set a (get a) get-set-get a = cong get (set-get a) ≡⟨⟩ cong (proj₂ ∘ _≃_.to equiv) (_≃_.left-inverse-of equiv a) ≡⟨ sym $ cong-∘ _ _ (_≃_.left-inverse-of equiv _) ⟩ cong proj₂ (cong (_≃_.to equiv) (_≃_.left-inverse-of equiv a)) ≡⟨ cong (cong proj₂) $ _≃_.left-right-lemma equiv _ ⟩ cong proj₂ (_≃_.right-inverse-of equiv (_≃_.to equiv a)) ≡⟨⟩ get-set a (get a) ∎ get-set-set : ∀ a b₁ b₂ → cong get (set-set a b₁ b₂) ≡ trans (get-set (set a b₁) b₂) (sym (get-set a b₂)) get-set-set a b₁ b₂ = cong get (set-set a b₁ b₂) ≡⟨⟩ cong get (cong (λ r → _≃_.from equiv (r , b₂)) (remainder-set a b₁)) ≡⟨ elim₁ (λ {r} eq → cong get (cong (λ r → _≃_.from equiv (r , b₂)) eq) ≡ trans (cong proj₂ (_≃_.right-inverse-of equiv (r , b₂))) (sym (get-set a b₂))) ( cong get (cong (λ r → _≃_.from equiv (r , b₂)) (refl (remainder a))) ≡⟨ trans (cong (cong get) $ cong-refl _) $ cong-refl _ ⟩ refl (get (set a b₂)) ≡⟨ sym $ trans-symʳ _ ⟩ trans (get-set a b₂) (sym (get-set a b₂)) ≡⟨⟩ trans (cong proj₂ (_≃_.right-inverse-of equiv (remainder a , b₂))) (sym (get-set a b₂)) ∎) (remainder-set a b₁) ⟩ trans (cong proj₂ (_≃_.right-inverse-of equiv (remainder (set a b₁) , b₂))) (sym (get-set a b₂)) ≡⟨⟩ trans (get-set (set a b₁) b₂) (sym (get-set a b₂)) ∎ -- A somewhat coherent lens. coherent-lens : Traditional.Coherent-lens A B coherent-lens = record { lens = traditional-lens ; get-set-get = get-set-get ; get-set-set = get-set-set } instance -- Higher lenses have getters and setters. has-getter-and-setter : Has-getter-and-setter (Lens {a = a} {b = b}) has-getter-and-setter = record { get = Lens.get ; set = Lens.set } ------------------------------------------------------------------------ -- Simple definitions related to lenses -- An η-law for lenses. η : (l : Lens A B) → ⟨ Lens.R l , Lens.equiv l , Lens.inhabited l ⟩ ≡ l η ⟨ _ , _ , _ ⟩ = refl _ -- Lens can be expressed as a nested Σ-type. Lens-as-Σ : {A : Type a} {B : Type b} → Lens A B ≃ ∃ λ (R : Type (a ⊔ b)) → (A ≃ (R × B)) × (R → ∥ B ∥) Lens-as-Σ = Eq.↔→≃ (λ l → R l , equiv l , inhabited l) (λ (R , equiv , inhabited) → record { R = R ; equiv = equiv ; inhabited = inhabited }) refl η where open Lens -- An equality rearrangement lemma. left-inverse-of-Lens-as-Σ : (l : Lens A B) → _≃_.left-inverse-of Lens-as-Σ l ≡ η l left-inverse-of-Lens-as-Σ l@(⟨ _ , _ , _ ⟩) = _≃_.left-inverse-of Lens-as-Σ l ≡⟨⟩ _≃_.left-inverse-of Lens-as-Σ (_≃_.from Lens-as-Σ (_≃_.to Lens-as-Σ l)) ≡⟨ sym $ _≃_.right-left-lemma Lens-as-Σ _ ⟩ cong (_≃_.from Lens-as-Σ) (_≃_.right-inverse-of Lens-as-Σ (_≃_.to Lens-as-Σ l)) ≡⟨⟩ cong (_≃_.from Lens-as-Σ) (refl _) ≡⟨ cong-refl _ ⟩∎ refl _ ∎ -- Isomorphisms can be converted into lenses. isomorphism-to-lens : {A : Type a} {B : Type b} {R : Type (a ⊔ b)} → A ↔ R × B → Lens A B isomorphism-to-lens {A = A} {B = B} {R = R} iso = record { R = R × ∥ B ∥ ; equiv = A ↔⟨ iso ⟩ R × B ↔⟨ F.id ×-cong inverse ∥∥×↔ ⟩ R × ∥ B ∥ × B ↔⟨ ×-assoc ⟩□ (R × ∥ B ∥) × B □ ; inhabited = proj₂ } -- Converts equivalences to lenses. ≃→lens : {A : Type a} {B : Type b} → A ≃ B → Lens A B ≃→lens {a = a} {A = A} {B = B} A≃B = record { R = ∥ ↑ a B ∥ ; equiv = A ↝⟨ A≃B ⟩ B ↝⟨ inverse ∥∥×≃ ⟩ ∥ B ∥ × B ↔⟨ ∥∥-cong (inverse Bij.↑↔) ×-cong F.id ⟩□ ∥ ↑ a B ∥ × B □ ; inhabited = ∥∥-map lower } -- Converts equivalences between types with the same universe level to -- lenses. ≃→lens′ : {A B : Type a} → A ≃ B → Lens A B ≃→lens′ {a = a} {A = A} {B = B} A≃B = record { R = ∥ B ∥ ; equiv = A ↝⟨ A≃B ⟩ B ↝⟨ inverse ∥∥×≃ ⟩□ ∥ B ∥ × B □ ; inhabited = id } ------------------------------------------------------------------------ -- An example -- A lens from a type in a smaller universe to a type in a (possibly) -- larger universe. ↑-lens : Lens A (↑ ℓ A) ↑-lens = ≃→lens (Eq.↔⇒≃ $ inverse Bij.↑↔) ------------------------------------------------------------------------ -- Some results related to the remainder type -- The inhabited field is equivalent to stating that the remainder -- function is surjective. inhabited≃remainder-surjective : {A : Type a} {B : Type b} {R : Type (a ⊔ b)} (equiv : A ≃ (R × B)) → let remainder : A → R remainder a = proj₁ (_≃_.to equiv a) in (R → ∥ B ∥) ≃ Surjective remainder inhabited≃remainder-surjective eq = ∀-cong ext λ r → ∥∥-cong-⇔ (record { to = λ b → _≃_.from eq (r , b) , (proj₁ (_≃_.to eq (_≃_.from eq (r , b))) ≡⟨ cong proj₁ $ _≃_.right-inverse-of eq _ ⟩∎ r ∎) ; from = proj₂ ∘ _≃_.to eq ∘ proj₁ }) -- The remainder type of a lens l : Lens A B is, for every b : B, -- equivalent to the preimage of the getter with respect to b. -- -- This result was pointed out to me by <NAME>. remainder≃get⁻¹ : (l : Lens A B) (b : B) → Lens.R l ≃ Lens.get l ⁻¹ b remainder≃get⁻¹ l b = Eq.↔→≃ (λ r → _≃_.from equiv (r , b) , (get (_≃_.from equiv (r , b)) ≡⟨⟩ proj₂ (_≃_.to equiv (_≃_.from equiv (r , b))) ≡⟨ cong proj₂ $ _≃_.right-inverse-of equiv _ ⟩∎ b ∎)) (λ (a , _) → remainder a) (λ (a , get-a≡b) → let lemma = cong get (trans (cong (set a) (sym get-a≡b)) (_≃_.left-inverse-of equiv _)) ≡⟨ cong-trans _ _ (_≃_.left-inverse-of equiv _) ⟩ trans (cong get (cong (set a) (sym get-a≡b))) (cong get (_≃_.left-inverse-of equiv _)) ≡⟨ cong₂ trans (cong-∘ _ _ (sym get-a≡b)) (sym $ cong-∘ _ _ (_≃_.left-inverse-of equiv _)) ⟩ trans (cong (get ∘ set a) (sym get-a≡b)) (cong proj₂ (cong (_≃_.to equiv) (_≃_.left-inverse-of equiv _))) ≡⟨ cong₂ (λ p q → trans p (cong proj₂ q)) (cong-sym _ get-a≡b) (_≃_.left-right-lemma equiv _) ⟩ trans (sym (cong (get ∘ set a) get-a≡b)) (cong proj₂ (_≃_.right-inverse-of equiv _)) ≡⟨ sym $ sym-sym _ ⟩ sym (sym (trans (sym (cong (get ∘ set a) get-a≡b)) (cong proj₂ (_≃_.right-inverse-of equiv _)))) ≡⟨ cong sym $ sym-trans _ (cong proj₂ (_≃_.right-inverse-of equiv _)) ⟩ sym (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (sym (sym (cong (get ∘ set a) get-a≡b)))) ≡⟨ cong (λ eq → sym (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) eq)) $ sym-sym (cong (get ∘ set a) get-a≡b) ⟩∎ sym (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong (get ∘ set a) get-a≡b)) ∎ in Σ-≡,≡→≡ (_≃_.from equiv (remainder a , b) ≡⟨⟩ set a b ≡⟨ cong (set a) (sym get-a≡b) ⟩ set a (get a) ≡⟨ set-get a ⟩∎ a ∎) (subst (λ a → get a ≡ b) (trans (cong (set a) (sym get-a≡b)) (set-get a)) (cong proj₂ $ _≃_.right-inverse-of equiv (remainder a , b)) ≡⟨⟩ subst (λ a → get a ≡ b) (trans (cong (set a) (sym get-a≡b)) (_≃_.left-inverse-of equiv _)) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ subst-∘ _ _ (trans _ (_≃_.left-inverse-of equiv _)) ⟩ subst (_≡ b) (cong get (trans (cong (set a) (sym get-a≡b)) (_≃_.left-inverse-of equiv _))) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ cong (λ eq → subst (_≡ b) eq (cong proj₂ $ _≃_.right-inverse-of equiv _)) lemma ⟩ subst (_≡ b) (sym (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong (get ∘ set a) get-a≡b))) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ subst-trans (trans _ (cong (get ∘ set a) get-a≡b)) ⟩ trans (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong (get ∘ set a) get-a≡b)) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ elim¹ (λ eq → trans (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong (get ∘ set a) eq)) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡ eq) ( trans (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong (get ∘ set a) (refl _))) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ cong (λ eq → trans (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) eq) (cong proj₂ $ _≃_.right-inverse-of equiv _)) $ cong-refl _ ⟩ trans (trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (refl _)) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ cong (flip trans _) $ trans-reflʳ _ ⟩ trans (sym (cong proj₂ (_≃_.right-inverse-of equiv _))) (cong proj₂ $ _≃_.right-inverse-of equiv _) ≡⟨ trans-symˡ (cong proj₂ (_≃_.right-inverse-of equiv _)) ⟩∎ refl _ ∎) get-a≡b ⟩∎ get-a≡b ∎)) (λ r → remainder (_≃_.from equiv (r , b)) ≡⟨⟩ proj₁ (_≃_.to equiv (_≃_.from equiv (r , b))) ≡⟨ cong proj₁ $ _≃_.right-inverse-of equiv _ ⟩∎ r ∎) where open Lens l -- A corollary: Lens.get l ⁻¹_ is constant (up to equivalence). -- -- <NAME> discusses this kind of property -- (http://homotopytypetheory.org/2014/04/29/higher-lenses/). get⁻¹-constant : (l : Lens A B) (b₁ b₂ : B) → Lens.get l ⁻¹ b₁ ≃ Lens.get l ⁻¹ b₂ get⁻¹-constant l b₁ b₂ = Lens.get l ⁻¹ b₁ ↝⟨ inverse $ remainder≃get⁻¹ l b₁ ⟩ Lens.R l ↝⟨ remainder≃get⁻¹ l b₂ ⟩□ Lens.get l ⁻¹ b₂ □ -- The two directions of get⁻¹-constant. get⁻¹-const : (l : Lens A B) (b₁ b₂ : B) → Lens.get l ⁻¹ b₁ → Lens.get l ⁻¹ b₂ get⁻¹-const l b₁ b₂ = _≃_.to (get⁻¹-constant l b₁ b₂) get⁻¹-const⁻¹ : (l : Lens A B) (b₁ b₂ : B) → Lens.get l ⁻¹ b₂ → Lens.get l ⁻¹ b₁ get⁻¹-const⁻¹ l b₁ b₂ = _≃_.from (get⁻¹-constant l b₁ b₂) -- The set function can be expressed using get⁻¹-const and get. -- -- <NAME> defines set in a similar way -- (http://homotopytypetheory.org/2014/04/29/higher-lenses/). set-in-terms-of-get⁻¹-const : (l : Lens A B) → Lens.set l ≡ λ a b → proj₁ (get⁻¹-const l (Lens.get l a) b (a , refl _)) set-in-terms-of-get⁻¹-const l = refl _ -- The remainder function can be expressed using remainder≃get⁻¹ and -- get. remainder-in-terms-of-remainder≃get⁻¹ : (l : Lens A B) → Lens.remainder l ≡ λ a → _≃_.from (remainder≃get⁻¹ l (Lens.get l a)) (a , refl _) remainder-in-terms-of-remainder≃get⁻¹ l = refl _ -- The functions get⁻¹-const and get⁻¹-const⁻¹ satisfy some coherence -- properties. -- -- The first and third properties are discussed by <NAME> -- (http://homotopytypetheory.org/2014/04/29/higher-lenses/). get⁻¹-const-∘ : (l : Lens A B) (b₁ b₂ b₃ : B) (p : Lens.get l ⁻¹ b₁) → get⁻¹-const l b₂ b₃ (get⁻¹-const l b₁ b₂ p) ≡ get⁻¹-const l b₁ b₃ p get⁻¹-const-∘ l _ b₂ b₃ p = from (r₂ , b₃) , cong proj₂ (right-inverse-of (r₂ , b₃)) ≡⟨ cong (λ r → from (r , b₃) , cong proj₂ (right-inverse-of (r , b₃))) $ cong proj₁ $ right-inverse-of _ ⟩∎ from (r₁ , b₃) , cong proj₂ (right-inverse-of (r₁ , b₃)) ∎ where open Lens l open _≃_ equiv r₁ r₂ : R r₁ = proj₁ (to (proj₁ p)) r₂ = proj₁ (to (from (r₁ , b₂))) get⁻¹-const-inverse : (l : Lens A B) (b₁ b₂ : B) (p : Lens.get l ⁻¹ b₁) → get⁻¹-const l b₁ b₂ p ≡ get⁻¹-const⁻¹ l b₂ b₁ p get⁻¹-const-inverse _ _ _ _ = refl _ get⁻¹-const-id : (l : Lens A B) (b : B) (p : Lens.get l ⁻¹ b) → get⁻¹-const l b b p ≡ p get⁻¹-const-id l b p = get⁻¹-const l b b p ≡⟨ sym $ get⁻¹-const-∘ l b _ _ p ⟩ get⁻¹-const l b b (get⁻¹-const l b b p) ≡⟨⟩ get⁻¹-const⁻¹ l b b (get⁻¹-const l b b p) ≡⟨ _≃_.left-inverse-of (get⁻¹-constant l b b) _ ⟩∎ p ∎ -- Another kind of coherence property does not hold for get⁻¹-const. -- -- This kind of property came up in a discussion with <NAME>. get⁻¹-const-not-coherent : ¬ ({A B : Type} (l : Lens A B) (b₁ b₂ : B) (f : ∀ b → Lens.get l ⁻¹ b) → get⁻¹-const l b₁ b₂ (f b₁) ≡ f b₂) get⁻¹-const-not-coherent = ({A B : Type} (l : Lens A B) (b₁ b₂ : B) (f : ∀ b → Lens.get l ⁻¹ b) → get⁻¹-const l b₁ b₂ (f b₁) ≡ f b₂) ↝⟨ (λ hyp → hyp l true false f) ⟩ get⁻¹-const l true false (f true) ≡ f false ↝⟨ cong (proj₁ ∘ proj₁) ⟩ true ≡ false ↝⟨ Bool.true≢false ⟩□ ⊥ □ where l : Lens (Bool × Bool) Bool l = record { R = Bool ; equiv = F.id ; inhabited = ∣_∣ } f : ∀ b → Lens.get l ⁻¹ b f b = (b , b) , refl _ -- If B is inhabited whenever it is merely inhabited, then the -- remainder type of a lens of type Lens A B can be expressed in terms -- of preimages of the lens's getter. remainder≃∃get⁻¹ : (l : Lens A B) (∥B∥→B : ∥ B ∥ → B) → Lens.R l ≃ ∃ λ (b : ∥ B ∥) → Lens.get l ⁻¹ (∥B∥→B b) remainder≃∃get⁻¹ {B = B} l ∥B∥→B = R ↔⟨ (inverse $ drop-⊤-left-× λ r → _⇔_.to contractible⇔↔⊤ $ propositional⇒inhabited⇒contractible truncation-is-proposition (inhabited r)) ⟩ ∥ B ∥ × R ↝⟨ (∃-cong λ _ → remainder≃get⁻¹ l _) ⟩□ (∃ λ (b : ∥ B ∥) → get ⁻¹ (∥B∥→B b)) □ where open Lens l ------------------------------------------------------------------------ -- Equality characterisations for lenses -- An equality characterisation lemma. equality-characterisation₀ : let open Lens in {l₁ l₂ : Lens A B} → Block "equality-characterisation" → l₁ ≡ l₂ ↔ ∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂ equality-characterisation₀ {A = A} {B = B} {l₁ = l₁} {l₂ = l₂} ⊠ = l₁ ≡ l₂ ↔⟨ inverse $ Eq.≃-≡ Lens-as-Σ ⟩ l₁′ ≡ l₂′ ↝⟨ inverse Bij.Σ-≡,≡↔≡ ⟩ (∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B) × (R → ∥ B ∥)) p (proj₂ l₁′) ≡ proj₂ l₂′) ↝⟨ (∃-cong λ _ → inverse $ ignore-propositional-component (Π-closure ext 1 λ _ → truncation-is-proposition)) ⟩ (∃ λ (p : R l₁ ≡ R l₂) → proj₁ (subst (λ R → A ≃ (R × B) × (R → ∥ B ∥)) p (proj₂ l₁′)) ≡ equiv l₂) ↔⟨ (∃-cong λ _ → ≡⇒≃ $ cong (λ (eq , _) → eq ≡ _) $ push-subst-, _ _) ⟩□ (∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂) □ where open Lens l₁′ = _≃_.to Lens-as-Σ l₁ l₂′ = _≃_.to Lens-as-Σ l₂ -- A "computation" rule. from-equality-characterisation₀ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} (b : Block "equality-characterisation") → {p : R l₁ ≡ R l₂} {q : subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂} → _↔_.from (equality-characterisation₀ {l₁ = l₁} {l₂ = l₂} b) (p , q) ≡ trans (sym (η l₁)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) (η l₂)) from-equality-characterisation₀ ⊠ {p = p} {q = q} = trans (sym (_≃_.left-inverse-of Lens-as-Σ _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (_↔_.to (ignore-propositional-component (Π-closure ext 1 λ _ → truncation-is-proposition)) (_≃_.from (≡⇒≃ (cong (λ (eq , _) → eq ≡ _) (push-subst-, _ _))) q)))) (_≃_.left-inverse-of Lens-as-Σ _)) ≡⟨ cong (λ eq → trans (sym (_≃_.left-inverse-of Lens-as-Σ _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (_↔_.to (ignore-propositional-component (Π-closure ext 1 λ _ → truncation-is-proposition)) (_≃_.to eq q)))) (_≃_.left-inverse-of Lens-as-Σ _))) $ trans (sym $ ≡⇒≃-sym ext _) $ cong ≡⇒≃ $ sym $ cong-sym _ _ ⟩ trans (sym (_≃_.left-inverse-of Lens-as-Σ _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (_↔_.to (ignore-propositional-component (Π-closure ext 1 λ _ → truncation-is-proposition)) (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q)))) (_≃_.left-inverse-of Lens-as-Σ _)) ≡⟨⟩ trans (sym (_≃_.left-inverse-of Lens-as-Σ _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) (_≃_.left-inverse-of Lens-as-Σ _)) ≡⟨ cong₂ (λ eq₁ eq₂ → trans (sym eq₁) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) eq₂)) (left-inverse-of-Lens-as-Σ _) (left-inverse-of-Lens-as-Σ _) ⟩ trans (sym (η _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ p (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) (η _)) ∎ -- A variant of the computation rule above. cong-set-from-equality-characterisation₀ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} (b : Block "equality-characterisation") → {p : R l₁ ≡ R l₂} {q : subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂} → cong set (_↔_.from (equality-characterisation₀ {l₁ = l₁} {l₂ = l₂} b) (p , q)) ≡ cong (λ (_ , equiv) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (Σ-≡,≡→≡ p q) cong-set-from-equality-characterisation₀ {B = B} {l₁ = l₁@(⟨ _ , _ , _ ⟩)} {l₂ = l₂@(⟨ _ , _ , _ ⟩)} b {p = p} {q = q} = elim₁ (λ {R₁} p → ∀ equiv₁ inhabited₁ q → cong set (_↔_.from (equality-characterisation₀ {l₁ = ⟨ R₁ , equiv₁ , inhabited₁ ⟩} {l₂ = l₂} b) (p , q)) ≡ cong (λ (_ , equiv) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (Σ-≡,≡→≡ p q)) (λ equiv₁ inhabited₁ q → cong set (_↔_.from (equality-characterisation₀ b) (refl _ , q)) ≡⟨ cong (cong set) $ from-equality-characterisation₀ b ⟩ cong set (trans (sym (refl _)) (trans (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ (refl _) (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) (refl _))) ≡⟨ trans (cong₂ (λ eq₁ eq₂ → cong set (trans eq₁ eq₂)) sym-refl (trans-reflʳ _)) $ cong (cong set) $ trans-reflˡ _ ⟩ cong set (cong (_≃_.from Lens-as-Σ) (Σ-≡,≡→≡ (refl _) (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) ≡⟨ cong-∘ _ _ _ ⟩ cong (λ (_ , equiv , _) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (Σ-≡,≡→≡ (refl _) (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition))))) ≡⟨ cong (cong _) $ Σ-≡,≡→≡-reflˡ _ ⟩ cong (λ (_ , equiv , _) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (cong (_ ,_) (trans (sym $ subst-refl _ _) (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) ≡⟨ cong-∘ _ _ _ ⟩ cong (λ (equiv , _) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (trans (sym $ subst-refl _ _) (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition))))) ≡⟨ trans (sym $ cong-∘ _ _ _) $ cong (cong _) $ cong-trans _ _ _ ⟩ cong (λ equiv a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (trans (cong proj₁ (sym $ subst-refl _ _)) (cong proj₁ (Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) (proj₁ (+⇒≡ (Π-closure ext 1 λ _ → truncation-is-proposition)))))) ≡⟨ cong (λ eq → cong _ (trans (cong proj₁ (sym $ subst-refl _ _)) eq)) $ proj₁-Σ-≡,≡→≡ (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ (λ R → R → ∥ B ∥)))) q) _ ⟩ cong (λ equiv a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (trans (cong proj₁ (sym $ subst-refl _ _)) (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q)) ≡⟨ cong (cong _) $ elim¹ (λ q → trans (cong proj₁ (sym $ subst-refl _ _)) (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) q) ≡ trans (sym $ subst-refl _ _) q) ( trans (cong proj₁ $ sym $ subst-refl _ _) (≡⇒→ (cong (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _))) (refl _)) ≡⟨ cong (trans _) $ sym $ subst-in-terms-of-≡⇒↝ equivalence _ _ _ ⟩ trans (cong proj₁ $ sym $ subst-refl _ _) (subst (λ (eq , _) → eq ≡ _) (sym (push-subst-, _ _)) (refl _)) ≡⟨ cong (trans _) $ subst-∘ _ _ _ ⟩ trans (cong proj₁ $ sym $ subst-refl _ _) (subst (_≡ _) (cong proj₁ $ sym $ push-subst-, _ _) (refl _)) ≡⟨ cong (trans _) $ trans subst-trans-sym $ trans (trans-reflʳ _) $ trans (sym (cong-sym _ _)) $ cong (cong _) $ sym-sym _ ⟩ trans (cong proj₁ $ sym $ subst-refl _ _) (cong proj₁ $ push-subst-, {y≡z = refl _} _ _) ≡⟨ cong₂ trans (cong-sym _ _) (proj₁-push-subst-,-refl _ _) ⟩ trans (sym $ cong proj₁ $ subst-refl _ _) (trans (cong proj₁ (subst-refl _ _)) (sym $ subst-refl _ _)) ≡⟨ trans-sym-[trans] _ _ ⟩ sym (subst-refl _ _) ≡⟨ sym $ trans-reflʳ _ ⟩∎ trans (sym $ subst-refl _ _) (refl _) ∎) q ⟩ cong (λ equiv a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (trans (sym $ subst-refl _ _) q) ≡⟨ sym $ cong-∘ _ _ _ ⟩ cong (λ (_ , equiv) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (cong (_ ,_) (trans (sym $ subst-refl _ _) q)) ≡⟨ cong (cong _) $ sym $ Σ-≡,≡→≡-reflˡ _ ⟩∎ cong (λ (_ , equiv) a b → _≃_.from equiv (proj₁ (_≃_.to equiv a) , b)) (Σ-≡,≡→≡ (refl _) q) ∎) _ _ _ _ where open Lens -- An equality characterisation lemma. equality-characterisation₀₁ : let open Lens in {l₁ l₂ : Lens A B} → Block "equality-characterisation" → (l₁ ≡ l₂) ≃ ∃ λ (p : R l₁ ≡ R l₂) → ∀ a → (subst id p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a equality-characterisation₀₁ {A = A} {B = B} {l₁ = l₁} {l₂ = l₂} ⊠ = l₁ ≡ l₂ ↔⟨ equality-characterisation₀ ⊠ ⟩ (∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂) ↝⟨ (∃-cong λ _ → inverse $ ≃-to-≡≃≡ ext ext) ⟩ (∃ λ (p : R l₁ ≡ R l₂) → ∀ a → _≃_.to (subst (λ R → A ≃ (R × B)) p (equiv l₁)) a ≡ _≃_.to (equiv l₂) a) ↝⟨ (∃-cong λ _ → ∀-cong ext λ _ → ≡⇒≃ $ cong (_≡ _) $ trans (cong (_$ _) $ Eq.to-subst) $ trans (sym $ push-subst-application _ _) $ trans (push-subst-, _ _) $ cong (subst id _ _ ,_) $ subst-const _) ⟩□ (∃ λ (p : R l₁ ≡ R l₂) → ∀ a → (subst id p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) □ where open Lens private -- An equality characterisation lemma with a "computation" rule. equality-characterisation₁′ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} (bl : Block "equality-characterisation₀") → Block "equality-characterisation₁" → (univ : Univalence (a ⊔ b)) → ∃ λ (eq : l₁ ≡ l₂ ↔ ∃ λ (p : R l₁ ≃ R l₂) → ∀ a → (_≃_.to p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) → (p : R l₁ ≃ R l₂) (q : ∀ a → (_≃_.to p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) → _↔_.from eq (p , q) ≡ _↔_.from (equality-characterisation₀ bl) ( ≃⇒≡ univ p , Eq.lift-equality ext (trans (≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) (trans (cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) (≃⇒≡-id univ)) (cong _≃_.to $ subst-refl _ _)) p) (⟨ext⟩ q)) ) equality-characterisation₁′ {A = A} {B = B} {l₁ = l₁} {l₂ = l₂} b ⊠ univ = (l₁ ≡ l₂ ↝⟨ equality-characterisation₀ b ⟩ (∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂) ↝⟨ inverse $ Σ-cong (inverse $ ≡≃≃ univ) (λ _ → F.id) ⟩ (∃ λ (p : R l₁ ≃ R l₂) → subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁) ≡ equiv l₂) ↔⟨ (∃-cong λ _ → inverse $ ≃-to-≡≃≡ ext bad-ext) ⟩ (∃ λ (p : R l₁ ≃ R l₂) → ∀ a → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) a ≡ _≃_.to (equiv l₂) a) ↔⟨ (∃-cong λ p → ∀-cong ext λ a → inverse $ ≡⇒≃ $ cong (_≡ _) $ sym $ cong (_$ a) $ ≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) ( _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ Eq.id) (equiv l₁)) ≡⟨ cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) $ ≃⇒≡-id univ ⟩ _≃_.to (subst (λ R → A ≃ (R × B)) (refl _) (equiv l₁)) ≡⟨ cong _≃_.to $ subst-refl _ _ ⟩∎ _≃_.to (equiv l₁) ∎) p) ⟩□ (∃ λ (p : R l₁ ≃ R l₂) → ∀ a → (_≃_.to p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) □) , λ p q → _↔_.from (equality-characterisation₀ b) ( ≃⇒≡ univ p , Eq.lift-equality ext (⟨ext⟩ λ a → ≡⇒→ (cong (_≡ _) $ sym $ cong (_$ a) $ ≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) (trans (cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) (≃⇒≡-id univ)) (cong _≃_.to $ subst-refl _ _)) p) (q a)) ) ≡⟨ (cong (λ eq → _↔_.from (equality-characterisation₀ b) (≃⇒≡ univ p , Eq.lift-equality ext (⟨ext⟩ eq))) $ ⟨ext⟩ λ a → trans (sym $ subst-in-terms-of-≡⇒↝ equivalence _ _ _) $ subst-trans _) ⟩ _↔_.from (equality-characterisation₀ b) ( ≃⇒≡ univ p , Eq.lift-equality ext (⟨ext⟩ λ a → trans (cong (_$ a) $ ≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) (trans (cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) (≃⇒≡-id univ)) (cong _≃_.to $ subst-refl _ _)) p) (q a)) ) ≡⟨ cong (λ eq → _↔_.from (equality-characterisation₀ b) (≃⇒≡ univ p , Eq.lift-equality ext eq)) $ trans (ext-trans _ _) $ cong (flip trans _) $ _≃_.right-inverse-of (Eq.extensionality-isomorphism bad-ext) _ ⟩ _↔_.from (equality-characterisation₀ b) ( ≃⇒≡ univ p , Eq.lift-equality ext (trans (≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) (trans (cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) (≃⇒≡-id univ)) (cong _≃_.to $ subst-refl _ _)) p) (⟨ext⟩ q)) ) ∎ where open Lens -- An equality characterisation lemma. equality-characterisation₁ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} → Block "equality-characterisation" → Univalence (a ⊔ b) → l₁ ≡ l₂ ↔ ∃ λ (p : R l₁ ≃ R l₂) → ∀ a → (_≃_.to p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a equality-characterisation₁ b univ = proj₁ (equality-characterisation₁′ b b univ) -- A "computation" rule. from-equality-characterisation₁ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} (bl : Block "equality-characterisation") → (univ : Univalence (a ⊔ b)) (p : R l₁ ≃ R l₂) (q : ∀ a → (_≃_.to p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) → _↔_.from (equality-characterisation₁ {l₁ = l₁} {l₂ = l₂} bl univ) (p , q) ≡ _↔_.from (equality-characterisation₀ bl) ( ≃⇒≡ univ p , Eq.lift-equality ext (trans (≃-elim¹ univ (λ {R} p → _≃_.to (subst (λ R → A ≃ (R × B)) (≃⇒≡ univ p) (equiv l₁)) ≡ (λ a → _≃_.to p (remainder l₁ a) , get l₁ a)) (trans (cong (λ eq → _≃_.to (subst (λ R → A ≃ (R × B)) eq (equiv l₁))) (≃⇒≡-id univ)) (cong _≃_.to $ subst-refl _ _)) p) (⟨ext⟩ q)) ) from-equality-characterisation₁ b univ _ _ = proj₂ (equality-characterisation₁′ b b univ) _ _ -- An equality characterisation lemma. equality-characterisation₀₂ : let open Lens in {l₁ l₂ : Lens A B} → Block "equality-characterisation" → (l₁ ≡ l₂) ≃ ∃ λ (p : R l₁ ≡ R l₂) → (∀ a → subst id p (remainder l₁ a) ≡ remainder l₂ a) × (∀ a → get l₁ a ≡ get l₂ a) equality-characterisation₀₂ {A = A} {B = B} {l₁ = l₁} {l₂ = l₂} ⊠ = l₁ ≡ l₂ ↝⟨ equality-characterisation₀₁ ⊠ ⟩ (∃ λ (p : R l₁ ≡ R l₂) → ∀ a → (subst id p (remainder l₁ a) , get l₁ a) ≡ _≃_.to (equiv l₂) a) ↔⟨⟩ (∃ λ (p : R l₁ ≡ R l₂) → ∀ a → (subst id p (remainder l₁ a) , get l₁ a) ≡ (remainder l₂ a , get l₂ a)) ↔⟨ (∃-cong λ _ → ∀-cong ext λ _ → inverse ≡×≡↔≡) ⟩ (∃ λ (p : R l₁ ≡ R l₂) → ∀ a → subst id p (remainder l₁ a) ≡ remainder l₂ a × get l₁ a ≡ get l₂ a) ↔⟨ (∃-cong λ _ → ΠΣ-comm) ⟩□ (∃ λ (p : R l₁ ≡ R l₂) → (∀ a → subst id p (remainder l₁ a) ≡ remainder l₂ a) × (∀ a → get l₁ a ≡ get l₂ a)) □ where open Lens private -- An equality characterisation lemma with a "computation" rule. equality-characterisation₂′ : {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} → let open Lens in (bl : Block "equality-characterisation₁") → Block "equality-characterisation₂" → (univ : Univalence (a ⊔ b)) → ∃ λ (eq : l₁ ≡ l₂ ↔ ∃ λ (r : R l₁ ≃ R l₂) → (∀ x → _≃_.to r (remainder l₁ x) ≡ remainder l₂ x) × (∀ x → get l₁ x ≡ get l₂ x)) → (r₁ : R l₁ ≃ R l₂) (r₂ : ∀ x → _≃_.to r₁ (remainder l₁ x) ≡ remainder l₂ x) (g : ∀ x → get l₁ x ≡ get l₂ x) → _↔_.from eq (r₁ , r₂ , g) ≡ _↔_.from (equality-characterisation₁ bl univ) (r₁ , λ a → cong₂ _,_ (r₂ a) (g a)) equality-characterisation₂′ {l₁ = l₁} {l₂ = l₂} bl ⊠ univ = (l₁ ≡ l₂ ↝⟨ equality-characterisation₁ bl univ ⟩ (∃ λ (eq : R l₁ ≃ R l₂) → ∀ x → (_≃_.to eq (remainder l₁ x) , get l₁ x) ≡ _≃_.to (equiv l₂) x) ↝⟨ (∃-cong λ _ → ∀-cong ext λ _ → inverse ≡×≡↔≡) ⟩ (∃ λ (eq : R l₁ ≃ R l₂) → ∀ x → _≃_.to eq (remainder l₁ x) ≡ remainder l₂ x × get l₁ x ≡ get l₂ x) ↝⟨ (∃-cong λ _ → ΠΣ-comm) ⟩□ (∃ λ (eq : R l₁ ≃ R l₂) → (∀ x → _≃_.to eq (remainder l₁ x) ≡ remainder l₂ x) × (∀ x → get l₁ x ≡ get l₂ x)) □) , λ _ _ _ → refl _ where open Lens -- An equality characterisation lemma. equality-characterisation₂ : {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} → let open Lens in Block "equality-characterisation" → Univalence (a ⊔ b) → l₁ ≡ l₂ ↔ ∃ λ (eq : R l₁ ≃ R l₂) → (∀ x → _≃_.to eq (remainder l₁ x) ≡ remainder l₂ x) × (∀ x → get l₁ x ≡ get l₂ x) equality-characterisation₂ bl univ = proj₁ (equality-characterisation₂′ bl bl univ) -- A "computation" rule. from-equality-characterisation₂ : let open Lens in {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} (bl : Block "equality-characterisation") → (univ : Univalence (a ⊔ b)) (r₁ : R l₁ ≃ R l₂) (r₂ : ∀ x → _≃_.to r₁ (remainder l₁ x) ≡ remainder l₂ x) (g : ∀ x → get l₁ x ≡ get l₂ x) → _↔_.from (equality-characterisation₂ {l₁ = l₁} {l₂ = l₂} bl univ) (r₁ , r₂ , g) ≡ _↔_.from (equality-characterisation₁ bl univ) (r₁ , λ a → cong₂ _,_ (r₂ a) (g a)) from-equality-characterisation₂ bl univ = proj₂ (equality-characterisation₂′ bl bl univ) -- An equality characterisation lemma. equality-characterisation₃ : {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} → let open Lens in Univalence (a ⊔ b) → l₁ ≡ l₂ ↔ ∃ λ (eq : R l₁ ≃ R l₂) → ∀ p → _≃_.from (equiv l₁) (_≃_.from eq (proj₁ p) , proj₂ p) ≡ _≃_.from (equiv l₂) p equality-characterisation₃ {A = A} {B = B} {l₁ = l₁} {l₂ = l₂} univ = l₁ ≡ l₂ ↝⟨ equality-characterisation₀ ⊠ ⟩ (∃ λ (p : R l₁ ≡ R l₂) → subst (λ R → A ≃ (R × B)) p (equiv l₁) ≡ equiv l₂) ↝⟨ inverse $ Σ-cong (inverse $ ≡≃≃ univ) (λ _ → F.id) ⟩ (∃ λ (eq : R l₁ ≃ R l₂) → subst (λ R → A ≃ (R × B)) (≃⇒≡ univ eq) (equiv l₁) ≡ equiv l₂) ↔⟨ (∃-cong λ _ → inverse $ ≡⇒≃ $ cong (_≡ _) $ transport-theorem (λ R → A ≃ (R × B)) (λ X≃Y → (X≃Y ×-cong F.id) F.∘_) (λ _ → Eq.lift-equality ext (refl _)) univ _ _) ⟩ (∃ λ (eq : R l₁ ≃ R l₂) → (eq ×-cong F.id) F.∘ equiv l₁ ≡ equiv l₂) ↝⟨ (∃-cong λ _ → inverse $ ≃-from-≡↔≡ ext) ⟩□ (∃ λ (eq : R l₁ ≃ R l₂) → ∀ p → _≃_.from (equiv l₁) (_≃_.from eq (proj₁ p) , proj₂ p) ≡ _≃_.from (equiv l₂) p) □ where open Lens -- An equality characterisation lemma for lenses for which the view -- type is inhabited. equality-characterisation₄ : {A : Type a} {B : Type b} {l₁ l₂ : Lens A B} → let open Lens in Block "equality-characterisation" → Univalence (a ⊔ b) → (b : B) → (l₁ ≡ l₂) ≃ (∃ λ (eq : get l₁ ⁻¹ b ≃ get l₂ ⁻¹ b) → (∀ a → _≃_.to eq (set l₁ a b , get-set l₁ a b) ≡ (set l₂ a b , get-set l₂ a b)) × (∀ a → get l₁ a ≡ get l₂ a)) equality-characterisation₄ {l₁ = l₁} {l₂ = l₂} bl univ b = l₁ ≡ l₂ ↔⟨ equality-characterisation₂ bl univ ⟩ (∃ λ (eq : R l₁ ≃ R l₂) → (∀ a → _≃_.to eq (remainder l₁ a) ≡ remainder l₂ a) × (∀ a → get l₁ a ≡ get l₂ a)) ↝⟨ inverse $ Σ-cong (inverse $ Eq.≃-preserves ext (remainder≃get⁻¹ l₁ b) (remainder≃get⁻¹ l₂ b)) (λ _ → F.id) ⟩ (∃ λ (eq : get l₁ ⁻¹ b ≃ get l₂ ⁻¹ b) → (∀ a → remainder l₂ (proj₁ (_≃_.to eq (set l₁ a b , get-set l₁ a b))) ≡ remainder l₂ a) × (∀ a → get l₁ a ≡ get l₂ a)) ↝⟨ (∃-cong λ _ → ×-cong₁ λ _ → ∀-cong ext λ a → ≡⇒≃ $ cong (remainder l₂ _ ≡_) $ sym $ remainder-set l₂ _ _) ⟩ (∃ λ (eq : get l₁ ⁻¹ b ≃ get l₂ ⁻¹ b) → (∀ a → remainder l₂ (proj₁ (_≃_.to eq (set l₁ a b , get-set l₁ a b))) ≡ remainder l₂ (set l₂ a b)) × (∀ a → get l₁ a ≡ get l₂ a)) ↝⟨ (∃-cong λ _ → ×-cong₁ λ _ → ∀-cong ext λ a → Eq.≃-≡ (inverse $ remainder≃get⁻¹ l₂ b)) ⟩□ (∃ λ (eq : get l₁ ⁻¹ b ≃ get l₂ ⁻¹ b) → (∀ a → _≃_.to eq (set l₁ a b , get-set l₁ a b) ≡ (set l₂ a b , get-set l₂ a b)) × (∀ a → get l₁ a ≡ get l₂ a)) □ where open Lens ------------------------------------------------------------------------ -- More lens equalities -- If the forward direction of an equivalence is Lens.get l, then the -- setter of l can be expressed using the other direction of the -- equivalence. from≡set : ∀ (l : Lens A B) is-equiv → let open Lens A≃B = Eq.⟨ get l , is-equiv ⟩ in ∀ a b → _≃_.from A≃B b ≡ set l a b from≡set l is-equiv a b = _≃_.to-from Eq.⟨ get , is-equiv ⟩ ( get (set a b) ≡⟨ get-set _ _ ⟩∎ b ∎) where open Lens l -- If two lenses have equal setters, then they also have equal -- getters. getters-equal-if-setters-equal : let open Lens in (l₁ l₂ : Lens A B) → set l₁ ≡ set l₂ → get l₁ ≡ get l₂ getters-equal-if-setters-equal l₁ l₂ setters-equal = ⟨ext⟩ λ a → get l₁ a ≡⟨ cong (get l₁) $ sym $ set-get l₂ _ ⟩ get l₁ (set l₂ a (get l₂ a)) ≡⟨ cong (λ f → get l₁ (f a (get l₂ a))) $ sym setters-equal ⟩ get l₁ (set l₁ a (get l₂ a)) ≡⟨ get-set l₁ _ _ ⟩∎ get l₂ a ∎ where open Lens -- Two lenses of type Lens A B are equal if B is inhabited and the -- lenses' setters are equal (assuming univalence). -- -- Some results below are more general than this one, but this proof, -- which uses remainder≃get⁻¹, is rather easy. lenses-with-inhabited-codomains-equal-if-setters-equal : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (l₁ l₂ : Lens A B) → B → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂ lenses-with-inhabited-codomains-equal-if-setters-equal {B = B} univ l₁ l₂ b setters-equal = _↔_.from (equality-characterisation₂ ⊠ univ) ( R≃R , (λ a → remainder l₂ (set l₁ a b) ≡⟨ cong (λ f → remainder l₂ (f a b)) setters-equal ⟩ remainder l₂ (set l₂ a b) ≡⟨ remainder-set l₂ _ _ ⟩∎ remainder l₂ a ∎) , getters-equal ) where open Lens getters-equal = ext⁻¹ $ getters-equal-if-setters-equal l₁ l₂ setters-equal R≃R : R l₁ ≃ R l₂ R≃R = R l₁ ↝⟨ remainder≃get⁻¹ l₁ b ⟩ get l₁ ⁻¹ b ↔⟨ Preimage.respects-extensional-equality getters-equal ⟩ get l₂ ⁻¹ b ↝⟨ inverse $ remainder≃get⁻¹ l₂ b ⟩□ R l₂ □ -- A generalisation of lenses-equal-if-setters-equal (which is defined -- below). lenses-equal-if-setters-equal′ : let open Lens in {A : Type a} {B : Type b} (univ : Univalence (a ⊔ b)) (l₁ l₂ : Lens A B) (f : R l₁ → R l₂) → (B → ∀ r → ∃ λ b′ → remainder l₂ (_≃_.from (equiv l₁) (r , b′)) ≡ f r) → (∀ a → f (remainder l₁ a) ≡ remainder l₂ a) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂ lenses-equal-if-setters-equal′ {A = A} {B = B} univ l₁ l₂ f ∃≡f f-remainder≡remainder setters-equal = _↔_.from (equality-characterisation₂ ⊠ univ) ( R≃R , f-remainder≡remainder , ext⁻¹ (getters-equal-if-setters-equal l₁ l₂ setters-equal) ) where open Lens open _≃_ BR≃BR = B × R l₁ ↔⟨ ×-comm ⟩ R l₁ × B ↝⟨ inverse (equiv l₁) ⟩ A ↝⟨ equiv l₂ ⟩ R l₂ × B ↔⟨ ×-comm ⟩□ B × R l₂ □ to-BR≃BR : ∀ b b′ r → to BR≃BR (b , r) ≡ (b , remainder l₂ (from (equiv l₁) (r , b′))) to-BR≃BR b b′ r = swap (to (equiv l₂) (from (equiv l₁) (swap (b , r)))) ≡⟨ cong swap lemma ⟩ swap (swap (b , remainder l₂ (from (equiv l₁) (r , b′)))) ≡⟨⟩ b , remainder l₂ (from (equiv l₁) (r , b′)) ∎ where lemma = to (equiv l₂) (from (equiv l₁) (swap (b , r))) ≡⟨⟩ to (equiv l₂) (from (equiv l₁) (r , b)) ≡⟨ cong (λ r → to (equiv l₂) (from (equiv l₁) (proj₁ r , b))) $ sym $ right-inverse-of (equiv l₁) _ ⟩ to (equiv l₂) (from (equiv l₁) (proj₁ (to (equiv l₁) (from (equiv l₁) (r , b′))) , b)) ≡⟨⟩ to (equiv l₂) (set l₁ (from (equiv l₁) (r , b′)) b) ≡⟨ cong (to (equiv l₂)) $ ext⁻¹ (ext⁻¹ setters-equal _) _ ⟩ to (equiv l₂) (set l₂ (from (equiv l₁) (r , b′)) b) ≡⟨⟩ to (equiv l₂) (from (equiv l₂) (remainder l₂ (from (equiv l₁) (r , b′)) , b)) ≡⟨ right-inverse-of (equiv l₂) _ ⟩ remainder l₂ (from (equiv l₁) (r , b′)) , b ≡⟨⟩ swap (b , remainder l₂ (from (equiv l₁) (r , b′))) ∎ id-f≃ : Eq.Is-equivalence (Σ-map id f) id-f≃ = Eq.respects-extensional-equality (λ (b , r) → let b′ , ≡fr = ∃≡f b r in to BR≃BR (b , r) ≡⟨ to-BR≃BR _ _ _ ⟩ b , remainder l₂ (from (equiv l₁) (r , b′)) ≡⟨ cong (b ,_) ≡fr ⟩ b , f r ≡⟨⟩ Σ-map id f (b , r) ∎) (is-equivalence BR≃BR) f≃ : Eq.Is-equivalence f f≃ = HA.[inhabited→Is-equivalence]→Is-equivalence λ r → Trunc.rec (Eq.propositional ext _) (Eq.drop-Σ-map-id _ id-f≃) (inhabited l₂ r) R≃R : R l₁ ≃ R l₂ R≃R = Eq.⟨ f , f≃ ⟩ -- If the codomain of a lens is inhabited when it is merely inhabited -- and the remainder type is inhabited, then this lens is equal to -- another lens if their setters are equal (assuming univalence). lenses-equal-if-setters-equal : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (l₁ l₂ : Lens A B) → (Lens.R l₁ → ∥ B ∥ → B) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂ lenses-equal-if-setters-equal {B = B} univ l₁ l₂ inh′ setters-equal = lenses-equal-if-setters-equal′ univ l₁ l₂ f (λ _ r → inh r , (remainder l₂ (_≃_.from (equiv l₁) (r , inh r)) ≡⟨⟩ f r ∎)) (λ a → f (remainder l₁ a) ≡⟨⟩ remainder l₂ (set l₁ a (inh (remainder l₁ a))) ≡⟨ cong (remainder l₂) $ ext⁻¹ (ext⁻¹ setters-equal _) _ ⟩ remainder l₂ (set l₂ a (inh (remainder l₁ a))) ≡⟨ remainder-set l₂ _ _ ⟩∎ remainder l₂ a ∎) setters-equal where open Lens inh : Lens.R l₁ → B inh r = inh′ r (inhabited l₁ r) f : R l₁ → R l₂ f r = remainder l₂ (_≃_.from (equiv l₁) (r , inh r)) -- If a lens has a propositional remainder type, then this lens is -- equal to another lens if their setters are equal (assuming -- univalence). lenses-equal-if-setters-equal-and-remainder-propositional : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (l₁ l₂ : Lens A B) → Is-proposition (Lens.R l₂) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂ lenses-equal-if-setters-equal-and-remainder-propositional univ l₁ l₂ R₂-prop = lenses-equal-if-setters-equal′ univ l₁ l₂ f (λ b r → b , (remainder l₂ (_≃_.from (equiv l₁) (r , b)) ≡⟨ R₂-prop _ _ ⟩∎ f r ∎)) (λ a → f (remainder l₁ a) ≡⟨ R₂-prop _ _ ⟩∎ remainder l₂ a ∎) where open Lens f : R l₁ → R l₂ f r = Trunc.rec R₂-prop (λ b → remainder l₂ (_≃_.from (equiv l₁) (r , b))) (inhabited l₁ r) -- A generalisation of the previous result: If a lens has a remainder -- type that is a set, then this lens is equal to another lens if -- their setters are equal (assuming univalence). -- -- This result is due to <NAME>. lenses-equal-if-setters-equal-and-remainder-set : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (l₁ l₂ : Lens A B) → Is-set (Lens.R l₂) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂ lenses-equal-if-setters-equal-and-remainder-set {B = B} univ l₁ l₂ R₂-set setters-equal = lenses-equal-if-setters-equal′ univ l₁ l₂ f (λ b r → b , (remainder l₂ (_≃_.from (equiv l₁) (r , b)) ≡⟨ cong (f₂ r) $ truncation-is-proposition ∣ _ ∣ (inhabited l₁ r) ⟩∎ f r ∎)) (λ a → f (remainder l₁ a) ≡⟨⟩ f₂ (remainder l₁ a) (inhabited l₁ (remainder l₁ a)) ≡⟨ cong (f₂ (remainder l₁ a)) $ truncation-is-proposition (inhabited l₁ (remainder l₁ a)) ∣ _ ∣ ⟩ f₁ (remainder l₁ a) (get l₁ a) ≡⟨ sym $ f₁-remainder _ _ ⟩∎ remainder l₂ a ∎) setters-equal where open Lens f₁ : R l₁ → B → R l₂ f₁ r b = remainder l₂ (_≃_.from (equiv l₁) (r , b)) f₁-remainder : ∀ a b → remainder l₂ a ≡ f₁ (remainder l₁ a) b f₁-remainder a b = remainder l₂ a ≡⟨ sym $ remainder-set l₂ a b ⟩ remainder l₂ (set l₂ a b) ≡⟨ cong (λ f → remainder l₂ (f a b)) $ sym setters-equal ⟩∎ remainder l₂ (set l₁ a b) ∎ f₂ : R l₁ → ∥ B ∥ → R l₂ f₂ r = _↔_.to (constant-function↔∥inhabited∥⇒inhabited R₂-set) ( f₁ r , λ b₁ b₂ → let a = _≃_.from (equiv l₁) (r , b₁) in remainder l₂ a ≡⟨ f₁-remainder _ _ ⟩ f₁ (remainder l₁ a) b₂ ≡⟨⟩ remainder l₂ (_≃_.from (equiv l₁) (remainder l₁ a , b₂)) ≡⟨ cong (λ p → f₁ (proj₁ p) b₂) $ _≃_.right-inverse-of (equiv l₁) _ ⟩∎ remainder l₂ (_≃_.from (equiv l₁) (r , b₂)) ∎ ) f : R l₁ → R l₂ f r = f₂ r (inhabited l₁ r) -- If lenses from A × C to C (where the universe of A is at least as -- large as the universe of C) with equal setters are equal, then -- weakly constant functions from C to equivalences between A and B -- (where B lives in the same universe as A) are coherently constant. -- -- This result is due to <NAME>. lenses-equal-if-setters-equal→constant→coherently-constant : ∀ ℓ {A B : Type (c ⊔ ℓ)} {C : Type c} → ((l₁ l₂ : Lens (A × C) C) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂) → (A≃B : C → A ≃ B) → Constant A≃B → Coherently-constant A≃B lenses-equal-if-setters-equal→constant→coherently-constant _ {A = A} {B = B} {C = C} lenses-equal-if-setters-equal A≃B c = A≃B′ , A≃B≡ where open Lens module _ (∥c∥ : ∥ C ∥) where l₁ l₂ : Lens (A × C) C l₁ = record { R = A ; equiv = F.id ; inhabited = λ _ → ∥c∥ } l₂ = record { R = B ; equiv = A × C ↔⟨ ×-comm ⟩ C × A ↝⟨ ∃-cong A≃B ⟩ C × B ↔⟨ ×-comm ⟩□ B × C □ ; inhabited = λ _ → ∥c∥ } setters-equal : ∀ p c → set l₁ p c ≡ set l₂ p c setters-equal (a , c₁) c₂ = cong (_, c₂) $ sym $ (_≃_.from (A≃B c₂) (_≃_.to (A≃B c₁) a) ≡⟨ cong (λ eq → _≃_.from (A≃B c₂) (_≃_.to eq a)) $ c c₁ c₂ ⟩ _≃_.from (A≃B c₂) (_≃_.to (A≃B c₂) a) ≡⟨ _≃_.left-inverse-of (A≃B c₂) a ⟩∎ a ∎) l₁≡l₂ : l₁ ≡ l₂ l₁≡l₂ = lenses-equal-if-setters-equal l₁ l₂ (⟨ext⟩ λ p → ⟨ext⟩ λ c → setters-equal p c) l₁≡l₂′ = _≃_.to (equality-characterisation₀₂ ⊠) l₁≡l₂ A≃B′ : A ≃ B A≃B′ = ≡⇒≃ $ proj₁ l₁≡l₂′ A≃B≡ : A≃B ≡ A≃B′ ∘ ∣_∣ A≃B≡ = ⟨ext⟩ λ c → Eq.lift-equality ext $ ⟨ext⟩ λ a → _≃_.to (A≃B c) a ≡⟨⟩ remainder (l₂ ∣ c ∣) (a , c) ≡⟨ sym $ proj₁ (proj₂ (l₁≡l₂′ ∣ c ∣)) _ ⟩ subst id (proj₁ (l₁≡l₂′ ∣ c ∣)) (remainder (l₁ ∣ c ∣) (a , c)) ≡⟨ subst-id-in-terms-of-≡⇒↝ equivalence ⟩ ≡⇒→ (proj₁ (l₁≡l₂′ ∣ c ∣)) (remainder (l₁ ∣ c ∣) (a , c)) ≡⟨⟩ _≃_.to (A≃B′ ∣ c ∣) a ∎ -- It is not the case that, for all types A and B in Type a and all -- lenses l₁ and l₂ from A to B, that l₁ is equal to l₂ if the lenses -- have equal setters (assuming univalence). ¬-lenses-equal-if-setters-equal : Univalence lzero → ¬ ((A B : Type a) (l₁ l₂ : Lens A B) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂) ¬-lenses-equal-if-setters-equal {a = a} univ = ((A B : Type a) (l₁ l₂ : Lens A B) → Lens.set l₁ ≡ Lens.set l₂ → l₁ ≡ l₂) ↝⟨ (λ hyp A B _ f c → lenses-equal-if-setters-equal→constant→coherently-constant lzero (hyp (B × A) A) f c) ⟩ ((A B : Type a) → ∥ A ∥ → (f : A → B ≃ B) → Constant f → Coherently-constant f) ↝⟨ C.¬-Constant→Coherently-constant univ ⟩□ ⊥ □ -- The functions ≃→lens and ≃→lens′ are pointwise equal (when -- applicable, assuming univalence). ≃→lens≡≃→lens′ : {A B : Type a} → Univalence a → (A≃B : A ≃ B) → ≃→lens A≃B ≡ ≃→lens′ A≃B ≃→lens≡≃→lens′ {B = B} univ A≃B = _↔_.from (equality-characterisation₂ ⊠ univ) ( (∥ ↑ _ B ∥ ↔⟨ ∥∥-cong Bij.↑↔ ⟩□ ∥ B ∥ □) , (λ _ → refl _) , (λ _ → refl _) ) -- If the getter of a lens is an equivalence, then the lens formed -- using the equivalence (using ≃→lens) is equal to the lens (assuming -- univalence). get-equivalence→≡≃→lens : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (l : Lens A B) → (eq : Is-equivalence (Lens.get l)) → l ≡ ≃→lens Eq.⟨ Lens.get l , eq ⟩ get-equivalence→≡≃→lens {A = A} {B = B} univ l eq = lenses-equal-if-setters-equal-and-remainder-propositional univ l (≃→lens Eq.⟨ Lens.get l , eq ⟩) truncation-is-proposition (⟨ext⟩ λ a → ⟨ext⟩ λ b → set l a b ≡⟨ sym $ from≡set l eq a b ⟩ _≃_.from A≃B b ≡⟨⟩ set (≃→lens A≃B) a b ∎) where open Lens A≃B : A ≃ B A≃B = Eq.⟨ _ , eq ⟩ -- A variant of get-equivalence→≡≃→lens. get-equivalence→≡≃→lens′ : {A B : Type a} → Univalence a → (l : Lens A B) → (eq : Is-equivalence (Lens.get l)) → l ≡ ≃→lens′ Eq.⟨ Lens.get l , eq ⟩ get-equivalence→≡≃→lens′ {A = A} {B = B} univ l eq = l ≡⟨ get-equivalence→≡≃→lens univ _ _ ⟩ ≃→lens A≃B ≡⟨ ≃→lens≡≃→lens′ univ _ ⟩∎ ≃→lens′ A≃B ∎ where A≃B = Eq.⟨ Lens.get l , eq ⟩ ------------------------------------------------------------------------ -- Some equivalences -- "The getter is an equivalence" is equivalent to "the remainder type -- is equivalent to the propositional truncation of the codomain". get-equivalence≃inhabited-equivalence : (l : Lens A B) → Is-equivalence (Lens.get l) ≃ Is-equivalence (Lens.inhabited l) get-equivalence≃inhabited-equivalence {A = A} {B = B} l = Is-equivalence (get l) ↝⟨ Eq.⇔→≃ (Eq.propositional ext _) (Eq.propositional ext _) (flip (Eq.Two-out-of-three.g∘f-f (Eq.two-out-of-three _ _)) (_≃_.is-equivalence (equiv l))) (Eq.Two-out-of-three.f-g (Eq.two-out-of-three _ _) (_≃_.is-equivalence (equiv l))) ⟩ Is-equivalence (proj₂ ⦂ (R l × B → B)) ↝⟨ inverse $ equivalence-to-∥∥≃proj₂-equivalence _ ⟩□ Is-equivalence (inhabited l) □ where open Lens -- "The getter is an equivalence" is equivalent to "the remainder type -- is equivalent to the propositional truncation of the codomain". get-equivalence≃remainder≃∥codomain∥ : (l : Lens A B) → Is-equivalence (Lens.get l) ≃ (Lens.R l ≃ ∥ B ∥) get-equivalence≃remainder≃∥codomain∥ {A = A} {B = B} l = Is-equivalence (get l) ↝⟨ get-equivalence≃inhabited-equivalence l ⟩ Is-equivalence (inhabited l) ↔⟨ inverse $ drop-⊤-left-Σ $ _⇔_.to contractible⇔↔⊤ $ propositional⇒inhabited⇒contractible (Π-closure ext 1 λ _ → truncation-is-proposition) (inhabited l) ⟩ (∃ λ (inh : R l → ∥ B ∥) → Is-equivalence inh) ↔⟨ inverse Eq.≃-as-Σ ⟩□ R l ≃ ∥ B ∥ □ where open Lens ------------------------------------------------------------------------ -- Some lens isomorphisms -- A generalised variant of Lens preserves bijections. Lens-cong′ : A₁ ↔ A₂ → B₁ ↔ B₂ → (∃ λ (R : Type r) → A₁ ≃ (R × B₁) × (R → ∥ B₁ ∥)) ↔ (∃ λ (R : Type r) → A₂ ≃ (R × B₂) × (R → ∥ B₂ ∥)) Lens-cong′ A₁↔A₂ B₁↔B₂ = ∃-cong λ _ → Eq.≃-preserves-bijections ext A₁↔A₂ (F.id ×-cong B₁↔B₂) ×-cong →-cong ext F.id (∥∥-cong B₁↔B₂) -- Lens preserves level-preserving bijections. Lens-cong : {A₁ A₂ : Type a} {B₁ B₂ : Type b} → A₁ ↔ A₂ → B₁ ↔ B₂ → Lens A₁ B₁ ↔ Lens A₂ B₂ Lens-cong {A₁ = A₁} {A₂ = A₂} {B₁ = B₁} {B₂ = B₂} A₁↔A₂ B₁↔B₂ = Lens A₁ B₁ ↔⟨ Lens-as-Σ ⟩ (∃ λ R → A₁ ≃ (R × B₁) × (R → ∥ B₁ ∥)) ↝⟨ Lens-cong′ A₁↔A₂ B₁↔B₂ ⟩ (∃ λ R → A₂ ≃ (R × B₂) × (R → ∥ B₂ ∥)) ↔⟨ inverse Lens-as-Σ ⟩□ Lens A₂ B₂ □ -- If B is a proposition, then Lens A B is isomorphic to A → B -- (assuming univalence). lens-to-proposition↔get : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-proposition B → Lens A B ↔ (A → B) lens-to-proposition↔get {b = b} {A = A} {B = B} univ B-prop = Lens A B ↔⟨ Lens-as-Σ ⟩ (∃ λ R → A ≃ (R × B) × (R → ∥ B ∥)) ↝⟨ (∃-cong λ _ → ∃-cong λ _ → ∀-cong ext λ _ → ∥∥↔ B-prop) ⟩ (∃ λ R → A ≃ (R × B) × (R → B)) ↝⟨ (∃-cong λ _ → ×-cong₁ λ R→B → Eq.≃-preserves-bijections ext F.id $ drop-⊤-right λ r → _⇔_.to contractible⇔↔⊤ $ propositional⇒inhabited⇒contractible B-prop (R→B r)) ⟩ (∃ λ R → A ≃ R × (R → B)) ↔⟨ (∃-cong λ _ → ∃-cong λ A≃R → →-cong {k = equivalence} ext (inverse A≃R) F.id) ⟩ (∃ λ R → A ≃ R × (A → B)) ↝⟨ Σ-assoc ⟩ (∃ λ R → A ≃ R) × (A → B) ↝⟨ (drop-⊤-left-× λ _ → other-singleton-with-≃-↔-⊤ {b = b} ext univ) ⟩□ (A → B) □ _ : {A : Type a} {B : Type b} (univ : Univalence (a ⊔ b)) (prop : Is-proposition B) (l : Lens A B) → _↔_.to (lens-to-proposition↔get univ prop) l ≡ Trunc.rec prop id ∘ Lens.inhabited l ∘ Lens.remainder l _ = λ _ _ _ → refl _ -- A variant of the previous result. lens-to-proposition≃get : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-proposition B → Lens A B ≃ (A → B) lens-to-proposition≃get {b = b} {A = A} {B = B} univ prop = Eq.↔→≃ get from refl (λ l → let lemma = ↑ b A ↔⟨ Bij.↑↔ ⟩ A ↝⟨ equiv l ⟩ R l × B ↔⟨ (drop-⊤-right λ r → _⇔_.to contractible⇔↔⊤ $ Trunc.rec (Contractible-propositional ext) (propositional⇒inhabited⇒contractible prop) (inhabited l r)) ⟩□ R l □ in _↔_.from (equality-characterisation₁ ⊠ univ) (lemma , λ _ → refl _)) where open Lens from = λ get → record { R = ↑ b A ; equiv = A ↔⟨ inverse Bij.↑↔ ⟩ ↑ b A ↔⟨ (inverse $ drop-⊤-right {k = bijection} λ (lift a) → _⇔_.to contractible⇔↔⊤ $ propositional⇒inhabited⇒contractible prop (get a)) ⟩□ ↑ b A × B □ ; inhabited = ∣_∣ ∘ get ∘ lower } _ : {A : Type a} {B : Type b} (univ : Univalence (a ⊔ b)) (prop : Is-proposition B) (l : Lens A B) → _≃_.to (lens-to-proposition≃get univ prop) l ≡ Lens.get l _ = λ _ _ _ → refl _ -- If B is contractible, then Lens A B is isomorphic to ⊤ (assuming -- univalence). lens-to-contractible↔⊤ : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Contractible B → Lens A B ↔ ⊤ lens-to-contractible↔⊤ {A = A} {B} univ cB = Lens A B ↝⟨ lens-to-proposition↔get univ (mono₁ 0 cB) ⟩ (A → B) ↝⟨ →-cong ext F.id $ _⇔_.to contractible⇔↔⊤ cB ⟩ (A → ⊤) ↝⟨ →-right-zero ⟩□ ⊤ □ -- Lens A ⊥ is isomorphic to ¬ A (assuming univalence). lens-to-⊥↔¬ : {A : Type a} → Univalence (a ⊔ b) → Lens A (⊥ {ℓ = b}) ↔ ¬ A lens-to-⊥↔¬ {A = A} univ = Lens A ⊥ ↝⟨ lens-to-proposition↔get univ ⊥-propositional ⟩ (A → ⊥) ↝⟨ inverse $ ¬↔→⊥ ext ⟩□ ¬ A □ -- If A is contractible, then Lens A B is isomorphic to Contractible B -- (assuming univalence). lens-from-contractible↔codomain-contractible : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Contractible A → Lens A B ↔ Contractible B lens-from-contractible↔codomain-contractible {A = A} {B} univ cA = Lens A B ↔⟨ Lens-as-Σ ⟩ (∃ λ R → A ≃ (R × B) × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → Eq.≃-preserves-bijections ext (_⇔_.to contractible⇔↔⊤ cA) F.id ×-cong F.id) ⟩ (∃ λ R → ⊤ ≃ (R × B) × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → Eq.inverse-isomorphism ext ×-cong F.id) ⟩ (∃ λ R → (R × B) ≃ ⊤ × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → inverse (contractible↔≃⊤ ext) ×-cong F.id) ⟩ (∃ λ R → Contractible (R × B) × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → Contractible-commutes-with-× ext ×-cong F.id) ⟩ (∃ λ R → (Contractible R × Contractible B) × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → inverse ×-assoc) ⟩ (∃ λ R → Contractible R × Contractible B × (R → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → ∃-cong λ cR → F.id ×-cong →-cong ext (_⇔_.to contractible⇔↔⊤ cR) F.id) ⟩ (∃ λ R → Contractible R × Contractible B × (⊤ → ∥ B ∥)) ↝⟨ ∃-cong (λ _ → F.id ×-cong F.id ×-cong Π-left-identity) ⟩ (∃ λ R → Contractible R × Contractible B × ∥ B ∥) ↝⟨ ∃-cong (λ _ → ×-comm) ⟩ (∃ λ R → (Contractible B × ∥ B ∥) × Contractible R) ↝⟨ ∃-comm ⟩ (Contractible B × ∥ B ∥) × (∃ λ R → Contractible R) ↝⟨ drop-⊤-right (λ _ → ∃Contractible↔⊤ ext univ) ⟩ Contractible B × ∥ B ∥ ↝⟨ drop-⊤-right (λ cB → inhabited⇒∥∥↔⊤ ∣ proj₁ cB ∣) ⟩□ Contractible B □ -- Lens ⊥ B is isomorphic to the unit type (assuming univalence). lens-from-⊥↔⊤ : {B : Type b} → Univalence (a ⊔ b) → Lens (⊥ {ℓ = a}) B ↔ ⊤ lens-from-⊥↔⊤ {B = B} univ = _⇔_.to contractible⇔↔⊤ $ isomorphism-to-lens (⊥ ↝⟨ inverse ×-left-zero ⟩□ ⊥ × B □) , λ l → _↔_.from (equality-characterisation₁ ⊠ univ) ( (⊥ × ∥ B ∥ ↔⟨ ×-left-zero ⟩ ⊥₀ ↔⟨ lemma l ⟩□ R l □) , λ x → ⊥-elim x ) where open Lens lemma : (l : Lens ⊥ B) → ⊥₀ ↔ R l lemma l = record { surjection = record { logical-equivalence = record { to = ⊥-elim ; from = whatever } ; right-inverse-of = whatever } ; left-inverse-of = λ x → ⊥-elim x } where whatever : ∀ {ℓ} {Whatever : R l → Type ℓ} → (r : R l) → Whatever r whatever r = ⊥-elim {ℓ = lzero} $ Trunc.rec ⊥-propositional (λ b → ⊥-elim (_≃_.from (equiv l) (r , b))) (inhabited l r) -- There is an equivalence between A ≃ B and -- ∃ λ (l : Lens A B) → Is-equivalence (Lens.get l) (assuming -- univalence). -- -- See also ≃≃≊ below. ≃-≃-Σ-Lens-Is-equivalence-get : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → (A ≃ B) ≃ (∃ λ (l : Lens A B) → Is-equivalence (Lens.get l)) ≃-≃-Σ-Lens-Is-equivalence-get {a = a} {A = A} {B = B} univ = A ≃ B ↝⟨ Eq.≃-preserves ext F.id (inverse ∥∥×≃) ⟩ A ≃ (∥ B ∥ × B) ↝⟨ inverse $ Eq.↔⇒≃ Σ-left-identity F.∘ Σ-cong (singleton-with-≃-↔-⊤ {a = a} ext univ) (λ (C , C≃∥B∥) → Eq.≃-preserves ext F.id (×-cong₁ λ _ → C≃∥B∥)) ⟩ (∃ λ ((R , _) : ∃ λ R → R ≃ ∥ B ∥) → A ≃ (R × B)) ↔⟨ inverse $ (Σ-cong (∃-cong λ _ → inverse Eq.≃-as-Σ) λ _ → F.id) F.∘ Σ-assoc F.∘ (∃-cong λ _ → inverse (Σ-assoc F.∘ ×-comm)) F.∘ inverse Σ-assoc F.∘ Σ-cong Lens-as-Σ (λ _ → F.id) ⟩ (∃ λ (l : Lens A B) → Is-equivalence (inhabited l)) ↝⟨ inverse $ ∃-cong get-equivalence≃inhabited-equivalence ⟩□ (∃ λ (l : Lens A B) → Is-equivalence (get l)) □ where open Lens -- The right-to-left direction of ≃-≃-Σ-Lens-Is-equivalence-get -- returns the lens's getter (and some proof). to-from-≃-≃-Σ-Lens-Is-equivalence-get≡get : {A : Type a} {B : Type b} → (univ : Univalence (a ⊔ b)) (p@(l , _) : ∃ λ (l : Lens A B) → Is-equivalence (Lens.get l)) → _≃_.to (_≃_.from (≃-≃-Σ-Lens-Is-equivalence-get univ) p) ≡ Lens.get l to-from-≃-≃-Σ-Lens-Is-equivalence-get≡get _ _ = refl _ ------------------------------------------------------------------------ -- Results relating different kinds of lenses -- In general there is no split surjection from Lens A B to -- Traditional.Lens A B (assuming univalence). ¬Lens↠Traditional-lens : Univalence lzero → ¬ (Lens 𝕊¹ ⊤ ↠ Traditional.Lens 𝕊¹ ⊤) ¬Lens↠Traditional-lens univ = Lens 𝕊¹ ⊤ ↠ Traditional.Lens 𝕊¹ ⊤ ↝⟨ flip H-level.respects-surjection 1 ⟩ (Is-proposition (Lens 𝕊¹ ⊤) → Is-proposition (Traditional.Lens 𝕊¹ ⊤)) ↝⟨ _$ mono₁ 0 (_⇔_.from contractible⇔↔⊤ $ lens-to-contractible↔⊤ univ ⊤-contractible) ⟩ Is-proposition (Traditional.Lens 𝕊¹ ⊤) ↝⟨ Traditional.¬-lens-to-⊤-propositional univ ⟩□ ⊥ □ -- Some lemmas used in Lens↠Traditional-lens and Lens↔Traditional-lens -- below. private module Lens↔Traditional-lens {A : Type a} {B : Type b} (A-set : Is-set A) where from : Block "conversion" → Traditional.Lens A B → Lens A B from ⊠ l = isomorphism-to-lens (A ↔⟨ Traditional.≃Σ∥set⁻¹∥× A-set l ⟩□ (∃ λ (f : B → A) → ∥ set ⁻¹ f ∥) × B □) where open Traditional.Lens l to∘from : ∀ bc l → Lens.traditional-lens (from bc l) ≡ l to∘from ⊠ l = Traditional.equal-laws→≡ (λ a _ → B-set a _ _) (λ _ → A-set _ _) (λ _ _ _ → A-set _ _) where open Traditional.Lens l B-set : A → Is-set B B-set a = Traditional.h-level-respects-lens-from-inhabited 2 l a A-set from∘to : Univalence (a ⊔ b) → ∀ bc l → from bc (Lens.traditional-lens l) ≡ l from∘to univ ⊠ l′ = _↔_.from (equality-characterisation₁ ⊠ univ) ( ((∃ λ (f : B → A) → ∥ set ⁻¹ f ∥) × ∥ B ∥ ↝⟨ (×-cong₁ lemma₃) ⟩ (∥ B ∥ → R) × ∥ B ∥ ↝⟨ lemma₂ ⟩□ R □) , λ p → ( proj₁ (_≃_.to l (_≃_.from l (_≃_.to l p))) , proj₂ (_≃_.to l p) ) ≡⟨ cong (_, proj₂ (_≃_.to l p)) $ cong proj₁ $ _≃_.right-inverse-of l _ ⟩∎ _≃_.to l p ∎ ) where open Lens l′ renaming (equiv to l) B-set : A → Is-set B B-set a = Traditional.h-level-respects-lens-from-inhabited 2 (Lens.traditional-lens l′) a A-set R-set : Is-set R R-set = [inhabited⇒+]⇒+ 1 λ r → Trunc.rec (H-level-propositional ext 2) (λ b → proj₁-closure (const b) 2 $ H-level.respects-surjection (_≃_.surjection l) 2 A-set) (inhabited r) lemma₁ : ∥ B ∥ → (f : B → A) → ∥ set ⁻¹ f ∥ ≃ (∀ b b′ → set (f b) b′ ≡ f b′) lemma₁ ∥b∥ f = Eq.⇔→≃ truncation-is-proposition prop (Trunc.rec prop λ (a , set-a≡f) b b′ → set (f b) b′ ≡⟨ cong (λ f → set (f b) b′) $ sym set-a≡f ⟩ set (set a b) b′ ≡⟨ set-set _ _ _ ⟩ set a b′ ≡⟨ cong (_$ b′) set-a≡f ⟩∎ f b′ ∎) (λ hyp → flip ∥∥-map ∥b∥ λ b → f b , ⟨ext⟩ (hyp b)) where prop = Π-closure ext 1 λ _ → Π-closure ext 1 λ _ → A-set lemma₂ : ((∥ B ∥ → R) × ∥ B ∥) ≃ R lemma₂ = Eq.↔→≃ (λ (f , ∥b∥) → f ∥b∥) (λ r → (λ _ → r) , inhabited r) refl (λ (f , ∥b∥) → cong₂ _,_ (⟨ext⟩ λ ∥b∥′ → f ∥b∥ ≡⟨ cong f (truncation-is-proposition _ _) ⟩∎ f ∥b∥′ ∎) (truncation-is-proposition _ _)) lemma₃ = λ ∥b∥ → (∃ λ (f : B → A) → ∥ set ⁻¹ f ∥) ↝⟨ ∃-cong (lemma₁ ∥b∥) ⟩ (∃ λ (f : B → A) → ∀ b b′ → set (f b) b′ ≡ f b′) ↝⟨ (Σ-cong (→-cong ext F.id l) λ f → ∀-cong ext λ b → ∀-cong ext λ b′ → ≡⇒↝ _ $ cong (_≃_.from l (proj₁ (_≃_.to l (f b)) , b′) ≡_) $ sym $ _≃_.left-inverse-of l _) ⟩ (∃ λ (f : B → R × B) → ∀ b b′ → _≃_.from l (proj₁ (f b) , b′) ≡ _≃_.from l (f b′)) ↝⟨ (∃-cong λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → Eq.≃-≡ (inverse l)) ⟩ (∃ λ (f : B → R × B) → ∀ b b′ → (proj₁ (f b) , b′) ≡ f b′) ↔⟨ (Σ-cong ΠΣ-comm λ _ → ∀-cong ext λ _ → ∀-cong ext λ _ → inverse $ ≡×≡↔≡) ⟩ (∃ λ ((f , g) : (B → R) × (B → B)) → ∀ b b′ → f b ≡ f b′ × b′ ≡ g b′) ↔⟨ (Σ-assoc F.∘ (∃-cong λ _ → ∃-comm F.∘ ∃-cong λ _ → ΠΣ-comm F.∘ ∀-cong ext λ _ → ΠΣ-comm) F.∘ inverse Σ-assoc) ⟩ ((∃ λ (f : B → R) → Constant f) × (∃ λ (g : B → B) → B → ∀ b → b ≡ g b)) ↔⟨ (∃-cong $ uncurry λ f _ → ∃-cong λ _ → inverse $ →-intro ext (λ b → B-set (_≃_.from l (f b , b)))) ⟩ ((∃ λ (f : B → R) → Constant f) × (∃ λ (g : B → B) → ∀ b → b ≡ g b)) ↝⟨ (∃-cong λ _ → ∃-cong λ _ → Eq.extensionality-isomorphism ext) ⟩ ((∃ λ (f : B → R) → Constant f) × (∃ λ (g : B → B) → id ≡ g)) ↔⟨ (drop-⊤-right λ _ → _⇔_.to contractible⇔↔⊤ $ other-singleton-contractible _) ⟩ (∃ λ (f : B → R) → Constant f) ↝⟨ constant-function≃∥inhabited∥⇒inhabited R-set ⟩□ (∥ B ∥ → R) □ iso : Block "conversion" → Univalence (a ⊔ b) → Lens A B ↔ Traditional.Lens A B iso bc univ = record { surjection = record { logical-equivalence = record { from = from bc } ; right-inverse-of = to∘from bc } ; left-inverse-of = from∘to univ bc } -- If the domain A is a set, then there is a split surjection from -- Lens A B to Traditional.Lens A B. Lens↠Traditional-lens : Block "conversion" → Is-set A → Lens A B ↠ Traditional.Lens A B Lens↠Traditional-lens {A = A} {B = B} bc A-set = record { logical-equivalence = record { to = Lens.traditional-lens ; from = Lens↔Traditional-lens.from A-set bc } ; right-inverse-of = Lens↔Traditional-lens.to∘from A-set bc } -- The split surjection above preserves getters and setters. Lens↠Traditional-lens-preserves-getters-and-setters : {A : Type a} (b : Block "conversion") (s : Is-set A) → Preserves-getters-and-setters-⇔ A B (_↠_.logical-equivalence (Lens↠Traditional-lens b s)) Lens↠Traditional-lens-preserves-getters-and-setters ⊠ _ = (λ _ → refl _ , refl _) , (λ _ → refl _ , refl _) -- If the domain A is a set, then Traditional.Lens A B and Lens A B -- are isomorphic (assuming univalence). Lens↔Traditional-lens : {A : Type a} {B : Type b} → Block "conversion" → Univalence (a ⊔ b) → Is-set A → Lens A B ↔ Traditional.Lens A B Lens↔Traditional-lens bc univ A-set = Lens↔Traditional-lens.iso A-set bc univ -- The isomorphism preserves getters and setters. Lens↔Traditional-lens-preserves-getters-and-setters : {A : Type a} {B : Type b} (bc : Block "conversion") (univ : Univalence (a ⊔ b)) (s : Is-set A) → Preserves-getters-and-setters-⇔ A B (_↔_.logical-equivalence (Lens↔Traditional-lens bc univ s)) Lens↔Traditional-lens-preserves-getters-and-setters bc _ = Lens↠Traditional-lens-preserves-getters-and-setters bc -- If the codomain B is an inhabited set, then Lens A B and -- Traditional.Lens A B are logically equivalent. -- -- This definition is inspired by the statement of Corollary 13 from -- "Algebras and Update Strategies" by Johnson, Rosebrugh and Wood. -- -- See also Lens.Non-dependent.Equivalent-preimages.coherent↠higher. Lens⇔Traditional-lens : Is-set B → B → Lens A B ⇔ Traditional.Lens A B Lens⇔Traditional-lens {B = B} {A = A} B-set b₀ = record { to = Lens.traditional-lens ; from = from } where from : Traditional.Lens A B → Lens A B from l = isomorphism-to-lens (A ↔⟨ Traditional.≃get⁻¹× B-set b₀ l ⟩□ (∃ λ (a : A) → get a ≡ b₀) × B □) where open Traditional.Lens l -- The logical equivalence preserves getters and setters. Lens⇔Traditional-lens-preserves-getters-and-setters : {B : Type b} (s : Is-set B) (b₀ : B) → Preserves-getters-and-setters-⇔ A B (Lens⇔Traditional-lens s b₀) Lens⇔Traditional-lens-preserves-getters-and-setters _ b₀ = (λ _ → refl _ , refl _) , (λ l → refl _ , ⟨ext⟩ λ a → ⟨ext⟩ λ b → set l (set l a b₀) b ≡⟨ set-set l _ _ _ ⟩∎ set l a b ∎) where open Traditional.Lens ------------------------------------------------------------------------ -- Some results related to h-levels -- If the domain of a lens is inhabited and has h-level n, then the -- codomain also has h-level n. h-level-respects-lens-from-inhabited : ∀ n → Lens A B → A → H-level n A → H-level n B h-level-respects-lens-from-inhabited n = Traditional.h-level-respects-lens-from-inhabited n ∘ Lens.traditional-lens -- This is not necessarily true for arbitrary domains (assuming -- univalence). ¬-h-level-respects-lens : Univalence lzero → ¬ (∀ n → Lens ⊥₀ Bool → H-level n ⊥₀ → H-level n Bool) ¬-h-level-respects-lens univ resp = $⟨ ⊥-propositional ⟩ Is-proposition ⊥ ↝⟨ resp 1 (_↔_.from (lens-from-⊥↔⊤ univ) _) ⟩ Is-proposition Bool ↝⟨ ¬-Bool-propositional ⟩□ ⊥ □ -- In fact, there is a lens with a proposition as its domain and a -- non-set as its codomain (assuming univalence). -- -- (The lemma does not actually use the univalence argument, but -- univalence is used by Circle.¬-𝕊¹-set.) lens-from-proposition-to-non-set : Univalence (# 0) → ∃ λ (A : Type a) → ∃ λ (B : Type b) → Lens A B × Is-proposition A × ¬ Is-set B lens-from-proposition-to-non-set {b = b} _ = ⊥ , ↑ b 𝕊¹ , record { R = ⊥ ; equiv = ⊥ ↔⟨ inverse ×-left-zero ⟩□ ⊥ × ↑ _ 𝕊¹ □ ; inhabited = ⊥-elim } , ⊥-propositional , Circle.¬-𝕊¹-set ∘ H-level.respects-surjection (_↔_.surjection Bij.↑↔) 2 -- Lenses with contractible domains have contractible codomains. contractible-to-contractible : Lens A B → Contractible A → Contractible B contractible-to-contractible l c = h-level-respects-lens-from-inhabited _ l (proj₁ c) c -- If the domain type of a lens has h-level n, then the remainder type -- also has h-level n. remainder-has-same-h-level-as-domain : (l : Lens A B) → ∀ n → H-level n A → H-level n (Lens.R l) remainder-has-same-h-level-as-domain {A = A} {B = B} l n = H-level n A ↝⟨ H-level.respects-surjection (_≃_.surjection equiv) n ⟩ H-level n (R × B) ↝⟨ H-level-×₁ inhabited n ⟩□ H-level n R □ where open Lens l -- If the getter function is an equivalence, then the remainder type -- is propositional. get-equivalence→remainder-propositional : (l : Lens A B) → Is-equivalence (Lens.get l) → Is-proposition (Lens.R l) get-equivalence→remainder-propositional {B = B} l = Is-equivalence (get l) ↔⟨ get-equivalence≃remainder≃∥codomain∥ l ⟩ R l ≃ ∥ B ∥ ↝⟨ ≃∥∥→Is-proposition ⟩□ Is-proposition (R l) □ where open Lens -- If the getter function is pointwise equal to the identity -- function, then the remainder type is propositional. get≡id→remainder-propositional : (l : Lens A A) → (∀ a → Lens.get l a ≡ a) → Is-proposition (Lens.R l) get≡id→remainder-propositional l = (∀ a → Lens.get l a ≡ a) ↝⟨ (λ hyp → Eq.respects-extensional-equality (sym ∘ hyp) (_≃_.is-equivalence F.id)) ⟩ Is-equivalence (Lens.get l) ↝⟨ get-equivalence→remainder-propositional l ⟩□ Is-proposition (Lens.R l) □ -- It is not necessarily the case that contractibility of A implies -- contractibility of Lens A B (assuming univalence). ¬-Contractible-closed-domain : ∀ {a b} → Univalence (a ⊔ b) → ¬ ({A : Type a} {B : Type b} → Contractible A → Contractible (Lens A B)) ¬-Contractible-closed-domain univ closure = $⟨ ↑⊤-contractible ⟩ Contractible (↑ _ ⊤) ↝⟨ closure ⟩ Contractible (Lens (↑ _ ⊤) ⊥) ↝⟨ H-level.respects-surjection (_↔_.surjection $ lens-from-contractible↔codomain-contractible univ ↑⊤-contractible) 0 ⟩ Contractible (Contractible ⊥) ↝⟨ proj₁ ⟩ Contractible ⊥ ↝⟨ proj₁ ⟩ ⊥ ↝⟨ ⊥-elim ⟩□ ⊥₀ □ where ↑⊤-contractible = ↑-closure 0 ⊤-contractible -- Contractible is closed under Lens A (assuming univalence). Contractible-closed-codomain : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Contractible B → Contractible (Lens A B) Contractible-closed-codomain {A = A} {B} univ cB = $⟨ lens-to-contractible↔⊤ univ cB ⟩ Lens A B ↔ ⊤ ↝⟨ _⇔_.from contractible⇔↔⊤ ⟩□ Contractible (Lens A B) □ -- If B is a proposition, then Lens A B is also a proposition -- (assuming univalence). Is-proposition-closed-codomain : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-proposition B → Is-proposition (Lens A B) Is-proposition-closed-codomain {A = A} {B} univ B-prop = $⟨ Π-closure ext 1 (λ _ → B-prop) ⟩ Is-proposition (A → B) ↝⟨ H-level.respects-surjection (_↔_.surjection $ inverse $ lens-to-proposition↔get univ B-prop) 1 ⟩□ Is-proposition (Lens A B) □ private -- If A has h-level 1 + n and equivalence between certain remainder -- types has h-level n, then Lens A B has h-level 1 + n (assuming -- univalence). domain-1+-remainder-equivalence-0+⇒lens-1+ : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → ∀ n → H-level (1 + n) A → ((l₁ l₂ : Lens A B) → H-level n (Lens.R l₁ ≃ Lens.R l₂)) → H-level (1 + n) (Lens A B) domain-1+-remainder-equivalence-0+⇒lens-1+ {A = A} univ n hA hR = ≡↔+ _ _ λ l₁ l₂ → $⟨ Σ-closure n (hR l₁ l₂) (λ _ → Π-closure ext n λ _ → +⇒≡ hA) ⟩ H-level n (∃ λ (eq : R l₁ ≃ R l₂) → ∀ p → _≡_ {A = A} _ _) ↝⟨ H-level.respects-surjection (_↔_.surjection $ inverse $ equality-characterisation₃ univ) n ⟩□ H-level n (l₁ ≡ l₂) □ where open Lens -- If A is a proposition, then Lens A B is also a proposition -- (assuming univalence). Is-proposition-closed-domain : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-proposition A → Is-proposition (Lens A B) Is-proposition-closed-domain {b = b} {A = A} {B = B} univ A-prop = $⟨ R₁≃R₂ ⟩ (∀ l₁ l₂ → R l₁ ≃ R l₂) ↝⟨ (λ hyp l₁ l₂ → propositional⇒inhabited⇒contractible (Eq.left-closure ext 0 (R-prop l₁)) (hyp l₁ l₂)) ⟩ (∀ l₁ l₂ → Contractible (R l₁ ≃ R l₂)) ↝⟨ domain-1+-remainder-equivalence-0+⇒lens-1+ univ 0 A-prop ⟩□ Is-proposition (Lens A B) □ where open Lens R-prop : (l : Lens A B) → Is-proposition (R l) R-prop l = remainder-has-same-h-level-as-domain l 1 A-prop remainder⁻¹ : (l : Lens A B) → R l → A remainder⁻¹ l r = Trunc.rec A-prop (λ b → _≃_.from (equiv l) (r , b)) (inhabited l r) R-to-R : (l₁ l₂ : Lens A B) → R l₁ → R l₂ R-to-R l₁ l₂ = remainder l₂ ∘ remainder⁻¹ l₁ involutive : (l : Lens A B) {f : R l → R l} → ∀ r → f r ≡ r involutive l _ = R-prop l _ _ R₁≃R₂ : (l₁ l₂ : Lens A B) → R l₁ ≃ R l₂ R₁≃R₂ l₁ l₂ = Eq.↔⇒≃ $ Bij.bijection-from-involutive-family R-to-R (λ l _ → involutive l) l₁ l₂ -- An alternative proof. Is-proposition-closed-domain′ : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-proposition A → Is-proposition (Lens A B) Is-proposition-closed-domain′ {A = A} {B} univ A-prop = $⟨ Traditional.lens-preserves-h-level-of-domain 0 A-prop ⟩ Is-proposition (Traditional.Lens A B) ↝⟨ H-level.respects-surjection (_↔_.surjection $ inverse $ Lens↔Traditional-lens ⊠ univ (mono₁ 1 A-prop)) 1 ⟩□ Is-proposition (Lens A B) □ -- If A is a set, then Lens A B is also a set (assuming univalence). -- -- TODO: Can one prove that the corresponding result does not hold for -- codomains? Are there types A and B such that B is a set, but -- Lens A B is not? Is-set-closed-domain : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → Is-set A → Is-set (Lens A B) Is-set-closed-domain {A = A} {B} univ A-set = $⟨ (λ {_ _} → Traditional.lens-preserves-h-level-of-domain 1 A-set) ⟩ Is-set (Traditional.Lens A B) ↝⟨ H-level.respects-surjection (_↔_.surjection $ inverse $ Lens↔Traditional-lens ⊠ univ A-set) 2 ⟩□ Is-set (Lens A B) □ -- If A has h-level n, then Lens A B has h-level 1 + n (assuming -- univalence). -- -- See also -- Lens.Non-dependent.Higher.Coinductive.Small.lens-preserves-h-level-of-domain. domain-0+⇒lens-1+ : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → ∀ n → H-level n A → H-level (1 + n) (Lens A B) domain-0+⇒lens-1+ {A = A} {B} univ n hA = $⟨ (λ l₁ l₂ → Eq.h-level-closure ext n (hR l₁) (hR l₂)) ⟩ ((l₁ l₂ : Lens A B) → H-level n (R l₁ ≃ R l₂)) ↝⟨ domain-1+-remainder-equivalence-0+⇒lens-1+ univ n (mono₁ n hA) ⟩□ H-level (1 + n) (Lens A B) □ where open Lens hR : ∀ l → H-level n (R l) hR l = remainder-has-same-h-level-as-domain l n hA -- An alternative proof. domain-0+⇒lens-1+′ : {A : Type a} {B : Type b} → Univalence (a ⊔ b) → ∀ n → H-level n A → H-level (1 + n) (Lens A B) domain-0+⇒lens-1+′ {A = A} {B} univ n hA = $⟨ Σ-closure (1 + n) (∃-H-level-H-level-1+ ext univ n) (λ _ → ×-closure (1 + n) (Eq.left-closure ext n (mono₁ n hA)) (Π-closure ext (1 + n) λ _ → mono (Nat.suc≤suc (Nat.zero≤ n)) $ truncation-is-proposition)) ⟩ H-level (1 + n) (∃ λ (p : ∃ (H-level n)) → A ≃ (proj₁ p × B) × (proj₁ p → ∥ B ∥)) ↝⟨ H-level.respects-surjection (_↔_.surjection $ inverse iso) (1 + n) ⟩□ H-level (1 + n) (Lens A B) □ where open Lens iso = Lens A B ↝⟨ inverse $ drop-⊤-right (λ l → _⇔_.to contractible⇔↔⊤ $ propositional⇒inhabited⇒contractible (H-level-propositional ext n) (remainder-has-same-h-level-as-domain l n hA)) ⟩ (∃ λ (l : Lens A B) → H-level n (R l)) ↝⟨ inverse Σ-assoc F.∘ Σ-cong Lens-as-Σ (λ _ → F.id) ⟩ (∃ λ R → (A ≃ (R × B) × (R → ∥ B ∥)) × H-level n R) ↝⟨ (∃-cong λ _ → ×-comm) ⟩ (∃ λ R → H-level n R × A ≃ (R × B) × (R → ∥ B ∥)) ↝⟨ Σ-assoc ⟩□ (∃ λ (p : ∃ (H-level n)) → A ≃ (proj₁ p × B) × (proj₁ p → ∥ B ∥)) □ ------------------------------------------------------------------------ -- Some existence results -- There is, in general, no lens for the first projection from a -- Σ-type. no-first-projection-lens : ¬ Lens (∃ λ (b : Bool) → b ≡ true) Bool no-first-projection-lens = Non-dependent.no-first-projection-lens Lens contractible-to-contractible -- A variant of the previous result: If A is merely inhabited, and one -- can "project" out a boolean from a value of type A, but this -- boolean is necessarily true, then there is no lens corresponding to -- this projection. no-singleton-projection-lens : ∥ A ∥ → (bool : A → Bool) → (∀ x → bool x ≡ true) → ¬ ∃ λ (l : Lens A Bool) → ∀ x → Lens.get l x ≡ bool x no-singleton-projection-lens = Non-dependent.no-singleton-projection-lens _ _ Lens.get-set ------------------------------------------------------------------------ -- Equal lenses can be "observably different" -- An example based on one presented in "Shattered lens" by Oleg -- Grenrus. -- -- Grenrus states that there are two lenses with equal getters and -- setters that are "observably different". -- A lemma used to construct the two lenses of the example. grenrus-example : (Bool → Bool ↔ Bool) → Lens (Bool × Bool) Bool grenrus-example eq = record { R = Bool ; inhabited = ∣_∣ ; equiv = Bool × Bool ↔⟨ ×-cong₁ eq ⟩□ Bool × Bool □ } -- The two lenses. grenrus-example₁ = grenrus-example (if_then F.id else Bool.swap) grenrus-example₂ = grenrus-example (if_then Bool.swap else F.id) -- The two lenses have equal setters. set-grenrus-example₁≡set-grenrus-example₂ : Lens.set grenrus-example₁ ≡ Lens.set grenrus-example₂ set-grenrus-example₁≡set-grenrus-example₂ = ⟨ext⟩ (⟨ext⟩ ∘ lemma) where lemma : ∀ _ _ → _ lemma (true , true) true = refl _ lemma (true , true) false = refl _ lemma (true , false) true = refl _ lemma (true , false) false = refl _ lemma (false , true) true = refl _ lemma (false , true) false = refl _ lemma (false , false) true = refl _ lemma (false , false) false = refl _ -- Thus the lenses are equal (assuming univalence). grenrus-example₁≡grenrus-example₂ : Univalence lzero → grenrus-example₁ ≡ grenrus-example₂ grenrus-example₁≡grenrus-example₂ univ = lenses-with-inhabited-codomains-equal-if-setters-equal univ _ _ true set-grenrus-example₁≡set-grenrus-example₂ -- However, in a certain sense the lenses are "observably different". grenrus-example₁-true : Lens.remainder grenrus-example₁ (true , true) ≡ true grenrus-example₁-true = refl _ grenrus-example₂-false : Lens.remainder grenrus-example₂ (true , true) ≡ false grenrus-example₂-false = refl _
programs/oeis/261/A261681.asm
neoneye/loda
22
81250
; A261681: a(n) = 2^n + binomial(n, floor(n/2)) - 1. ; 1,2,5,10,21,41,83,162,325,637,1275,2509,5019,9907,19815,39202,78405,155381,310763,616665,1233331,2449867,4899735,9740685,19481371,38754731,77509463,154276027,308552055,614429671,1228859343,2448023842,4896047685,9756737701 mov $1,2 pow $1,$0 mov $2,$0 div $0,2 bin $2,$0 add $1,$2 sub $1,1 mov $0,$1
Transynther/x86/_processed/NONE/_xt_/i3-7100_9_0x84_notsx.log_41_1455.asm
ljhsiun2/medusa
9
3082
.global s_prepare_buffers s_prepare_buffers: push %r13 push %rax push %rbp push %rbx push %rcx push %rdi push %rsi lea addresses_D_ht+0xf23, %rsi lea addresses_A_ht+0x1c023, %rdi nop nop nop add $52289, %r13 mov $88, %rcx rep movsw nop cmp %r13, %r13 lea addresses_D_ht+0x19f23, %rbp clflush (%rbp) nop nop add %rbx, %rbx mov (%rbp), %eax nop nop nop sub $21885, %rdi lea addresses_WC_ht+0x67b3, %rbx add %rdi, %rdi movw $0x6162, (%rbx) inc %rcx pop %rsi pop %rdi pop %rcx pop %rbx pop %rbp pop %rax pop %r13 ret .global s_faulty_load s_faulty_load: push %r11 push %r14 push %r15 push %r8 push %r9 push %rax push %rbp // Store mov $0x1e692a0000000723, %rax clflush (%rax) nop nop nop nop sub %r14, %r14 mov $0x5152535455565758, %r8 movq %r8, %xmm2 vmovntdq %ymm2, (%rax) nop nop nop nop inc %r14 // Store lea addresses_normal+0x8b23, %rbp nop nop nop and $65456, %rax movl $0x51525354, (%rbp) cmp $54806, %r15 // Faulty Load lea addresses_normal+0xaf23, %r14 nop xor %r9, %r9 mov (%r14), %eax lea oracles, %r9 and $0xff, %rax shlq $12, %rax mov (%r9,%rax,1), %rax pop %rbp pop %rax pop %r9 pop %r8 pop %r15 pop %r14 pop %r11 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_normal', 'same': False, 'size': 8, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_NC', 'same': False, 'size': 32, 'congruent': 11, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} {'dst': {'type': 'addresses_normal', 'same': False, 'size': 4, 'congruent': 8, 'NT': True, 'AVXalign': False}, 'OP': 'STOR'} [Faulty Load] {'src': {'type': 'addresses_normal', 'same': True, 'size': 4, 'congruent': 0, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_D_ht', 'congruent': 11, 'same': False}, 'dst': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'OP': 'REPM'} {'src': {'type': 'addresses_D_ht', 'same': False, 'size': 4, 'congruent': 11, 'NT': False, 'AVXalign': False}, 'OP': 'LOAD'} {'dst': {'type': 'addresses_WC_ht', 'same': False, 'size': 2, 'congruent': 3, 'NT': False, 'AVXalign': False}, 'OP': 'STOR'} {'34': 41} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
examples/mikeos/kernel/user.asm
cashlisa/mos
302
2670
global enter_usermode enter_usermode: cli mov ax, 0x23 ; user mode data selector is 0x20 (GDT entry 3). Also sets RPL to 3 mov ds, ax mov es, ax mov fs, ax mov gs, ax push 0x23 ; SS, notice it uses same selector as above push esp ; ESP pushfd ; EFLAGS pop eax or eax, 0x200 ; enable IF in EFLAGS push eax push 0x1b ; CS, user mode code selector is 0x18. With RPL 3 this is 0x1b lea eax, [user_start] ; EIP first push eax iretd user_start: add esp, 4
src/aco-protocols-synchronization.ads
jonashaggstrom/ada-canopen
6
25485
<filename>src/aco-protocols-synchronization.ads with Ada.Real_Time; with ACO.CANopen; with ACO.OD; private with Interfaces; private with ACO.Log; private with ACO.Utils.Generic_Alarms; private with ACO.Events; package ACO.Protocols.Synchronization is SYNC_CAN_Id : constant ACO.Messages.Id_Type := 16#80#; type SYNC (Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Protocol with private; overriding function Is_Valid (This : in out SYNC; Msg : in ACO.Messages.Message) return Boolean; procedure Message_Received (This : in out SYNC; Msg : in ACO.Messages.Message); procedure Periodic_Actions (This : in out SYNC; T_Now : in Ada.Real_Time.Time); private subtype Sync_Counter is Natural range 0 .. 240; overriding procedure Initialize (This : in out SYNC); overriding procedure Finalize (This : in out SYNC); package Alarms is new ACO.Utils.Generic_Alarms (1); type Sync_Producer_Alarm (SYNC_Ref : not null access SYNC) is new Alarms.Alarm_Type with null record; overriding procedure Signal (This : access Sync_Producer_Alarm; T_Now : in Ada.Real_Time.Time); subtype Counter_Type is Interfaces.Unsigned_8 range 1 .. Interfaces.Unsigned_8'Last; type Entry_Update_Subscriber (Sync_Ref : not null access SYNC) is new ACO.Events.Event_Listener (ACO.Events.OD_Entry_Update) with null record; overriding procedure On_Event (This : in out Entry_Update_Subscriber; Data : in ACO.Events.Event_Data); type Node_State_Change_Subscriber (Sync_Ref : not null access SYNC) is new ACO.Events.Event_Listener (ACO.Events.State_Transition) with null record; overriding procedure On_Event (This : in out Node_State_Change_Subscriber; Data : in ACO.Events.Event_Data); type SYNC (Handler : not null access ACO.CANopen.Handler; Od : not null access ACO.OD.Object_Dictionary'Class) is new Protocol (Od) with record Timers : Alarms.Alarm_Manager; Producer_Alarm : aliased Sync_Producer_Alarm (SYNC'Access); Counter : Counter_Type := Counter_Type'First; Entry_Update : aliased Entry_Update_Subscriber (SYNC'Access); State_Change : aliased Node_State_Change_Subscriber (SYNC'Access); end record; procedure SYNC_Log (This : in out SYNC; Level : in ACO.Log.Log_Level; Message : in String); end ACO.Protocols.Synchronization;
Transynther/x86/_processed/NONE/_xt_/i7-8650U_0xd2.log_202_79.asm
ljhsiun2/medusa
9
81986
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r13 push %r15 push %r8 push %rax push %rcx push %rdi push %rdx push %rsi lea addresses_WC_ht+0x9c99, %r10 nop nop nop nop dec %rax vmovups (%r10), %ymm7 vextracti128 $1, %ymm7, %xmm7 vpextrq $1, %xmm7, %r15 nop nop nop nop sub $47310, %rax lea addresses_WT_ht+0x107bb, %rdx nop nop nop nop and $52630, %rax movups (%rdx), %xmm5 vpextrq $1, %xmm5, %r13 cmp %r10, %r10 lea addresses_normal_ht+0x19ebb, %r8 xor %rcx, %rcx mov $0x6162636465666768, %rax movq %rax, %xmm3 movups %xmm3, (%r8) cmp %r10, %r10 lea addresses_D_ht+0xaafb, %r8 nop nop nop nop cmp %r10, %r10 and $0xffffffffffffffc0, %r8 movaps (%r8), %xmm2 vpextrq $0, %xmm2, %r13 nop nop lfence lea addresses_UC_ht+0xe21b, %rsi lea addresses_normal_ht+0x3bb, %rdi clflush (%rsi) nop add $13036, %r15 mov $33, %rcx rep movsq nop nop nop nop sub %rcx, %rcx lea addresses_WT_ht+0x106bb, %rsi lea addresses_D_ht+0x1a1d, %rdi nop nop nop xor %r8, %r8 mov $75, %rcx rep movsb nop nop nop nop nop and %rax, %rax lea addresses_D_ht+0x1ec3d, %rcx nop nop sub $14212, %rax mov $0x6162636465666768, %r8 movq %r8, %xmm7 vmovups %ymm7, (%rcx) nop nop xor %rsi, %rsi lea addresses_D_ht+0x173fb, %r8 nop nop nop nop dec %rdx movups (%r8), %xmm2 vpextrq $0, %xmm2, %rsi nop nop nop nop nop cmp %r15, %r15 pop %rsi pop %rdx pop %rdi pop %rcx pop %rax pop %r8 pop %r15 pop %r13 pop %r10 ret .global s_faulty_load s_faulty_load: push %r11 push %r12 push %rax push %rbp push %rdi // Faulty Load lea addresses_normal+0x54bb, %rax nop nop nop nop nop add $23997, %rdi vmovups (%rax), %ymm5 vextracti128 $1, %ymm5, %xmm5 vpextrq $1, %xmm5, %r11 lea oracles, %rdi and $0xff, %r11 shlq $12, %r11 mov (%rdi,%r11,1), %r11 pop %rdi pop %rbp pop %rax pop %r12 pop %r11 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_normal', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_WT_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 9, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': True, 'NT': False, 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 5, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 8, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D_ht', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 1, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_D_ht', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 6, 'same': False}} {'34': 202} 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 34 */
src/org/netbeans/modules/frege/editor/Frege.g4
rajmahendra/netbeans-frege-support
4
1093
<gh_stars>1-10 /** * Frege grammar for ANTLR v4 * * Frege is a pure functional programming language for the JVM in the spirit of Haskell. * */ grammar Frege; NEWLINE : '\r'? '\n' ; CONSTRUCTOR_ID : UPPER_CASE ( LETTER | DIGIT | '\'' )* ; VARIABLE_ID : LOWER_CASE ( LETTER | DIGIT | '\'' )* ; LETTER : UPPER_CASE | LOWER_CASE; INTEGER : DECIMAL | '0o' OCTAL | '0O' OCTAL | '0x' HEXADECIMAL | '0X' HEXADECIMAL ; HEXADECIMAL : (HEXIT)+ ; OCTAL : (OCTIT)+ ; DECIMAL : (DIGIT)+ ; DIGIT : '0'..'9'; HEXIT : DIGIT | 'A'..'F' | 'a'..'f' ; OCTIT : '0'..'7' ; LEFT_CURLY : '{' ; RIGHT_CURLY : '}' ; SEMICOLON : ';' ; LEFT_PAREN : '(' ; RIGHT_PAREN : ')' ; LEFT_BRACKET : '[' ; RIGHT_BRACKET : ']' ; COMMA : ',' ; INFIX_QUOTE : '`' ; VARSYM : SYMBOL (SYMBOL | ':' )* ; CONSYM : ':' (SYMBOL | ':' )* ; LOWER_CASE : ('a'..'z'|'_'); UPPER_CASE : 'A'..'Z'; SYMBOL : '!' | '#' | '$' | '%' | '&' | '*' | '+' | '.' | '/' | '<' | '=' | '>' | '?' | '@' | '\\' | '^' | '-' | '~' | '|' ; UNANTICIPATED_SYMBOL : ~('a'..'z' | 'A'..'Z' | '0'..'9') ; /* * Keyword */ AS : 'as' ; CASE: 'case'; CLASS : 'class' ; DATA : 'data' ; DEFAULT : 'default' ; DERIVING : 'deriving' ; DO : 'do' ; ELSE: 'else'; HIDING : 'hiding' ; FOREIGN: 'foreign'; IF: 'if'; IMPORT : 'import' ; IN: 'in'; INFIX : 'infix' ; INFIXL : 'infixl' ; INFIXR : 'infixr' ; INSTANCE : 'instance' ; LET : 'let' ; MODULE : 'module' ; NEWTYPE : 'newtype' ; OF : 'of' ; QUALIFIED : 'qualified' ; THEN: 'then'; TYPE : 'type' ; WHERE : 'where' ; CONTEXT_ARROW : '=>' ; EQUALS : '=' ; ALT : '|' ; OFTYPE : '::' ; WS : [ \t\r\n]+ -> skip ; // skip spaces, tabs, newlines COMMENT : LINE_COMMENT | BLOCK_COMMENT ; LINE_COMMENT : '--' (~'\n')* ; BLOCK_COMMENT : '{-' .*? '-}' ;
arch/ARM/STM32/driversWL5x/stm32-subghzphy.ads
morbos/Ada_Drivers_Library
2
26400
with HAL; use HAL; with HAL.SPI; with STM32.Device; use STM32.Device; with STM32.SPI; use STM32.SPI; package STM32.SubGhzPhy is SubGhzPhyPort : constant access SPI_Port := SPI_3'Access; procedure SubGhzPhy_Init; end STM32.SubGhzPhy;
3-mid/opengl/applet/demo/culler/many_boxes/launch_many_boxes_demo.adb
charlie5/lace
20
9891
<reponame>charlie5/lace<filename>3-mid/opengl/applet/demo/culler/many_boxes/launch_many_boxes_demo.adb<gh_stars>10-100 with openGL.Palette, openGL.Model.Box.lit_colored_textured, openGL.Visual, openGL.Demo; procedure launch_many_Boxes_Demo -- -- Exercise the culler with many boxes. -- is use openGL, openGL.Model, openGL.Model.box, openGL.Palette, openGL.Math, openGL.linear_Algebra_3d; begin Demo.print_Usage; Demo.define ("openGL 'many Boxes' Demo"); -- Setup the camera. -- Demo.Camera.Position_is ((0.0, 0.0, 5.0), y_Rotation_from (to_Radians (0.0))); declare Face : constant asset_Name := to_Asset ("assets/Face1.bmp"); the_box_Model : constant Box.lit_colored_textured.view := Box.lit_colored_textured.new_Box (size => (0.5, 0.5, 0.5), faces => (front => (colors => (others => (White, Opaque)), texture_name => Face), rear => (colors => (others => (Blue, Opaque)), texture_name => Face), upper => (colors => (others => (Green, Opaque)), texture_name => Face), lower => (colors => (others => (Green, Opaque)), texture_name => Face), left => (colors => (others => (Dark_Red, Opaque)), texture_name => Face), right => (colors => (others => (Red, Opaque)), texture_name => Face))); Size : constant Integer := 70; x : openGL.Real := -openGL.Real (Size) / 2.0; z : openGL.Real := 0.0; Sprites : constant Visual.views (1 .. Size * Size) := (others => Visual.Forge.new_Visual (Model.view (the_box_Model))); begin for i in Sprites'Range loop x := x + 1.0; if i mod Size = 0 then z := z - 1.0; x := -openGL.Real (Size) / 2.0; end if; Sprites (i).Site_is ((x, 0.0, z)); end loop; -- Main loop. -- while not Demo.Done loop Demo.Dolly.evolve; Demo.Done := Demo.Dolly.quit_Requested; Demo.Camera.render (Sprites); while not Demo.Camera.cull_Completed loop delay Duration'Small; end loop; Demo.Renderer.render; Demo.FPS_Counter.increment; -- Frames per second display. end loop; end; Demo.destroy; end launch_many_Boxes_Demo;
src/notcurses-context.ads
JeremyGrosser/notcursesada
5
16004
-- -- Copyright 2021 (C) <NAME> <<EMAIL>> -- -- SPDX-License-Identifier: Apache-2.0 -- package Notcurses.Context is -- These procedures modify the default context procedure Initialize; procedure Stop; procedure Render (Context : Notcurses_Context); procedure Enable_Cursor (Context : Notcurses_Context; Y, X : Integer := 0); procedure Enable_Mouse (Context : Notcurses_Context); function Get (Context : Notcurses_Context) return Notcurses_Input; function Palette_Size (Context : Notcurses_Context) return Natural; procedure Stop (Context : in out Notcurses_Context); end Notcurses.Context;
qxl/qxl.flow.asm
olifink/smsqe
0
173385
; QXL_FLOW.ASM Handles the QXL-PC flow control message ; 2006.10.01 1.01 use 32 bit transfer (BC) ASSUME ds:DGROUP ASSUME es:DGROUP ; SI updated ; DI smashed qxl_flow: ; push si ; mov di, OFFSET flowqx_mess ; mov si, OFFSET comm_count ; call deb_cnt_buff ; pop si mov di, OFFSET flowqx_mess stosw movsw movsd ; push si ; mov di, OFFSET flowqx_mess ; mov si, OFFSET comm_count ; call deb_cnt_buff ; pop si jmp qxl_rxm_loop
Task/Copy-a-string/Ada/copy-a-string-2.ada
LaudateCorpus1/RosettaCodeData
1
22747
Src : String := "Rosetta Stone"; Dest : String := Src(1..7); -- Assigns "Rosetta" to Dest Dest2 : String := Src(9..13); -- Assigns "Stone" to Dest2
source/core/web-core-connectables-slots_0-slots_1-slots_2-generic_slots.adb
godunko/adawebui
2
19769
------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Web Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2016-2020, <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: 5711 $ $Date: 2017-01-21 21:29:05 +0300 (Сб, 21 янв 2017) $ ------------------------------------------------------------------------------ package body Web.Core.Connectables.Slots_0.Slots_1.Slots_2.Generic_Slots is --------------------- -- Create_Slot_End -- --------------------- overriding function Create_Slot_End (Self : Slot) return not null Slot_End_Access is begin -- return -- new Slot_End' -- (Next => null, -- Previous => null, -- Object => Self.Object.all'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : not null Slot_End_Access := new Slot_End (Self.Object.all'Unchecked_Access) do Result.Next := null; Result.Previous := null; end return; end Create_Slot_End; ------------ -- Invoke -- ------------ overriding procedure Invoke (Self : in out Slot_End; Parameter_1 : Parameter_1_Type; Parameter_2 : Parameter_2_Type) is begin Subprogram (Self.Object.all, Parameter_1, Parameter_2); end Invoke; ----------- -- Owner -- ----------- overriding function Owner (Self : Slot_End) return not null Core.Connectables.Object_Access is begin return Core.Connectables.Connectable_Object'Class (Self.Object.all)'Unchecked_Access; end Owner; ------------- -- To_Slot -- ------------- function To_Slot (Self : in out Abstract_Object'Class) return Slots_2.Slot'Class is begin -- return Slot'(Object => Self'Unchecked_Access); -- XXX A2JS: invalid code generated return Result : Slot (Self'Unchecked_Access); end To_Slot; end Web.Core.Connectables.Slots_0.Slots_1.Slots_2.Generic_Slots;
arch/ARM/STM32/svd/stm32wb55x/stm32_svd-usart1.ads
morbos/Ada_Drivers_Library
2
1647
-- This spec has been automatically generated from STM32WB55x.svd pragma Restrictions (No_Elaboration_Code); pragma Ada_2012; pragma Style_Checks (Off); with HAL; with System; package STM32_SVD.USART1 is pragma Preelaborate; --------------- -- Registers -- --------------- subtype CR1_DEDT_Field is HAL.UInt5; subtype CR1_DEAT_Field is HAL.UInt5; type CR1_Register is record UE : Boolean := False; UESM : Boolean := False; RE : Boolean := False; TE : Boolean := False; IDLEIE : Boolean := False; RXFNEIE : Boolean := False; TCIE : Boolean := False; TXFNFIE : Boolean := False; PEIE : Boolean := False; PS : Boolean := False; PCE : Boolean := False; WAKE : Boolean := False; M0 : Boolean := False; MME : Boolean := False; CMIE : Boolean := False; OVER8 : Boolean := False; DEDT : CR1_DEDT_Field := 16#0#; DEAT : CR1_DEAT_Field := 16#0#; RTOIE : Boolean := False; EOBIE : Boolean := False; M1 : Boolean := False; FIFOEN : Boolean := False; TXFEIE : Boolean := False; RXFFIE : Boolean := False; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR1_Register use record UE at 0 range 0 .. 0; UESM at 0 range 1 .. 1; RE at 0 range 2 .. 2; TE at 0 range 3 .. 3; IDLEIE at 0 range 4 .. 4; RXFNEIE at 0 range 5 .. 5; TCIE at 0 range 6 .. 6; TXFNFIE at 0 range 7 .. 7; PEIE at 0 range 8 .. 8; PS at 0 range 9 .. 9; PCE at 0 range 10 .. 10; WAKE at 0 range 11 .. 11; M0 at 0 range 12 .. 12; MME at 0 range 13 .. 13; CMIE at 0 range 14 .. 14; OVER8 at 0 range 15 .. 15; DEDT at 0 range 16 .. 20; DEAT at 0 range 21 .. 25; RTOIE at 0 range 26 .. 26; EOBIE at 0 range 27 .. 27; M1 at 0 range 28 .. 28; FIFOEN at 0 range 29 .. 29; TXFEIE at 0 range 30 .. 30; RXFFIE at 0 range 31 .. 31; end record; subtype CR2_STOP_Field is HAL.UInt2; subtype CR2_ABRMOD_Field is HAL.UInt2; subtype CR2_ADD_Field is HAL.UInt8; type CR2_Register is record SLVEN : Boolean := False; -- unspecified Reserved_1_2 : HAL.UInt2 := 16#0#; DIS_NSS : Boolean := False; ADDM7 : Boolean := False; LBDL : Boolean := False; LBDIE : Boolean := False; -- unspecified Reserved_7_7 : HAL.Bit := 16#0#; LBCL : Boolean := False; CPHA : Boolean := False; CPOL : Boolean := False; CLKEN : Boolean := False; STOP : CR2_STOP_Field := 16#0#; LINEN : Boolean := False; SWAP : Boolean := False; RXINV : Boolean := False; TXINV : Boolean := False; DATAINV : Boolean := False; MSBFIRST : Boolean := False; ABREN : Boolean := False; ABRMOD : CR2_ABRMOD_Field := 16#0#; RTOEN : Boolean := False; ADD : CR2_ADD_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR2_Register use record SLVEN at 0 range 0 .. 0; Reserved_1_2 at 0 range 1 .. 2; DIS_NSS at 0 range 3 .. 3; ADDM7 at 0 range 4 .. 4; LBDL at 0 range 5 .. 5; LBDIE at 0 range 6 .. 6; Reserved_7_7 at 0 range 7 .. 7; LBCL at 0 range 8 .. 8; CPHA at 0 range 9 .. 9; CPOL at 0 range 10 .. 10; CLKEN at 0 range 11 .. 11; STOP at 0 range 12 .. 13; LINEN at 0 range 14 .. 14; SWAP at 0 range 15 .. 15; RXINV at 0 range 16 .. 16; TXINV at 0 range 17 .. 17; DATAINV at 0 range 18 .. 18; MSBFIRST at 0 range 19 .. 19; ABREN at 0 range 20 .. 20; ABRMOD at 0 range 21 .. 22; RTOEN at 0 range 23 .. 23; ADD at 0 range 24 .. 31; end record; subtype CR3_SCARCNT_Field is HAL.UInt3; subtype CR3_WUS_Field is HAL.UInt2; subtype CR3_RXFTCFG_Field is HAL.UInt3; subtype CR3_TXFTCFG_Field is HAL.UInt3; type CR3_Register is record EIE : Boolean := False; IREN : Boolean := False; IRLP : Boolean := False; HDSEL : Boolean := False; NACK : Boolean := False; SCEN : Boolean := False; DMAR : Boolean := False; DMAT : Boolean := False; RTSE : Boolean := False; CTSE : Boolean := False; CTSIE : Boolean := False; ONEBIT : Boolean := False; OVRDIS : Boolean := False; DDRE : Boolean := False; DEM : Boolean := False; DEP : Boolean := False; -- unspecified Reserved_16_16 : HAL.Bit := 16#0#; SCARCNT : CR3_SCARCNT_Field := 16#0#; WUS : CR3_WUS_Field := 16#0#; WUFIE : Boolean := False; TXFTIE : Boolean := False; TCBGTIE : Boolean := False; RXFTCFG : CR3_RXFTCFG_Field := 16#0#; RXFTIE : Boolean := False; TXFTCFG : CR3_TXFTCFG_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for CR3_Register use record EIE at 0 range 0 .. 0; IREN at 0 range 1 .. 1; IRLP at 0 range 2 .. 2; HDSEL at 0 range 3 .. 3; NACK at 0 range 4 .. 4; SCEN at 0 range 5 .. 5; DMAR at 0 range 6 .. 6; DMAT at 0 range 7 .. 7; RTSE at 0 range 8 .. 8; CTSE at 0 range 9 .. 9; CTSIE at 0 range 10 .. 10; ONEBIT at 0 range 11 .. 11; OVRDIS at 0 range 12 .. 12; DDRE at 0 range 13 .. 13; DEM at 0 range 14 .. 14; DEP at 0 range 15 .. 15; Reserved_16_16 at 0 range 16 .. 16; SCARCNT at 0 range 17 .. 19; WUS at 0 range 20 .. 21; WUFIE at 0 range 22 .. 22; TXFTIE at 0 range 23 .. 23; TCBGTIE at 0 range 24 .. 24; RXFTCFG at 0 range 25 .. 27; RXFTIE at 0 range 28 .. 28; TXFTCFG at 0 range 29 .. 31; end record; subtype BRR_DIV_Fraction_Field is HAL.UInt4; subtype BRR_DIV_Mantissa_Field is HAL.UInt12; type BRR_Register is record -- unspecified Reserved_0_0 : HAL.Bit := 16#0#; DIV_Fraction : BRR_DIV_Fraction_Field := 16#0#; DIV_Mantissa : BRR_DIV_Mantissa_Field := 16#0#; -- unspecified Reserved_17_31 : HAL.UInt15 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for BRR_Register use record Reserved_0_0 at 0 range 0 .. 0; DIV_Fraction at 0 range 1 .. 4; DIV_Mantissa at 0 range 5 .. 16; Reserved_17_31 at 0 range 17 .. 31; end record; subtype GTPR_PSC_Field is HAL.UInt8; subtype GTPR_GT_Field is HAL.UInt8; type GTPR_Register is record PSC : GTPR_PSC_Field := 16#0#; GT : GTPR_GT_Field := 16#0#; -- unspecified Reserved_16_31 : HAL.UInt16 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for GTPR_Register use record PSC at 0 range 0 .. 7; GT at 0 range 8 .. 15; Reserved_16_31 at 0 range 16 .. 31; end record; subtype RTOR_RTO_Field is HAL.UInt24; subtype RTOR_BLEN_Field is HAL.UInt8; type RTOR_Register is record RTO : RTOR_RTO_Field := 16#0#; BLEN : RTOR_BLEN_Field := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RTOR_Register use record RTO at 0 range 0 .. 23; BLEN at 0 range 24 .. 31; end record; type RQR_Register is record ABRRQ : Boolean := False; SBKRQ : Boolean := False; MMRQ : Boolean := False; RXFRQ : Boolean := False; TXFRQ : Boolean := False; -- unspecified Reserved_5_31 : HAL.UInt27 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RQR_Register use record ABRRQ at 0 range 0 .. 0; SBKRQ at 0 range 1 .. 1; MMRQ at 0 range 2 .. 2; RXFRQ at 0 range 3 .. 3; TXFRQ at 0 range 4 .. 4; Reserved_5_31 at 0 range 5 .. 31; end record; type ISR_Register is record PE : Boolean := False; FE : Boolean := False; NE : Boolean := False; ORE : Boolean := False; IDLE : Boolean := False; RXNE : Boolean := False; TC : Boolean := False; TXE : Boolean := False; LBDF : Boolean := False; CTSIF : Boolean := False; CTS : Boolean := False; RTOF : Boolean := False; EOBF : Boolean := False; UDR : Boolean := False; ABRE : Boolean := False; ABRF : Boolean := False; BUSY : Boolean := False; CMF : Boolean := False; SBKF : Boolean := False; RWU : Boolean := False; WUF : Boolean := False; TEACK : Boolean := False; REACK : Boolean := False; TXFE : Boolean := False; RXFF : Boolean := False; TCBGT : Boolean := False; RXFT : Boolean := False; TXFT : Boolean := False; -- unspecified Reserved_28_31 : HAL.UInt4 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ISR_Register use record PE at 0 range 0 .. 0; FE at 0 range 1 .. 1; NE at 0 range 2 .. 2; ORE at 0 range 3 .. 3; IDLE at 0 range 4 .. 4; RXNE at 0 range 5 .. 5; TC at 0 range 6 .. 6; TXE at 0 range 7 .. 7; LBDF at 0 range 8 .. 8; CTSIF at 0 range 9 .. 9; CTS at 0 range 10 .. 10; RTOF at 0 range 11 .. 11; EOBF at 0 range 12 .. 12; UDR at 0 range 13 .. 13; ABRE at 0 range 14 .. 14; ABRF at 0 range 15 .. 15; BUSY at 0 range 16 .. 16; CMF at 0 range 17 .. 17; SBKF at 0 range 18 .. 18; RWU at 0 range 19 .. 19; WUF at 0 range 20 .. 20; TEACK at 0 range 21 .. 21; REACK at 0 range 22 .. 22; TXFE at 0 range 23 .. 23; RXFF at 0 range 24 .. 24; TCBGT at 0 range 25 .. 25; RXFT at 0 range 26 .. 26; TXFT at 0 range 27 .. 27; Reserved_28_31 at 0 range 28 .. 31; end record; type ICR_Register is record PECF : Boolean := False; FECF : Boolean := False; NECF : Boolean := False; ORECF : Boolean := False; IDLECF : Boolean := False; TXFECF : Boolean := False; TCCF : Boolean := False; TCBGTCF : Boolean := False; LBDCF : Boolean := False; CTSCF : Boolean := False; -- unspecified Reserved_10_10 : HAL.Bit := 16#0#; RTOCF : Boolean := False; EOBCF : Boolean := False; UDRCF : Boolean := False; -- unspecified Reserved_14_16 : HAL.UInt3 := 16#0#; CMCF : Boolean := False; -- unspecified Reserved_18_19 : HAL.UInt2 := 16#0#; WUCF : Boolean := False; -- unspecified Reserved_21_31 : HAL.UInt11 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for ICR_Register use record PECF at 0 range 0 .. 0; FECF at 0 range 1 .. 1; NECF at 0 range 2 .. 2; ORECF at 0 range 3 .. 3; IDLECF at 0 range 4 .. 4; TXFECF at 0 range 5 .. 5; TCCF at 0 range 6 .. 6; TCBGTCF at 0 range 7 .. 7; LBDCF at 0 range 8 .. 8; CTSCF at 0 range 9 .. 9; Reserved_10_10 at 0 range 10 .. 10; RTOCF at 0 range 11 .. 11; EOBCF at 0 range 12 .. 12; UDRCF at 0 range 13 .. 13; Reserved_14_16 at 0 range 14 .. 16; CMCF at 0 range 17 .. 17; Reserved_18_19 at 0 range 18 .. 19; WUCF at 0 range 20 .. 20; Reserved_21_31 at 0 range 21 .. 31; end record; subtype RDR_RDR_Field is HAL.UInt9; type RDR_Register is record RDR : RDR_RDR_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for RDR_Register use record RDR at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype TDR_TDR_Field is HAL.UInt9; type TDR_Register is record TDR : TDR_TDR_Field := 16#0#; -- unspecified Reserved_9_31 : HAL.UInt23 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for TDR_Register use record TDR at 0 range 0 .. 8; Reserved_9_31 at 0 range 9 .. 31; end record; subtype PRESC_PRESCALER_Field is HAL.UInt4; type PRESC_Register is record PRESCALER : PRESC_PRESCALER_Field := 16#0#; -- unspecified Reserved_4_31 : HAL.UInt28 := 16#0#; end record with Volatile_Full_Access, Size => 32, Bit_Order => System.Low_Order_First; for PRESC_Register use record PRESCALER at 0 range 0 .. 3; Reserved_4_31 at 0 range 4 .. 31; end record; ----------------- -- Peripherals -- ----------------- type USART1_Peripheral is record CR1 : aliased CR1_Register; CR2 : aliased CR2_Register; CR3 : aliased CR3_Register; BRR : aliased BRR_Register; GTPR : aliased GTPR_Register; RTOR : aliased RTOR_Register; RQR : aliased RQR_Register; ISR : aliased ISR_Register; ICR : aliased ICR_Register; RDR : aliased RDR_Register; TDR : aliased TDR_Register; PRESC : aliased PRESC_Register; end record with Volatile; for USART1_Peripheral use record CR1 at 16#0# range 0 .. 31; CR2 at 16#4# range 0 .. 31; CR3 at 16#8# range 0 .. 31; BRR at 16#C# range 0 .. 31; GTPR at 16#10# range 0 .. 31; RTOR at 16#14# range 0 .. 31; RQR at 16#18# range 0 .. 31; ISR at 16#1C# range 0 .. 31; ICR at 16#20# range 0 .. 31; RDR at 16#24# range 0 .. 31; TDR at 16#28# range 0 .. 31; PRESC at 16#2C# range 0 .. 31; end record; USART1_Periph : aliased USART1_Peripheral with Import, Address => System'To_Address (16#40013800#); end STM32_SVD.USART1;
test/p2.asm
slcz/hummingbird
0
241321
<filename>test/p2.asm #include "hi.asm" // Test basic instructions, "nop" dumps processor state lh H(0x5a) addi L(0x5a) neg // a = a6 nop sign jc 1f li(0) 2: jmp 2b 1: // a = 1 li(1) nop li (0x5a) sign jc 1f // a = 2 li(2) nop jmp 0f 1: li(0) 1: jmp 1b 0: li (0x5a) shl // a = b4 nop shl // a = 68 nop shl // a = d0 nop shl // a = a0 nop li (0x5a) shr // a = 2d nop // a = 16 shr nop li (0x5a) shl4 // a = a0 nop li (0x5a) rol // b4 nop rol // 69 nop swap // 96 nop asr // cb 1: jmp 1b
Transynther/x86/_processed/AVXALIGN/_st_zr_4k_sm_/i7-8650U_0xd2_notsx.log_187_520.asm
ljhsiun2/medusa
9
245409
<reponame>ljhsiun2/medusa<gh_stars>1-10 .global s_prepare_buffers s_prepare_buffers: push %r13 push %r8 push %rax push %rbx push %rcx push %rdi push %rdx push %rsi lea addresses_WT_ht+0xe99a, %rbx nop nop nop nop nop dec %rdi mov $0x6162636465666768, %rdx movq %rdx, (%rbx) nop nop nop nop nop xor %r13, %r13 lea addresses_WC_ht+0xf51a, %r8 nop nop nop mfence mov (%r8), %rax nop nop add %rax, %rax lea addresses_normal_ht+0x1319a, %rsi lea addresses_WC_ht+0x111a, %rdi nop nop nop cmp %rdx, %rdx mov $56, %rcx rep movsw nop and %r8, %r8 lea addresses_UC_ht+0x3582, %rsi lea addresses_D_ht+0xda5e, %rdi nop nop nop inc %r13 mov $105, %rcx rep movsq nop nop nop nop inc %rbx lea addresses_UC_ht+0x119a, %r8 nop nop nop nop nop cmp %rdx, %rdx movb $0x61, (%r8) nop nop nop nop xor $9106, %rbx lea addresses_A_ht+0x869a, %rsi lea addresses_WC_ht+0xfc5a, %rdi nop sub $1275, %rdx mov $49, %rcx rep movsq cmp %r13, %r13 lea addresses_UC_ht+0xa23a, %rcx clflush (%rcx) cmp $762, %rax mov (%rcx), %rdi nop add $57007, %rbx lea addresses_WT_ht+0x1809a, %rdi nop and %rdx, %rdx mov $0x6162636465666768, %rbx movq %rbx, (%rdi) nop nop nop nop cmp $38264, %r13 lea addresses_normal_ht+0x1471a, %r8 inc %r13 mov (%r8), %ecx nop nop nop dec %rax lea addresses_WC_ht+0x2d9a, %rsi lea addresses_normal_ht+0x1b8da, %rdi nop sub $10409, %r13 mov $25, %rcx rep movsb nop nop nop xor %r8, %r8 lea addresses_WC_ht+0xd59a, %rsi lea addresses_UC_ht+0x1843a, %rdi nop nop xor %rax, %rax mov $122, %rcx rep movsw sub %rdi, %rdi lea addresses_UC_ht+0x13b3a, %r13 nop nop cmp %rbx, %rbx mov $0x6162636465666768, %rsi movq %rsi, (%r13) nop nop nop sub %rdx, %rdx lea addresses_D_ht+0x5a1a, %rsi lea addresses_normal_ht+0x7d9a, %rdi nop nop nop dec %rax mov $53, %rcx rep movsl nop nop nop and %rax, %rax lea addresses_WC_ht+0x1c11a, %rbx nop nop nop nop nop xor %rdx, %rdx movb $0x61, (%rbx) and %r13, %r13 lea addresses_WT_ht+0x1575e, %rsi lea addresses_WT_ht+0x1e9da, %rdi nop inc %rdx mov $50, %rcx rep movsw nop nop nop and %rcx, %rcx pop %rsi pop %rdx pop %rdi pop %rcx pop %rbx pop %rax pop %r8 pop %r13 ret .global s_faulty_load s_faulty_load: push %r10 push %r11 push %r12 push %r8 push %r9 push %rbx push %rdx // Store lea addresses_RW+0xd59a, %r8 clflush (%r8) nop nop nop nop sub $10136, %r11 mov $0x5152535455565758, %r12 movq %r12, (%r8) nop nop nop cmp $12096, %r8 // Store lea addresses_D+0x1783a, %r11 nop nop nop nop cmp $55056, %rbx movb $0x51, (%r11) nop nop nop nop cmp %r11, %r11 // Store lea addresses_normal+0x1209a, %rbx nop nop nop xor $52162, %r10 movw $0x5152, (%rbx) nop nop and %r9, %r9 // Store lea addresses_D+0x10aaa, %rdx xor %r12, %r12 mov $0x5152535455565758, %r9 movq %r9, %xmm0 movups %xmm0, (%rdx) sub $29647, %r12 // Store lea addresses_RW+0x1b19a, %r10 nop nop nop dec %r8 movb $0x51, (%r10) nop nop dec %r8 // Store lea addresses_D+0xb19a, %r8 nop nop sub $20278, %r11 mov $0x5152535455565758, %rbx movq %rbx, %xmm3 vmovntdq %ymm3, (%r8) sub %r10, %r10 // Store lea addresses_D+0x19a, %r8 nop nop nop xor $56678, %r11 movw $0x5152, (%r8) nop and %rdx, %rdx // Load lea addresses_A+0xa6da, %rbx nop nop nop nop and $36178, %rdx vmovups (%rbx), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $1, %xmm5, %r12 nop nop nop nop add $29898, %r9 // Store lea addresses_normal+0x729a, %r11 clflush (%r11) nop nop nop nop cmp $42256, %r8 movw $0x5152, (%r11) nop nop nop add %r11, %r11 // Faulty Load lea addresses_D+0xb19a, %rdx nop nop nop nop nop add $24493, %r8 vmovaps (%rdx), %ymm5 vextracti128 $0, %ymm5, %xmm5 vpextrq $0, %xmm5, %r9 lea oracles, %r10 and $0xff, %r9 shlq $12, %r9 mov (%r10,%r9,1), %r9 pop %rdx pop %rbx pop %r9 pop %r8 pop %r12 pop %r11 pop %r10 ret /* <gen_faulty_load> [REF] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 0, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 16, 'AVXalign': False, 'NT': False, 'congruent': 3, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_RW', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 32, 'AVXalign': False, 'NT': True, 'congruent': 0, 'same': True}} {'OP': 'STOR', 'dst': {'type': 'addresses_D', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 10, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_A', 'size': 32, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_normal', 'size': 2, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': False}} [Faulty Load] {'OP': 'LOAD', 'src': {'type': 'addresses_D', 'size': 32, 'AVXalign': True, 'NT': False, 'congruent': 0, 'same': True}} <gen_prepare_buffer> {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_WC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': True}} {'OP': 'REPM', 'src': {'type': 'addresses_normal_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_UC_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_D_ht', 'congruent': 1, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 1, 'AVXalign': False, 'NT': False, 'congruent': 11, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_A_ht', 'congruent': 8, 'same': False}, 'dst': {'type': 'addresses_WC_ht', 'congruent': 6, 'same': False}} {'OP': 'LOAD', 'src': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WT_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 8, 'same': True}} {'OP': 'LOAD', 'src': {'type': 'addresses_normal_ht', 'size': 4, 'AVXalign': False, 'NT': False, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 10, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 6, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WC_ht', 'congruent': 9, 'same': False}, 'dst': {'type': 'addresses_UC_ht', 'congruent': 4, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC_ht', 'size': 8, 'AVXalign': False, 'NT': False, 'congruent': 5, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_D_ht', 'congruent': 6, 'same': False}, 'dst': {'type': 'addresses_normal_ht', 'congruent': 9, 'same': False}} {'OP': 'STOR', 'dst': {'type': 'addresses_WC_ht', 'size': 1, 'AVXalign': False, 'NT': True, 'congruent': 7, 'same': False}} {'OP': 'REPM', 'src': {'type': 'addresses_WT_ht', 'congruent': 0, 'same': False}, 'dst': {'type': 'addresses_WT_ht', 'congruent': 6, 'same': False}} {'52': 78, '00': 109} 52 00 00 52 00 52 00 52 00 00 52 52 00 00 00 00 52 52 52 00 00 00 52 00 00 52 00 52 00 00 00 00 00 52 00 00 52 00 52 00 52 52 52 00 00 52 00 00 00 52 00 52 52 52 52 52 00 00 52 00 52 00 52 00 00 52 00 52 00 00 00 00 00 00 52 52 00 00 00 52 00 52 52 52 00 00 00 00 52 00 00 00 00 52 52 00 00 00 52 00 52 00 52 00 52 00 00 00 52 00 00 00 00 00 00 00 00 00 52 00 00 52 00 00 52 52 00 00 00 52 52 00 52 00 00 00 00 52 52 00 52 00 52 52 00 00 00 00 00 00 00 00 52 52 52 00 00 52 52 52 52 52 52 00 52 00 00 52 00 52 00 52 52 52 00 52 00 00 00 52 52 52 00 52 52 00 52 */
alloy4fun_models/trashltl/models/9/8zbn9sKC6iHz433iu.als
Kaixi26/org.alloytools.alloy
0
3911
open main pred id8zbn9sKC6iHz433iu_prop10 { always all f : Protected | always f in Protected' } pred __repair { id8zbn9sKC6iHz433iu_prop10 } check __repair { id8zbn9sKC6iHz433iu_prop10 <=> prop10o }
code/c/04-machine/cpu0/code/ch03/add.asm
MarybethGasman/sp
252
24018
.386 .model flat .code main PROC mov eax, 1 add eax, 4 sub eax, 2 main ENDP END main
oeis/066/A066221.asm
neoneye/loda-programs
11
162683
; A066221: Bisection of A001189. ; Submitted by <NAME> ; 0,3,25,231,2619,35695,568503,10349535,211799311,4809701439,119952692895,3257843882623,95680443760575,3020676745975551,101990226254706559,3666624057550245375,139813029266338603263,5635330985337965904895,239366326117390607268351,10685579912451515567073279,500105497690148365394164735,24484510749551977163109658623,1251446417132166042451788445695,66653739092046361122607412928511,3693131798996707683989545021542399,212543585555177727038581866946379775,12687046810296879017839174357490376703 mul $0,2 mov $1,1 lpb $0 add $2,$1 mul $2,$0 sub $0,1 add $1,$2 dif $2,-1 lpe mov $0,$1 sub $0,1
Cubical/ZCohomology/CohomologyRings/S0.agda
thomas-lamiaux/cubical
0
16377
<filename>Cubical/ZCohomology/CohomologyRings/S0.agda {-# OPTIONS --safe --experimental-lossy-unification #-} module Cubical.ZCohomology.CohomologyRings.S0 where open import Cubical.Foundations.Prelude open import Cubical.Foundations.Isomorphism open import Cubical.Data.Bool open import Cubical.Data.Unit open import Cubical.Algebra.Ring open import Cubical.Algebra.Ring.DirectProd open import Cubical.Algebra.CommRing open import Cubical.Algebra.CommRing.Instances.Int renaming (ℤCommRing to ℤCR) open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-Quotient open import Cubical.Algebra.CommRing.Instances.Polynomials.MultivariatePoly-notationZ open import Cubical.HITs.Sn open import Cubical.ZCohomology.RingStructure.CohomologyRing open import Cubical.ZCohomology.CohomologyRings.Coproduct open import Cubical.ZCohomology.CohomologyRings.Unit ----------------------------------------------------------------------------- -- Warning -- H*(S0) is not Z[X]/X² -- It is Z[X]/X × Z[X]/X or Z[X] /(X² - X) -- Beware that H*(X ⊔ Y) ≅ H*(X) × H*(Y) -- Which would apply for H*(Unit ⊔ Unit) ----------------------------------------------------------------------------- -- Computation of the cohomology ring open RingEquivs Cohomology-Ring-S⁰P : RingEquiv (H*R (S₊ 0)) (DirectProd-Ring (CommRing→Ring ℤ[X]/X) (CommRing→Ring ℤ[X]/X)) Cohomology-Ring-S⁰P = compRingEquiv (CohomologyRing-Equiv (invIso Iso-⊤⊎⊤-Bool)) (compRingEquiv (CohomologyRing-Coproduct Unit Unit) (Coproduct-Equiv.Coproduct-Equiv-12 CohomologyRing-UnitP CohomologyRing-UnitP)) Cohomology-Ring-S⁰ℤ : RingEquiv (H*R (S₊ 0)) (DirectProd-Ring (CommRing→Ring ℤCR) (CommRing→Ring ℤCR)) Cohomology-Ring-S⁰ℤ = compRingEquiv (CohomologyRing-Equiv (invIso Iso-⊤⊎⊤-Bool)) (compRingEquiv (CohomologyRing-Coproduct Unit Unit) (Coproduct-Equiv.Coproduct-Equiv-12 CohomologyRing-Unitℤ CohomologyRing-Unitℤ))
alloy4fun_models/trashltl/models/5/TrcaDcuFH8bPwdicu.als
Kaixi26/org.alloytools.alloy
0
3584
<reponame>Kaixi26/org.alloytools.alloy open main pred idTrcaDcuFH8bPwdicu_prop6 { all f : File | always (f in Trash implies always f in Trash) } pred __repair { idTrcaDcuFH8bPwdicu_prop6 } check __repair { idTrcaDcuFH8bPwdicu_prop6 <=> prop6o }
dv3/qxl/hd/mformat.asm
olifink/smsqe
0
84348
<filename>dv3/qxl/hd/mformat.asm ; DV3 QXL HD Disk Format  1993 <NAME> ; ; 2020-04-07 1.01 Changed for new ddf_mname definition (length word) (MK) section dv3 xdef hd_mformat xref hd_hold xref hd_release xref hd_fchk xref dv3_slen xref qxl_mess_add xref gu_achp0 xref gu_rchp xref cv_decil include 'dev8_keys_err' include 'dev8_smsq_qxl_keys' include 'dev8_smsq_qxl_comm_keys' include 'dev8_dv3_keys' include 'dev8_dv3_hd_keys' include 'dev8_mac_assert' ;+++ ; This routine formats a medium ; ; d0 cr format type / error code ; d1 cr format dependent flag or zero / good sectors ; d2 r total sectors ; d7 c p drive ID / number ; a3 c p linkage block ; a4 c p drive definition ; ; status return standard ;--- hd_mformat hmf.reg reg d3/d4/d5/a0/a1/a2/a5 movem.l hmf.reg,-(sp) hmf_wstart jsr hd_hold bne.s hmf_wstart move.b #ddf.dd,ddf_density(a4) ; set density move.b #2,ddf_slflag(a4) ; set sector length flag jsr dv3_slen clr.l ddf_psoff(a4) ; set base of partition lea ddf_mname+2(a4),a0 jsr cv_decil ; size of disk required bne.l hmf_inam moveq #11,d0 ; convert megabytes to sectors asl.l d0,d1 bvs.l hmf_inam ble.l hmf_inam jsr hd_fchk ; check ok to format bne.s hmf_exit lea ddf_mname(a4),a0 move.w #4,(a0)+ move.l #'WIN0',(a0) ; blat name add.b d7,3(a0) move.l qxl_message,a1 lea qxl_ms_phys(a1),a1 ; message key move.b #qxm.fdriv,(a1)+ ; ... message key move.b d7,(a1) ; win drive add.b #$82,(a1)+ ; is a file move.w #1,(a1)+ ; only one message at a time move.l d1,(a1)+ ; number of sectors clr.l (a1) ; no ID subq.l #8,a1 move.w #$c,-(a1) ; message length jsr qxl_mess_add ; add the message hmf_wait_done ; blat #$aa tst.w (a1) ; wait for reply (flagged by -ve len) bpl.s hmf_wait_done ; blat #$55 tst.b qxm_err-qxl_ms_len(a1) ; error? bne.s hmf_fmtf move.l qxm_ngood-qxl_ms_len(a1),d3 ; nr sectors beq.s hmf_fmtf ; ... none clr.l -(sp) ; no 4096 byte clr.l -(sp) ; no 2048 byte clr.l -(sp) ; no 1024 byte move.l d3,-(sp) ; sectors per track !! clr.l -(sp) ; no 256 byte clr.l -(sp) ; no 128 byte clr.l -(sp) ; no cylinders / heads move.l sp,a0 jsr ddf_fselect(a4) ; select format add.w #7*4,sp bne.s hmf_exit ; ... oops moveq #ddf.full,d0 ; ... the only type of format we can do sub.l a0,a0 jsr ddf_format(a4) ; so do it! st ddf_slbl(a4) ; set slave block range hmf_exit jsr hd_release movem.l (sp)+,hmf.reg tst.l d0 rts hmf_fmtf moveq #err.fmtf,d0 bra.s hmf_exit hmf_inam moveq #err.inam,d0 bra.s hmf_exit end
libsrc/_DEVELOPMENT/arch/sms/globals/z80/_GLOBAL_SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS.asm
jpoikela/z88dk
640
28290
<filename>libsrc/_DEVELOPMENT/arch/sms/globals/z80/_GLOBAL_SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS.asm INCLUDE "config_private.inc" SECTION data_arch PUBLIC _GLOBAL_SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS _GLOBAL_SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS: defw __SMS_VRAM_SPRITE_PATTERN_BASE_ADDRESS
base/common/integer.asm
zbyti/Mad-Pascal
7
10988
/* mulINTEGER divmulINT */ .proc mulINTEGER jsr imulCARD jmp movaBX_EAX .endp .proc divmulINT REAL ldy <divREAL lda >divREAL bne skp MOD mva #{jsr} _mod lda :STACKORIGIN+STACKWIDTH*3,x ; divisor sign spl jsr negCARD DIV ldy <idivCARD lda >idivCARD skp sty addr sta addr+1 ldy #0 lda :STACKORIGIN-1+STACKWIDTH*3,x ; dividend sign bpl @+ jsr negCARD1 iny @ lda :STACKORIGIN+STACKWIDTH*3,x ; divisor sign bpl @+ jsr negCARD iny @ tya and #1 pha jsr $ffff ; idiv ecx addr equ *-2 jsr movaBX_EAX _mod bit movZTMP_aBX ; mod mva #{bit} _mod pla seq jmp negCARD1 rts .endp
source/asis/spec/ada-characters-conversions.ads
faelys/gela-asis
4
9986
------------------------------------------------------------------------------ -- A d a r u n - t i m e s p e c i f i c a t i o n -- -- ASIS implementation for Gela project, a portable Ada compiler -- -- http://gela.ada-ru.org -- -- - - - - - - - - - - - - - - - -- -- Read copyright and license at the end of ada.ads file -- ------------------------------------------------------------------------------ -- $Revision: 209 $ $Date: 2013-11-30 21:03:24 +0200 (Сб., 30 нояб. 2013) $ package Ada.Characters.Conversions is pragma Pure (Conversions); function Is_Character (Item : in Wide_Character) return Boolean; function Is_String (Item : in Wide_String) return Boolean; function Is_Character (Item : in Wide_Wide_Character) return Boolean; function Is_String (Item : in Wide_Wide_String) return Boolean; function Is_Wide_Character (Item : in Wide_Wide_Character) return Boolean; function Is_Wide_String (Item : in Wide_Wide_String) return Boolean; function To_Wide_Character (Item : in Character) return Wide_Character; function To_Wide_String (Item : in String) return Wide_String; function To_Wide_Wide_Character (Item : in Character) return Wide_Wide_Character; function To_Wide_Wide_String (Item : in String) return Wide_Wide_String; function To_Wide_Wide_Character (Item : in Wide_Character) return Wide_Wide_Character; function To_Wide_Wide_String (Item : in Wide_String) return Wide_Wide_String; function To_Character (Item : in Wide_Character; Substitute : in Character := ' ') return Character; function To_String (Item : in Wide_String; Substitute : in Character := ' ') return String; function To_Character (Item : in Wide_Wide_Character; Substitute : in Character := ' ') return Character; function To_String (Item : in Wide_Wide_String; Substitute : in Character := ' ') return String; function To_Wide_Character (Item : in Wide_Wide_Character; Substitute : in Wide_Character := ' ') return Wide_Character; function To_Wide_String (Item : in Wide_Wide_String; Substitute : in Wide_Character := ' ') return Wide_String; end Ada.Characters.Conversions;
src/portscan-buildcycle.ads
kraileth/ravenadm
18
17542
-- This file is covered by the Internet Software Consortium (ISC) License -- Reference: ../License.txt with Display; with Port_Specification; private with Ada.Calendar; package PortScan.Buildcycle is package PSP renames Port_Specification; cycle_cmd_error : exception; procedure initialize (test_mode : Boolean); function build_package (id : builders; sequence_id : port_id; specification : PSP.Portspecs; interactive : Boolean := False; interphase : String := "") return Boolean; -- Compile status of builder for the curses display function builder_status (id : builders; shutdown : Boolean := False; idle : Boolean := False) return Display.builder_rec; function last_build_phase (id : builders) return String; function assemble_history_record (slave : builders; pid : port_id; action : Display.history_action) return Display.history_rec; -- exposed for WWW report function load_core (instant_load : Boolean) return Float; -- records the current length of the build log. procedure set_log_lines (id : builders); -- Returns the formatted time difference between start and stop of package build function elapsed_build (id : builders) return String; -- Run make -C /port/ makesum (used by developer to generate distinfo) procedure run_makesum (id : builders; ssl_variant : String); -- Exposed for Pilot to determine validity of test build request function valid_test_phase (afterphase : String) return Boolean; -- Exposed for Pilot to regenerate patches (Names and content are maintained) procedure run_patch_regen (id : builders; sourceloc : String; ssl_variant : String); private package CAL renames Ada.Calendar; type phases is (blr_depends, fetch, extract, patch, configure, build, stage, test, check_plist, pkg_package, install, deinstall); type trackrec is record seq_id : port_id; head_time : CAL.Time; tail_time : CAL.Time; log_handle : aliased TIO.File_Type; dynlink : string_crate.Vector; runpaths : string_crate.Vector; checkpaths : string_crate.Vector; goodpaths : string_crate.Vector; rpath_fatal : Boolean; check_strip : Boolean; disable_dog : Boolean; loglines : Natural := 0; end record; type dim_trackers is array (builders) of trackrec; type dim_phase_trackers is array (builders) of phases; type execution_limit is range 1 .. 720; phase_trackers : dim_phase_trackers; trackers : dim_trackers; testing : Boolean; uname_mrv : HT.Text; customenv : HT.Text; selftest : constant String := "SELFTEST"; chroot_make_program : constant String := "/usr/bin/make -m /xports/Mk"; -- If the afterphase string matches a legal phase name then that phase -- is returned, otherwise the value of blr_depends is returned. Allowed -- phases are: extract/patch/configure/build/stage/test/install/deinstall. -- blr_depends is considered a negative response -- stage includes check-plist function valid_test_phase (afterphase : String) return phases; function exec_phase (id : builders; phase : phases; time_limit : execution_limit; environ : String; phaseenv : String := ""; depends_phase : Boolean := False; skip_header : Boolean := False; skip_footer : Boolean := False) return Boolean; procedure mark_file_system (id : builders; action : String; environ : String); procedure interact_with_builder (id : builders; ssl_variant : String); procedure set_uname_mrv; procedure obtain_custom_environment; function phase2str (phase : phases) return String; function max_time_without_output (phase : phases) return execution_limit; function timeout_multiplier_x10 return Positive; function get_environment (id : builders; environ : String) return String; function get_port_variables (id : builders; environ : String) return String; function generic_system_command (command : String) return String; function get_root (id : builders) return String; function passed_runpath_check (id : builders) return Boolean; function format_loglines (numlines : Natural) return String; function watchdog_message (minutes : execution_limit) return String; function get_port_prefix (id : builders; environ : String) return String; function pkg_install_subroutine (id : builders; root, env_vars, line : String) return Boolean; function environment_override (toolchain : Boolean; ssl_variant : String; enable_tty : Boolean := False) return String; function exec_phase_generic (id : builders; phase : phases; environ : String) return Boolean; function exec_phase_build (id : builders; environ : String) return Boolean; function exec_phase_install (id : builders; pkgversion : String; environ : String) return Boolean; function exec_phase_deinstall (id : builders; pkgversion : String; environ : String) return Boolean; function deinstall_all_packages (id : builders; environ : String) return Boolean; function install_run_depends (specification : PSP.Portspecs; id : builders; environ : String) return Boolean; function generic_execute (id : builders; command : String; dogbite : out Boolean; time_limit : execution_limit) return Boolean; function exec_phase_depends (specification : PSP.Portspecs; phase_name : String; id : builders; environ : String) return Boolean; function dynamically_linked (base : String; filename : String; strip_check : Boolean; unstripped : out Boolean) return Boolean; function log_linked_libraries (id : builders; pkgversion : String; environ : String) return Boolean; procedure stack_linked_libraries (id : builders; base : String; filename : String; environ : String); function detect_leftovers_and_MIA (id : builders; action : String; description : String; environ : String) return Boolean; end PortScan.Buildcycle;
sh.asm
thr0m3l/easy-xv6
0
8204
<filename>sh.asm _sh: file format elf32-i386 Disassembly of section .text: 00000000 <main>: if (buf[0] == 0) // EOF return -1; return 0; } int main(void) { 0: 8d 4c 24 04 lea 0x4(%esp),%ecx 4: 83 e4 f0 and $0xfffffff0,%esp 7: ff 71 fc push -0x4(%ecx) a: 55 push %ebp b: 89 e5 mov %esp,%ebp d: 51 push %ecx e: 83 ec 04 sub $0x4,%esp static char buf[100]; int fd; // Ensure that three file descriptors are open. while ((fd = open("console", O_RDWR)) >= 0) { 11: eb 0e jmp 21 <main+0x21> 13: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 17: 90 nop if (fd >= 3) { 18: 83 f8 02 cmp $0x2,%eax 1b: 0f 8f 91 00 00 00 jg b2 <main+0xb2> while ((fd = open("console", O_RDWR)) >= 0) { 21: 83 ec 08 sub $0x8,%esp 24: 6a 02 push $0x2 26: 68 af 13 00 00 push $0x13af 2b: e8 53 0e 00 00 call e83 <open> 30: 83 c4 10 add $0x10,%esp 33: 85 c0 test %eax,%eax 35: 79 e1 jns 18 <main+0x18> 37: eb 2e jmp 67 <main+0x67> 39: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi } } // Read and run input commands. while (getcmd(buf, sizeof(buf)) >= 0) { if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') { 40: 80 3d 62 1a 00 00 20 cmpb $0x20,0x1a62 47: 0f 84 88 00 00 00 je d5 <main+0xd5> 4d: 8d 76 00 lea 0x0(%esi),%esi } int fork1(void) { int pid; pid = fork(); 50: e8 e6 0d 00 00 call e3b <fork> if (pid == -1) 55: 83 f8 ff cmp $0xffffffff,%eax 58: 0f 84 c1 00 00 00 je 11f <main+0x11f> if (fork1() == 0) 5e: 85 c0 test %eax,%eax 60: 74 5e je c0 <main+0xc0> wait(); 62: e8 e4 0d 00 00 call e4b <wait> printf(2, ANSI_COLOR_GREEN "[romel@xv6 ~]$ " ANSI_COLOR_RESET); 67: 83 ec 08 sub $0x8,%esp 6a: 68 f8 12 00 00 push $0x12f8 6f: 6a 02 push $0x2 71: e8 5a 0f 00 00 call fd0 <printf> memset(buf, 0, nbuf); 76: 83 c4 0c add $0xc,%esp 79: 6a 64 push $0x64 7b: 6a 00 push $0x0 7d: 68 60 1a 00 00 push $0x1a60 82: e8 09 0c 00 00 call c90 <memset> gets(buf, nbuf); 87: 58 pop %eax 88: 5a pop %edx 89: 6a 64 push $0x64 8b: 68 60 1a 00 00 push $0x1a60 90: e8 5b 0c 00 00 call cf0 <gets> if (buf[0] == 0) // EOF 95: 0f b6 05 60 1a 00 00 movzbl 0x1a60,%eax 9c: 83 c4 10 add $0x10,%esp 9f: 84 c0 test %al,%al a1: 74 77 je 11a <main+0x11a> if (buf[0] == 'c' && buf[1] == 'd' && buf[2] == ' ') { a3: 3c 63 cmp $0x63,%al a5: 75 a9 jne 50 <main+0x50> a7: 80 3d 61 1a 00 00 64 cmpb $0x64,0x1a61 ae: 75 a0 jne 50 <main+0x50> b0: eb 8e jmp 40 <main+0x40> close(fd); b2: 83 ec 0c sub $0xc,%esp b5: 50 push %eax b6: e8 b0 0d 00 00 call e6b <close> break; bb: 83 c4 10 add $0x10,%esp be: eb a7 jmp 67 <main+0x67> runcmd(parsecmd(buf)); c0: 83 ec 0c sub $0xc,%esp c3: 68 60 1a 00 00 push $0x1a60 c8: e8 93 0a 00 00 call b60 <parsecmd> cd: 89 04 24 mov %eax,(%esp) d0: e8 db 00 00 00 call 1b0 <runcmd> buf[strlen(buf) - 1] = 0; // chop \n d5: 83 ec 0c sub $0xc,%esp d8: 68 60 1a 00 00 push $0x1a60 dd: e8 7e 0b 00 00 call c60 <strlen> if (chdir(buf + 3) < 0) e2: c7 04 24 63 1a 00 00 movl $0x1a63,(%esp) buf[strlen(buf) - 1] = 0; // chop \n e9: c6 80 5f 1a 00 00 00 movb $0x0,0x1a5f(%eax) if (chdir(buf + 3) < 0) f0: e8 be 0d 00 00 call eb3 <chdir> f5: 83 c4 10 add $0x10,%esp f8: 85 c0 test %eax,%eax fa: 0f 89 67 ff ff ff jns 67 <main+0x67> printf(2, "cannot cd %s\n", buf + 3); 100: 51 push %ecx 101: 68 63 1a 00 00 push $0x1a63 106: 68 b7 13 00 00 push $0x13b7 10b: 6a 02 push $0x2 10d: e8 be 0e 00 00 call fd0 <printf> 112: 83 c4 10 add $0x10,%esp 115: e9 4d ff ff ff jmp 67 <main+0x67> exit(); 11a: e8 24 0d 00 00 call e43 <exit> panic("fork"); 11f: 83 ec 0c sub $0xc,%esp 122: 68 11 13 00 00 push $0x1311 127: e8 44 00 00 00 call 170 <panic> 12c: 66 90 xchg %ax,%ax 12e: 66 90 xchg %ax,%ax 00000130 <getcmd>: int getcmd(char *buf, int nbuf) { 130: 55 push %ebp 131: 89 e5 mov %esp,%ebp 133: 56 push %esi 134: 53 push %ebx 135: 8b 75 0c mov 0xc(%ebp),%esi 138: 8b 5d 08 mov 0x8(%ebp),%ebx printf(2, ANSI_COLOR_GREEN "[romel@xv6 ~]$ " ANSI_COLOR_RESET); 13b: 83 ec 08 sub $0x8,%esp 13e: 68 f8 12 00 00 push $0x12f8 143: 6a 02 push $0x2 145: e8 86 0e 00 00 call fd0 <printf> memset(buf, 0, nbuf); 14a: 83 c4 0c add $0xc,%esp 14d: 56 push %esi 14e: 6a 00 push $0x0 150: 53 push %ebx 151: e8 3a 0b 00 00 call c90 <memset> gets(buf, nbuf); 156: 58 pop %eax 157: 5a pop %edx 158: 56 push %esi 159: 53 push %ebx 15a: e8 91 0b 00 00 call cf0 <gets> if (buf[0] == 0) // EOF 15f: 83 c4 10 add $0x10,%esp 162: 80 3b 01 cmpb $0x1,(%ebx) 165: 19 c0 sbb %eax,%eax } 167: 8d 65 f8 lea -0x8(%ebp),%esp 16a: 5b pop %ebx 16b: 5e pop %esi 16c: 5d pop %ebp 16d: c3 ret 16e: 66 90 xchg %ax,%ax 00000170 <panic>: void panic(char *s) { 170: 55 push %ebp 171: 89 e5 mov %esp,%ebp 173: 83 ec 0c sub $0xc,%esp printf(2, "%s\n", s); 176: ff 75 08 push 0x8(%ebp) 179: 68 ab 13 00 00 push $0x13ab 17e: 6a 02 push $0x2 180: e8 4b 0e 00 00 call fd0 <printf> exit(); 185: e8 b9 0c 00 00 call e43 <exit> 18a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000190 <fork1>: int fork1(void) { 190: 55 push %ebp 191: 89 e5 mov %esp,%ebp 193: 83 ec 08 sub $0x8,%esp pid = fork(); 196: e8 a0 0c 00 00 call e3b <fork> if (pid == -1) 19b: 83 f8 ff cmp $0xffffffff,%eax 19e: 74 02 je 1a2 <fork1+0x12> return pid; } 1a0: c9 leave 1a1: c3 ret panic("fork"); 1a2: 83 ec 0c sub $0xc,%esp 1a5: 68 11 13 00 00 push $0x1311 1aa: e8 c1 ff ff ff call 170 <panic> 1af: 90 nop 000001b0 <runcmd>: void runcmd(struct cmd *cmd) { 1b0: 55 push %ebp 1b1: 89 e5 mov %esp,%ebp 1b3: 53 push %ebx 1b4: 83 ec 14 sub $0x14,%esp 1b7: 8b 5d 08 mov 0x8(%ebp),%ebx if (cmd == 0) 1ba: 85 db test %ebx,%ebx 1bc: 74 42 je 200 <runcmd+0x50> switch (cmd->type) { 1be: 83 3b 05 cmpl $0x5,(%ebx) 1c1: 0f 87 e3 00 00 00 ja 2aa <runcmd+0xfa> 1c7: 8b 03 mov (%ebx),%eax 1c9: ff 24 85 c8 13 00 00 jmp *0x13c8(,%eax,4) if (ecmd->argv[0] == 0) 1d0: 8b 43 04 mov 0x4(%ebx),%eax 1d3: 85 c0 test %eax,%eax 1d5: 74 29 je 200 <runcmd+0x50> exec(ecmd->argv[0], ecmd->argv); 1d7: 8d 53 04 lea 0x4(%ebx),%edx 1da: 51 push %ecx 1db: 51 push %ecx 1dc: 52 push %edx 1dd: 50 push %eax 1de: e8 98 0c 00 00 call e7b <exec> printf(2, "exec %s failed\n", ecmd->argv[0]); 1e3: 83 c4 0c add $0xc,%esp 1e6: ff 73 04 push 0x4(%ebx) 1e9: 68 1d 13 00 00 push $0x131d 1ee: 6a 02 push $0x2 1f0: e8 db 0d 00 00 call fd0 <printf> break; 1f5: 83 c4 10 add $0x10,%esp 1f8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1ff: 90 nop exit(); 200: e8 3e 0c 00 00 call e43 <exit> if (fork1() == 0) 205: e8 86 ff ff ff call 190 <fork1> 20a: 85 c0 test %eax,%eax 20c: 75 f2 jne 200 <runcmd+0x50> 20e: e9 8c 00 00 00 jmp 29f <runcmd+0xef> if (pipe(p) < 0) 213: 83 ec 0c sub $0xc,%esp 216: 8d 45 f0 lea -0x10(%ebp),%eax 219: 50 push %eax 21a: e8 34 0c 00 00 call e53 <pipe> 21f: 83 c4 10 add $0x10,%esp 222: 85 c0 test %eax,%eax 224: 0f 88 a2 00 00 00 js 2cc <runcmd+0x11c> if (fork1() == 0) { 22a: e8 61 ff ff ff call 190 <fork1> 22f: 85 c0 test %eax,%eax 231: 0f 84 a2 00 00 00 je 2d9 <runcmd+0x129> if (fork1() == 0) { 237: e8 54 ff ff ff call 190 <fork1> 23c: 85 c0 test %eax,%eax 23e: 0f 84 c3 00 00 00 je 307 <runcmd+0x157> close(p[0]); 244: 83 ec 0c sub $0xc,%esp 247: ff 75 f0 push -0x10(%ebp) 24a: e8 1c 0c 00 00 call e6b <close> close(p[1]); 24f: 58 pop %eax 250: ff 75 f4 push -0xc(%ebp) 253: e8 13 0c 00 00 call e6b <close> wait(); 258: e8 ee 0b 00 00 call e4b <wait> wait(); 25d: e8 e9 0b 00 00 call e4b <wait> break; 262: 83 c4 10 add $0x10,%esp 265: eb 99 jmp 200 <runcmd+0x50> if (fork1() == 0) 267: e8 24 ff ff ff call 190 <fork1> 26c: 85 c0 test %eax,%eax 26e: 74 2f je 29f <runcmd+0xef> wait(); 270: e8 d6 0b 00 00 call e4b <wait> runcmd(lcmd->right); 275: 83 ec 0c sub $0xc,%esp 278: ff 73 08 push 0x8(%ebx) 27b: e8 30 ff ff ff call 1b0 <runcmd> close(rcmd->fd); 280: 83 ec 0c sub $0xc,%esp 283: ff 73 14 push 0x14(%ebx) 286: e8 e0 0b 00 00 call e6b <close> if (open(rcmd->file, rcmd->mode) < 0) { 28b: 58 pop %eax 28c: 5a pop %edx 28d: ff 73 10 push 0x10(%ebx) 290: ff 73 08 push 0x8(%ebx) 293: e8 eb 0b 00 00 call e83 <open> 298: 83 c4 10 add $0x10,%esp 29b: 85 c0 test %eax,%eax 29d: 78 18 js 2b7 <runcmd+0x107> runcmd(bcmd->cmd); 29f: 83 ec 0c sub $0xc,%esp 2a2: ff 73 04 push 0x4(%ebx) 2a5: e8 06 ff ff ff call 1b0 <runcmd> panic("runcmd"); 2aa: 83 ec 0c sub $0xc,%esp 2ad: 68 16 13 00 00 push $0x1316 2b2: e8 b9 fe ff ff call 170 <panic> printf(2, "open %s failed\n", rcmd->file); 2b7: 51 push %ecx 2b8: ff 73 08 push 0x8(%ebx) 2bb: 68 2d 13 00 00 push $0x132d 2c0: 6a 02 push $0x2 2c2: e8 09 0d 00 00 call fd0 <printf> exit(); 2c7: e8 77 0b 00 00 call e43 <exit> panic("pipe"); 2cc: 83 ec 0c sub $0xc,%esp 2cf: 68 3d 13 00 00 push $0x133d 2d4: e8 97 fe ff ff call 170 <panic> close(1); 2d9: 83 ec 0c sub $0xc,%esp 2dc: 6a 01 push $0x1 2de: e8 88 0b 00 00 call e6b <close> dup(p[1]); 2e3: 58 pop %eax 2e4: ff 75 f4 push -0xc(%ebp) 2e7: e8 cf 0b 00 00 call ebb <dup> close(p[0]); 2ec: 58 pop %eax 2ed: ff 75 f0 push -0x10(%ebp) 2f0: e8 76 0b 00 00 call e6b <close> close(p[1]); 2f5: 58 pop %eax 2f6: ff 75 f4 push -0xc(%ebp) 2f9: e8 6d 0b 00 00 call e6b <close> runcmd(pcmd->left); 2fe: 5a pop %edx 2ff: ff 73 04 push 0x4(%ebx) 302: e8 a9 fe ff ff call 1b0 <runcmd> close(0); 307: 83 ec 0c sub $0xc,%esp 30a: 6a 00 push $0x0 30c: e8 5a 0b 00 00 call e6b <close> dup(p[0]); 311: 5a pop %edx 312: ff 75 f0 push -0x10(%ebp) 315: e8 a1 0b 00 00 call ebb <dup> close(p[0]); 31a: 59 pop %ecx 31b: ff 75 f0 push -0x10(%ebp) 31e: e8 48 0b 00 00 call e6b <close> close(p[1]); 323: 58 pop %eax 324: ff 75 f4 push -0xc(%ebp) 327: e8 3f 0b 00 00 call e6b <close> runcmd(pcmd->right); 32c: 58 pop %eax 32d: ff 73 08 push 0x8(%ebx) 330: e8 7b fe ff ff call 1b0 <runcmd> 335: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 33c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000340 <execcmd>: // PAGEBREAK! // Constructors struct cmd *execcmd(void) { 340: 55 push %ebp 341: 89 e5 mov %esp,%ebp 343: 53 push %ebx 344: 83 ec 10 sub $0x10,%esp struct execcmd *cmd; cmd = malloc(sizeof(*cmd)); 347: 6a 54 push $0x54 349: e8 b2 0e 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 34e: 83 c4 0c add $0xc,%esp 351: 6a 54 push $0x54 cmd = malloc(sizeof(*cmd)); 353: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 355: 6a 00 push $0x0 357: 50 push %eax 358: e8 33 09 00 00 call c90 <memset> cmd->type = EXEC; 35d: c7 03 01 00 00 00 movl $0x1,(%ebx) return (struct cmd *)cmd; } 363: 89 d8 mov %ebx,%eax 365: 8b 5d fc mov -0x4(%ebp),%ebx 368: c9 leave 369: c3 ret 36a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 00000370 <redircmd>: struct cmd *redircmd(struct cmd *subcmd, char *file, char *efile, int mode, int fd) { 370: 55 push %ebp 371: 89 e5 mov %esp,%ebp 373: 53 push %ebx 374: 83 ec 10 sub $0x10,%esp struct redircmd *cmd; cmd = malloc(sizeof(*cmd)); 377: 6a 18 push $0x18 379: e8 82 0e 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 37e: 83 c4 0c add $0xc,%esp 381: 6a 18 push $0x18 cmd = malloc(sizeof(*cmd)); 383: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 385: 6a 00 push $0x0 387: 50 push %eax 388: e8 03 09 00 00 call c90 <memset> cmd->type = REDIR; cmd->cmd = subcmd; 38d: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = REDIR; 390: c7 03 02 00 00 00 movl $0x2,(%ebx) cmd->cmd = subcmd; 396: 89 43 04 mov %eax,0x4(%ebx) cmd->file = file; 399: 8b 45 0c mov 0xc(%ebp),%eax 39c: 89 43 08 mov %eax,0x8(%ebx) cmd->efile = efile; 39f: 8b 45 10 mov 0x10(%ebp),%eax 3a2: 89 43 0c mov %eax,0xc(%ebx) cmd->mode = mode; 3a5: 8b 45 14 mov 0x14(%ebp),%eax 3a8: 89 43 10 mov %eax,0x10(%ebx) cmd->fd = fd; 3ab: 8b 45 18 mov 0x18(%ebp),%eax 3ae: 89 43 14 mov %eax,0x14(%ebx) return (struct cmd *)cmd; } 3b1: 89 d8 mov %ebx,%eax 3b3: 8b 5d fc mov -0x4(%ebp),%ebx 3b6: c9 leave 3b7: c3 ret 3b8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3bf: 90 nop 000003c0 <pipecmd>: struct cmd *pipecmd(struct cmd *left, struct cmd *right) { 3c0: 55 push %ebp 3c1: 89 e5 mov %esp,%ebp 3c3: 53 push %ebx 3c4: 83 ec 10 sub $0x10,%esp struct pipecmd *cmd; cmd = malloc(sizeof(*cmd)); 3c7: 6a 0c push $0xc 3c9: e8 32 0e 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 3ce: 83 c4 0c add $0xc,%esp 3d1: 6a 0c push $0xc cmd = malloc(sizeof(*cmd)); 3d3: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 3d5: 6a 00 push $0x0 3d7: 50 push %eax 3d8: e8 b3 08 00 00 call c90 <memset> cmd->type = PIPE; cmd->left = left; 3dd: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = PIPE; 3e0: c7 03 03 00 00 00 movl $0x3,(%ebx) cmd->left = left; 3e6: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 3e9: 8b 45 0c mov 0xc(%ebp),%eax 3ec: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd *)cmd; } 3ef: 89 d8 mov %ebx,%eax 3f1: 8b 5d fc mov -0x4(%ebp),%ebx 3f4: c9 leave 3f5: c3 ret 3f6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 3fd: 8d 76 00 lea 0x0(%esi),%esi 00000400 <listcmd>: struct cmd *listcmd(struct cmd *left, struct cmd *right) { 400: 55 push %ebp 401: 89 e5 mov %esp,%ebp 403: 53 push %ebx 404: 83 ec 10 sub $0x10,%esp struct listcmd *cmd; cmd = malloc(sizeof(*cmd)); 407: 6a 0c push $0xc 409: e8 f2 0d 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 40e: 83 c4 0c add $0xc,%esp 411: 6a 0c push $0xc cmd = malloc(sizeof(*cmd)); 413: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 415: 6a 00 push $0x0 417: 50 push %eax 418: e8 73 08 00 00 call c90 <memset> cmd->type = LIST; cmd->left = left; 41d: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = LIST; 420: c7 03 04 00 00 00 movl $0x4,(%ebx) cmd->left = left; 426: 89 43 04 mov %eax,0x4(%ebx) cmd->right = right; 429: 8b 45 0c mov 0xc(%ebp),%eax 42c: 89 43 08 mov %eax,0x8(%ebx) return (struct cmd *)cmd; } 42f: 89 d8 mov %ebx,%eax 431: 8b 5d fc mov -0x4(%ebp),%ebx 434: c9 leave 435: c3 ret 436: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 43d: 8d 76 00 lea 0x0(%esi),%esi 00000440 <backcmd>: struct cmd *backcmd(struct cmd *subcmd) { 440: 55 push %ebp 441: 89 e5 mov %esp,%ebp 443: 53 push %ebx 444: 83 ec 10 sub $0x10,%esp struct backcmd *cmd; cmd = malloc(sizeof(*cmd)); 447: 6a 08 push $0x8 449: e8 b2 0d 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 44e: 83 c4 0c add $0xc,%esp 451: 6a 08 push $0x8 cmd = malloc(sizeof(*cmd)); 453: 89 c3 mov %eax,%ebx memset(cmd, 0, sizeof(*cmd)); 455: 6a 00 push $0x0 457: 50 push %eax 458: e8 33 08 00 00 call c90 <memset> cmd->type = BACK; cmd->cmd = subcmd; 45d: 8b 45 08 mov 0x8(%ebp),%eax cmd->type = BACK; 460: c7 03 05 00 00 00 movl $0x5,(%ebx) cmd->cmd = subcmd; 466: 89 43 04 mov %eax,0x4(%ebx) return (struct cmd *)cmd; } 469: 89 d8 mov %ebx,%eax 46b: 8b 5d fc mov -0x4(%ebp),%ebx 46e: c9 leave 46f: c3 ret 00000470 <gettoken>: // Parsing char whitespace[] = " \t\r\n\v"; char symbols[] = "<|>&;()"; int gettoken(char **ps, char *es, char **q, char **eq) { 470: 55 push %ebp 471: 89 e5 mov %esp,%ebp 473: 57 push %edi 474: 56 push %esi 475: 53 push %ebx 476: 83 ec 0c sub $0xc,%esp char *s; int ret; s = *ps; 479: 8b 45 08 mov 0x8(%ebp),%eax int gettoken(char **ps, char *es, char **q, char **eq) { 47c: 8b 5d 0c mov 0xc(%ebp),%ebx 47f: 8b 75 10 mov 0x10(%ebp),%esi s = *ps; 482: 8b 38 mov (%eax),%edi while (s < es && strchr(whitespace, *s)) 484: 39 df cmp %ebx,%edi 486: 72 0f jb 497 <gettoken+0x27> 488: eb 25 jmp 4af <gettoken+0x3f> 48a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi s++; 490: 83 c7 01 add $0x1,%edi while (s < es && strchr(whitespace, *s)) 493: 39 fb cmp %edi,%ebx 495: 74 18 je 4af <gettoken+0x3f> 497: 0f be 07 movsbl (%edi),%eax 49a: 83 ec 08 sub $0x8,%esp 49d: 50 push %eax 49e: 68 48 1a 00 00 push $0x1a48 4a3: e8 08 08 00 00 call cb0 <strchr> 4a8: 83 c4 10 add $0x10,%esp 4ab: 85 c0 test %eax,%eax 4ad: 75 e1 jne 490 <gettoken+0x20> if (q) 4af: 85 f6 test %esi,%esi 4b1: 74 02 je 4b5 <gettoken+0x45> *q = s; 4b3: 89 3e mov %edi,(%esi) ret = *s; 4b5: 0f b6 07 movzbl (%edi),%eax switch (*s) { 4b8: 3c 3c cmp $0x3c,%al 4ba: 0f 8f d0 00 00 00 jg 590 <gettoken+0x120> 4c0: 3c 3a cmp $0x3a,%al 4c2: 0f 8f b4 00 00 00 jg 57c <gettoken+0x10c> 4c8: 84 c0 test %al,%al 4ca: 75 44 jne 510 <gettoken+0xa0> 4cc: 31 f6 xor %esi,%esi ret = 'a'; while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) s++; break; } if (eq) 4ce: 8b 55 14 mov 0x14(%ebp),%edx 4d1: 85 d2 test %edx,%edx 4d3: 74 05 je 4da <gettoken+0x6a> *eq = s; 4d5: 8b 45 14 mov 0x14(%ebp),%eax 4d8: 89 38 mov %edi,(%eax) while (s < es && strchr(whitespace, *s)) 4da: 39 df cmp %ebx,%edi 4dc: 72 09 jb 4e7 <gettoken+0x77> 4de: eb 1f jmp 4ff <gettoken+0x8f> s++; 4e0: 83 c7 01 add $0x1,%edi while (s < es && strchr(whitespace, *s)) 4e3: 39 fb cmp %edi,%ebx 4e5: 74 18 je 4ff <gettoken+0x8f> 4e7: 0f be 07 movsbl (%edi),%eax 4ea: 83 ec 08 sub $0x8,%esp 4ed: 50 push %eax 4ee: 68 48 1a 00 00 push $0x1a48 4f3: e8 b8 07 00 00 call cb0 <strchr> 4f8: 83 c4 10 add $0x10,%esp 4fb: 85 c0 test %eax,%eax 4fd: 75 e1 jne 4e0 <gettoken+0x70> *ps = s; 4ff: 8b 45 08 mov 0x8(%ebp),%eax 502: 89 38 mov %edi,(%eax) return ret; } 504: 8d 65 f4 lea -0xc(%ebp),%esp 507: 89 f0 mov %esi,%eax 509: 5b pop %ebx 50a: 5e pop %esi 50b: 5f pop %edi 50c: 5d pop %ebp 50d: c3 ret 50e: 66 90 xchg %ax,%ax switch (*s) { 510: 79 5e jns 570 <gettoken+0x100> while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 512: 39 fb cmp %edi,%ebx 514: 77 34 ja 54a <gettoken+0xda> if (eq) 516: 8b 45 14 mov 0x14(%ebp),%eax 519: be 61 00 00 00 mov $0x61,%esi 51e: 85 c0 test %eax,%eax 520: 75 b3 jne 4d5 <gettoken+0x65> 522: eb db jmp 4ff <gettoken+0x8f> 524: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 528: 0f be 07 movsbl (%edi),%eax 52b: 83 ec 08 sub $0x8,%esp 52e: 50 push %eax 52f: 68 40 1a 00 00 push $0x1a40 534: e8 77 07 00 00 call cb0 <strchr> 539: 83 c4 10 add $0x10,%esp 53c: 85 c0 test %eax,%eax 53e: 75 22 jne 562 <gettoken+0xf2> s++; 540: 83 c7 01 add $0x1,%edi while (s < es && !strchr(whitespace, *s) && !strchr(symbols, *s)) 543: 39 fb cmp %edi,%ebx 545: 74 cf je 516 <gettoken+0xa6> 547: 0f b6 07 movzbl (%edi),%eax 54a: 83 ec 08 sub $0x8,%esp 54d: 0f be f0 movsbl %al,%esi 550: 56 push %esi 551: 68 48 1a 00 00 push $0x1a48 556: e8 55 07 00 00 call cb0 <strchr> 55b: 83 c4 10 add $0x10,%esp 55e: 85 c0 test %eax,%eax 560: 74 c6 je 528 <gettoken+0xb8> ret = 'a'; 562: be 61 00 00 00 mov $0x61,%esi 567: e9 62 ff ff ff jmp 4ce <gettoken+0x5e> 56c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi switch (*s) { 570: 3c 26 cmp $0x26,%al 572: 74 08 je 57c <gettoken+0x10c> 574: 8d 48 d8 lea -0x28(%eax),%ecx 577: 80 f9 01 cmp $0x1,%cl 57a: 77 96 ja 512 <gettoken+0xa2> ret = *s; 57c: 0f be f0 movsbl %al,%esi s++; 57f: 83 c7 01 add $0x1,%edi break; 582: e9 47 ff ff ff jmp 4ce <gettoken+0x5e> 587: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 58e: 66 90 xchg %ax,%ax switch (*s) { 590: 3c 3e cmp $0x3e,%al 592: 75 1c jne 5b0 <gettoken+0x140> if (*s == '>') { 594: 80 7f 01 3e cmpb $0x3e,0x1(%edi) s++; 598: 8d 47 01 lea 0x1(%edi),%eax if (*s == '>') { 59b: 74 1c je 5b9 <gettoken+0x149> s++; 59d: 89 c7 mov %eax,%edi 59f: be 3e 00 00 00 mov $0x3e,%esi 5a4: e9 25 ff ff ff jmp 4ce <gettoken+0x5e> 5a9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi switch (*s) { 5b0: 3c 7c cmp $0x7c,%al 5b2: 74 c8 je 57c <gettoken+0x10c> 5b4: e9 59 ff ff ff jmp 512 <gettoken+0xa2> s++; 5b9: 83 c7 02 add $0x2,%edi ret = '+'; 5bc: be 2b 00 00 00 mov $0x2b,%esi 5c1: e9 08 ff ff ff jmp 4ce <gettoken+0x5e> 5c6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5cd: 8d 76 00 lea 0x0(%esi),%esi 000005d0 <peek>: int peek(char **ps, char *es, char *toks) { 5d0: 55 push %ebp 5d1: 89 e5 mov %esp,%ebp 5d3: 57 push %edi 5d4: 56 push %esi 5d5: 53 push %ebx 5d6: 83 ec 0c sub $0xc,%esp 5d9: 8b 7d 08 mov 0x8(%ebp),%edi 5dc: 8b 75 0c mov 0xc(%ebp),%esi char *s; s = *ps; 5df: 8b 1f mov (%edi),%ebx while (s < es && strchr(whitespace, *s)) 5e1: 39 f3 cmp %esi,%ebx 5e3: 72 12 jb 5f7 <peek+0x27> 5e5: eb 28 jmp 60f <peek+0x3f> 5e7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 5ee: 66 90 xchg %ax,%ax s++; 5f0: 83 c3 01 add $0x1,%ebx while (s < es && strchr(whitespace, *s)) 5f3: 39 de cmp %ebx,%esi 5f5: 74 18 je 60f <peek+0x3f> 5f7: 0f be 03 movsbl (%ebx),%eax 5fa: 83 ec 08 sub $0x8,%esp 5fd: 50 push %eax 5fe: 68 48 1a 00 00 push $0x1a48 603: e8 a8 06 00 00 call cb0 <strchr> 608: 83 c4 10 add $0x10,%esp 60b: 85 c0 test %eax,%eax 60d: 75 e1 jne 5f0 <peek+0x20> *ps = s; 60f: 89 1f mov %ebx,(%edi) return *s && strchr(toks, *s); 611: 0f be 03 movsbl (%ebx),%eax 614: 31 d2 xor %edx,%edx 616: 84 c0 test %al,%al 618: 75 0e jne 628 <peek+0x58> } 61a: 8d 65 f4 lea -0xc(%ebp),%esp 61d: 89 d0 mov %edx,%eax 61f: 5b pop %ebx 620: 5e pop %esi 621: 5f pop %edi 622: 5d pop %ebp 623: c3 ret 624: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi return *s && strchr(toks, *s); 628: 83 ec 08 sub $0x8,%esp 62b: 50 push %eax 62c: ff 75 10 push 0x10(%ebp) 62f: e8 7c 06 00 00 call cb0 <strchr> 634: 83 c4 10 add $0x10,%esp 637: 31 d2 xor %edx,%edx 639: 85 c0 test %eax,%eax 63b: 0f 95 c2 setne %dl } 63e: 8d 65 f4 lea -0xc(%ebp),%esp 641: 5b pop %ebx 642: 89 d0 mov %edx,%eax 644: 5e pop %esi 645: 5f pop %edi 646: 5d pop %ebp 647: c3 ret 648: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 64f: 90 nop 00000650 <parseredirs>: cmd = pipecmd(cmd, parsepipe(ps, es)); } return cmd; } struct cmd *parseredirs(struct cmd *cmd, char **ps, char *es) { 650: 55 push %ebp 651: 89 e5 mov %esp,%ebp 653: 57 push %edi 654: 56 push %esi 655: 53 push %ebx 656: 83 ec 2c sub $0x2c,%esp 659: 8b 75 0c mov 0xc(%ebp),%esi 65c: 8b 5d 10 mov 0x10(%ebp),%ebx int tok; char *q, *eq; while (peek(ps, es, "<>")) { 65f: 90 nop 660: 83 ec 04 sub $0x4,%esp 663: 68 5f 13 00 00 push $0x135f 668: 53 push %ebx 669: 56 push %esi 66a: e8 61 ff ff ff call 5d0 <peek> 66f: 83 c4 10 add $0x10,%esp 672: 85 c0 test %eax,%eax 674: 0f 84 f6 00 00 00 je 770 <parseredirs+0x120> tok = gettoken(ps, es, 0, 0); 67a: 6a 00 push $0x0 67c: 6a 00 push $0x0 67e: 53 push %ebx 67f: 56 push %esi 680: e8 eb fd ff ff call 470 <gettoken> 685: 89 c7 mov %eax,%edi if (gettoken(ps, es, &q, &eq) != 'a') 687: 8d 45 e4 lea -0x1c(%ebp),%eax 68a: 50 push %eax 68b: 8d 45 e0 lea -0x20(%ebp),%eax 68e: 50 push %eax 68f: 53 push %ebx 690: 56 push %esi 691: e8 da fd ff ff call 470 <gettoken> 696: 83 c4 20 add $0x20,%esp 699: 83 f8 61 cmp $0x61,%eax 69c: 0f 85 d9 00 00 00 jne 77b <parseredirs+0x12b> panic("missing file for redirection"); switch (tok) { 6a2: 83 ff 3c cmp $0x3c,%edi 6a5: 74 69 je 710 <parseredirs+0xc0> 6a7: 83 ff 3e cmp $0x3e,%edi 6aa: 74 05 je 6b1 <parseredirs+0x61> 6ac: 83 ff 2b cmp $0x2b,%edi 6af: 75 af jne 660 <parseredirs+0x10> cmd = malloc(sizeof(*cmd)); 6b1: 83 ec 0c sub $0xc,%esp break; case '>': cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); break; case '+': // >> cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); 6b4: 8b 55 e4 mov -0x1c(%ebp),%edx 6b7: 8b 4d e0 mov -0x20(%ebp),%ecx cmd = malloc(sizeof(*cmd)); 6ba: 6a 18 push $0x18 cmd = redircmd(cmd, q, eq, O_WRONLY | O_CREATE, 1); 6bc: 89 55 d0 mov %edx,-0x30(%ebp) 6bf: 89 4d d4 mov %ecx,-0x2c(%ebp) cmd = malloc(sizeof(*cmd)); 6c2: e8 39 0b 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 6c7: 83 c4 0c add $0xc,%esp 6ca: 6a 18 push $0x18 cmd = malloc(sizeof(*cmd)); 6cc: 89 c7 mov %eax,%edi memset(cmd, 0, sizeof(*cmd)); 6ce: 6a 00 push $0x0 6d0: 50 push %eax 6d1: e8 ba 05 00 00 call c90 <memset> cmd->type = REDIR; 6d6: c7 07 02 00 00 00 movl $0x2,(%edi) cmd->cmd = subcmd; 6dc: 8b 45 08 mov 0x8(%ebp),%eax break; 6df: 83 c4 10 add $0x10,%esp cmd->cmd = subcmd; 6e2: 89 47 04 mov %eax,0x4(%edi) cmd->file = file; 6e5: 8b 4d d4 mov -0x2c(%ebp),%ecx 6e8: 89 4f 08 mov %ecx,0x8(%edi) cmd->efile = efile; 6eb: 8b 55 d0 mov -0x30(%ebp),%edx cmd->mode = mode; 6ee: c7 47 10 01 02 00 00 movl $0x201,0x10(%edi) cmd->efile = efile; 6f5: 89 57 0c mov %edx,0xc(%edi) cmd->fd = fd; 6f8: c7 47 14 01 00 00 00 movl $0x1,0x14(%edi) break; 6ff: 89 7d 08 mov %edi,0x8(%ebp) 702: e9 59 ff ff ff jmp 660 <parseredirs+0x10> 707: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 70e: 66 90 xchg %ax,%ax cmd = malloc(sizeof(*cmd)); 710: 83 ec 0c sub $0xc,%esp cmd = redircmd(cmd, q, eq, O_RDONLY, 0); 713: 8b 55 e4 mov -0x1c(%ebp),%edx 716: 8b 4d e0 mov -0x20(%ebp),%ecx cmd = malloc(sizeof(*cmd)); 719: 6a 18 push $0x18 cmd = redircmd(cmd, q, eq, O_RDONLY, 0); 71b: 89 55 d0 mov %edx,-0x30(%ebp) 71e: 89 4d d4 mov %ecx,-0x2c(%ebp) cmd = malloc(sizeof(*cmd)); 721: e8 da 0a 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 726: 83 c4 0c add $0xc,%esp 729: 6a 18 push $0x18 cmd = malloc(sizeof(*cmd)); 72b: 89 c7 mov %eax,%edi memset(cmd, 0, sizeof(*cmd)); 72d: 6a 00 push $0x0 72f: 50 push %eax 730: e8 5b 05 00 00 call c90 <memset> cmd->cmd = subcmd; 735: 8b 45 08 mov 0x8(%ebp),%eax cmd->file = file; 738: 8b 4d d4 mov -0x2c(%ebp),%ecx break; 73b: 89 7d 08 mov %edi,0x8(%ebp) cmd->efile = efile; 73e: 8b 55 d0 mov -0x30(%ebp),%edx cmd->type = REDIR; 741: c7 07 02 00 00 00 movl $0x2,(%edi) break; 747: 83 c4 10 add $0x10,%esp cmd->cmd = subcmd; 74a: 89 47 04 mov %eax,0x4(%edi) cmd->file = file; 74d: 89 4f 08 mov %ecx,0x8(%edi) cmd->efile = efile; 750: 89 57 0c mov %edx,0xc(%edi) cmd->mode = mode; 753: c7 47 10 00 00 00 00 movl $0x0,0x10(%edi) cmd->fd = fd; 75a: c7 47 14 00 00 00 00 movl $0x0,0x14(%edi) break; 761: e9 fa fe ff ff jmp 660 <parseredirs+0x10> 766: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 76d: 8d 76 00 lea 0x0(%esi),%esi } } return cmd; } 770: 8b 45 08 mov 0x8(%ebp),%eax 773: 8d 65 f4 lea -0xc(%ebp),%esp 776: 5b pop %ebx 777: 5e pop %esi 778: 5f pop %edi 779: 5d pop %ebp 77a: c3 ret panic("missing file for redirection"); 77b: 83 ec 0c sub $0xc,%esp 77e: 68 42 13 00 00 push $0x1342 783: e8 e8 f9 ff ff call 170 <panic> 788: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 78f: 90 nop 00000790 <parseexec>: gettoken(ps, es, 0, 0); cmd = parseredirs(cmd, ps, es); return cmd; } struct cmd *parseexec(char **ps, char *es) { 790: 55 push %ebp 791: 89 e5 mov %esp,%ebp 793: 57 push %edi 794: 56 push %esi 795: 53 push %ebx 796: 83 ec 30 sub $0x30,%esp 799: 8b 75 08 mov 0x8(%ebp),%esi 79c: 8b 7d 0c mov 0xc(%ebp),%edi char *q, *eq; int tok, argc; struct execcmd *cmd; struct cmd *ret; if (peek(ps, es, "(")) 79f: 68 62 13 00 00 push $0x1362 7a4: 57 push %edi 7a5: 56 push %esi 7a6: e8 25 fe ff ff call 5d0 <peek> 7ab: 83 c4 10 add $0x10,%esp 7ae: 85 c0 test %eax,%eax 7b0: 0f 85 aa 00 00 00 jne 860 <parseexec+0xd0> cmd = malloc(sizeof(*cmd)); 7b6: 83 ec 0c sub $0xc,%esp 7b9: 89 c3 mov %eax,%ebx 7bb: 6a 54 push $0x54 7bd: e8 3e 0a 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 7c2: 83 c4 0c add $0xc,%esp 7c5: 6a 54 push $0x54 7c7: 6a 00 push $0x0 7c9: 50 push %eax 7ca: 89 45 d0 mov %eax,-0x30(%ebp) 7cd: e8 be 04 00 00 call c90 <memset> cmd->type = EXEC; 7d2: 8b 45 d0 mov -0x30(%ebp),%eax ret = execcmd(); cmd = (struct execcmd *)ret; argc = 0; ret = parseredirs(ret, ps, es); 7d5: 83 c4 0c add $0xc,%esp cmd->type = EXEC; 7d8: c7 00 01 00 00 00 movl $0x1,(%eax) ret = parseredirs(ret, ps, es); 7de: 57 push %edi 7df: 56 push %esi 7e0: 50 push %eax 7e1: e8 6a fe ff ff call 650 <parseredirs> while (!peek(ps, es, "|)&;")) { 7e6: 83 c4 10 add $0x10,%esp ret = parseredirs(ret, ps, es); 7e9: 89 45 d4 mov %eax,-0x2c(%ebp) while (!peek(ps, es, "|)&;")) { 7ec: eb 15 jmp 803 <parseexec+0x73> 7ee: 66 90 xchg %ax,%ax cmd->argv[argc] = q; cmd->eargv[argc] = eq; argc++; if (argc >= MAXARGS) panic("too many args"); ret = parseredirs(ret, ps, es); 7f0: 83 ec 04 sub $0x4,%esp 7f3: 57 push %edi 7f4: 56 push %esi 7f5: ff 75 d4 push -0x2c(%ebp) 7f8: e8 53 fe ff ff call 650 <parseredirs> 7fd: 83 c4 10 add $0x10,%esp 800: 89 45 d4 mov %eax,-0x2c(%ebp) while (!peek(ps, es, "|)&;")) { 803: 83 ec 04 sub $0x4,%esp 806: 68 79 13 00 00 push $0x1379 80b: 57 push %edi 80c: 56 push %esi 80d: e8 be fd ff ff call 5d0 <peek> 812: 83 c4 10 add $0x10,%esp 815: 85 c0 test %eax,%eax 817: 75 5f jne 878 <parseexec+0xe8> if ((tok = gettoken(ps, es, &q, &eq)) == 0) 819: 8d 45 e4 lea -0x1c(%ebp),%eax 81c: 50 push %eax 81d: 8d 45 e0 lea -0x20(%ebp),%eax 820: 50 push %eax 821: 57 push %edi 822: 56 push %esi 823: e8 48 fc ff ff call 470 <gettoken> 828: 83 c4 10 add $0x10,%esp 82b: 85 c0 test %eax,%eax 82d: 74 49 je 878 <parseexec+0xe8> if (tok != 'a') 82f: 83 f8 61 cmp $0x61,%eax 832: 75 62 jne 896 <parseexec+0x106> cmd->argv[argc] = q; 834: 8b 45 e0 mov -0x20(%ebp),%eax 837: 8b 55 d0 mov -0x30(%ebp),%edx 83a: 89 44 9a 04 mov %eax,0x4(%edx,%ebx,4) cmd->eargv[argc] = eq; 83e: 8b 45 e4 mov -0x1c(%ebp),%eax 841: 89 44 9a 2c mov %eax,0x2c(%edx,%ebx,4) argc++; 845: 83 c3 01 add $0x1,%ebx if (argc >= MAXARGS) 848: 83 fb 0a cmp $0xa,%ebx 84b: 75 a3 jne 7f0 <parseexec+0x60> panic("too many args"); 84d: 83 ec 0c sub $0xc,%esp 850: 68 6b 13 00 00 push $0x136b 855: e8 16 f9 ff ff call 170 <panic> 85a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi return parseblock(ps, es); 860: 89 7d 0c mov %edi,0xc(%ebp) 863: 89 75 08 mov %esi,0x8(%ebp) } cmd->argv[argc] = 0; cmd->eargv[argc] = 0; return ret; } 866: 8d 65 f4 lea -0xc(%ebp),%esp 869: 5b pop %ebx 86a: 5e pop %esi 86b: 5f pop %edi 86c: 5d pop %ebp return parseblock(ps, es); 86d: e9 ae 01 00 00 jmp a20 <parseblock> 872: 8d b6 00 00 00 00 lea 0x0(%esi),%esi cmd->argv[argc] = 0; 878: 8b 45 d0 mov -0x30(%ebp),%eax 87b: c7 44 98 04 00 00 00 movl $0x0,0x4(%eax,%ebx,4) 882: 00 cmd->eargv[argc] = 0; 883: c7 44 98 2c 00 00 00 movl $0x0,0x2c(%eax,%ebx,4) 88a: 00 } 88b: 8b 45 d4 mov -0x2c(%ebp),%eax 88e: 8d 65 f4 lea -0xc(%ebp),%esp 891: 5b pop %ebx 892: 5e pop %esi 893: 5f pop %edi 894: 5d pop %ebp 895: c3 ret panic("syntax"); 896: 83 ec 0c sub $0xc,%esp 899: 68 64 13 00 00 push $0x1364 89e: e8 cd f8 ff ff call 170 <panic> 8a3: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8aa: 8d b6 00 00 00 00 lea 0x0(%esi),%esi 000008b0 <parsepipe>: struct cmd *parsepipe(char **ps, char *es) { 8b0: 55 push %ebp 8b1: 89 e5 mov %esp,%ebp 8b3: 57 push %edi 8b4: 56 push %esi 8b5: 53 push %ebx 8b6: 83 ec 14 sub $0x14,%esp 8b9: 8b 75 08 mov 0x8(%ebp),%esi 8bc: 8b 7d 0c mov 0xc(%ebp),%edi cmd = parseexec(ps, es); 8bf: 57 push %edi 8c0: 56 push %esi 8c1: e8 ca fe ff ff call 790 <parseexec> if (peek(ps, es, "|")) { 8c6: 83 c4 0c add $0xc,%esp 8c9: 68 7e 13 00 00 push $0x137e cmd = parseexec(ps, es); 8ce: 89 c3 mov %eax,%ebx if (peek(ps, es, "|")) { 8d0: 57 push %edi 8d1: 56 push %esi 8d2: e8 f9 fc ff ff call 5d0 <peek> 8d7: 83 c4 10 add $0x10,%esp 8da: 85 c0 test %eax,%eax 8dc: 75 12 jne 8f0 <parsepipe+0x40> } 8de: 8d 65 f4 lea -0xc(%ebp),%esp 8e1: 89 d8 mov %ebx,%eax 8e3: 5b pop %ebx 8e4: 5e pop %esi 8e5: 5f pop %edi 8e6: 5d pop %ebp 8e7: c3 ret 8e8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 8ef: 90 nop gettoken(ps, es, 0, 0); 8f0: 6a 00 push $0x0 8f2: 6a 00 push $0x0 8f4: 57 push %edi 8f5: 56 push %esi 8f6: e8 75 fb ff ff call 470 <gettoken> cmd = pipecmd(cmd, parsepipe(ps, es)); 8fb: 58 pop %eax 8fc: 5a pop %edx 8fd: 57 push %edi 8fe: 56 push %esi 8ff: e8 ac ff ff ff call 8b0 <parsepipe> cmd = malloc(sizeof(*cmd)); 904: c7 04 24 0c 00 00 00 movl $0xc,(%esp) cmd = pipecmd(cmd, parsepipe(ps, es)); 90b: 89 c7 mov %eax,%edi cmd = malloc(sizeof(*cmd)); 90d: e8 ee 08 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 912: 83 c4 0c add $0xc,%esp 915: 6a 0c push $0xc cmd = malloc(sizeof(*cmd)); 917: 89 c6 mov %eax,%esi memset(cmd, 0, sizeof(*cmd)); 919: 6a 00 push $0x0 91b: 50 push %eax 91c: e8 6f 03 00 00 call c90 <memset> cmd->left = left; 921: 89 5e 04 mov %ebx,0x4(%esi) cmd->right = right; 924: 83 c4 10 add $0x10,%esp 927: 89 f3 mov %esi,%ebx cmd->type = PIPE; 929: c7 06 03 00 00 00 movl $0x3,(%esi) } 92f: 89 d8 mov %ebx,%eax cmd->right = right; 931: 89 7e 08 mov %edi,0x8(%esi) } 934: 8d 65 f4 lea -0xc(%ebp),%esp 937: 5b pop %ebx 938: 5e pop %esi 939: 5f pop %edi 93a: 5d pop %ebp 93b: c3 ret 93c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000940 <parseline>: struct cmd *parseline(char **ps, char *es) { 940: 55 push %ebp 941: 89 e5 mov %esp,%ebp 943: 57 push %edi 944: 56 push %esi 945: 53 push %ebx 946: 83 ec 24 sub $0x24,%esp 949: 8b 75 08 mov 0x8(%ebp),%esi 94c: 8b 7d 0c mov 0xc(%ebp),%edi cmd = parsepipe(ps, es); 94f: 57 push %edi 950: 56 push %esi 951: e8 5a ff ff ff call 8b0 <parsepipe> while (peek(ps, es, "&")) { 956: 83 c4 10 add $0x10,%esp cmd = parsepipe(ps, es); 959: 89 c3 mov %eax,%ebx while (peek(ps, es, "&")) { 95b: eb 3b jmp 998 <parseline+0x58> 95d: 8d 76 00 lea 0x0(%esi),%esi gettoken(ps, es, 0, 0); 960: 6a 00 push $0x0 962: 6a 00 push $0x0 964: 57 push %edi 965: 56 push %esi 966: e8 05 fb ff ff call 470 <gettoken> cmd = malloc(sizeof(*cmd)); 96b: c7 04 24 08 00 00 00 movl $0x8,(%esp) 972: e8 89 08 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 977: 83 c4 0c add $0xc,%esp 97a: 6a 08 push $0x8 97c: 6a 00 push $0x0 97e: 50 push %eax 97f: 89 45 e4 mov %eax,-0x1c(%ebp) 982: e8 09 03 00 00 call c90 <memset> cmd->type = BACK; 987: 8b 55 e4 mov -0x1c(%ebp),%edx cmd->cmd = subcmd; 98a: 83 c4 10 add $0x10,%esp cmd->type = BACK; 98d: c7 02 05 00 00 00 movl $0x5,(%edx) cmd->cmd = subcmd; 993: 89 5a 04 mov %ebx,0x4(%edx) 996: 89 d3 mov %edx,%ebx while (peek(ps, es, "&")) { 998: 83 ec 04 sub $0x4,%esp 99b: 68 80 13 00 00 push $0x1380 9a0: 57 push %edi 9a1: 56 push %esi 9a2: e8 29 fc ff ff call 5d0 <peek> 9a7: 83 c4 10 add $0x10,%esp 9aa: 85 c0 test %eax,%eax 9ac: 75 b2 jne 960 <parseline+0x20> if (peek(ps, es, ";")) { 9ae: 83 ec 04 sub $0x4,%esp 9b1: 68 7c 13 00 00 push $0x137c 9b6: 57 push %edi 9b7: 56 push %esi 9b8: e8 13 fc ff ff call 5d0 <peek> 9bd: 83 c4 10 add $0x10,%esp 9c0: 85 c0 test %eax,%eax 9c2: 75 0c jne 9d0 <parseline+0x90> } 9c4: 8d 65 f4 lea -0xc(%ebp),%esp 9c7: 89 d8 mov %ebx,%eax 9c9: 5b pop %ebx 9ca: 5e pop %esi 9cb: 5f pop %edi 9cc: 5d pop %ebp 9cd: c3 ret 9ce: 66 90 xchg %ax,%ax gettoken(ps, es, 0, 0); 9d0: 6a 00 push $0x0 9d2: 6a 00 push $0x0 9d4: 57 push %edi 9d5: 56 push %esi 9d6: e8 95 fa ff ff call 470 <gettoken> cmd = listcmd(cmd, parseline(ps, es)); 9db: 58 pop %eax 9dc: 5a pop %edx 9dd: 57 push %edi 9de: 56 push %esi 9df: e8 5c ff ff ff call 940 <parseline> cmd = malloc(sizeof(*cmd)); 9e4: c7 04 24 0c 00 00 00 movl $0xc,(%esp) cmd = listcmd(cmd, parseline(ps, es)); 9eb: 89 c7 mov %eax,%edi cmd = malloc(sizeof(*cmd)); 9ed: e8 0e 08 00 00 call 1200 <malloc> memset(cmd, 0, sizeof(*cmd)); 9f2: 83 c4 0c add $0xc,%esp 9f5: 6a 0c push $0xc cmd = malloc(sizeof(*cmd)); 9f7: 89 c6 mov %eax,%esi memset(cmd, 0, sizeof(*cmd)); 9f9: 6a 00 push $0x0 9fb: 50 push %eax 9fc: e8 8f 02 00 00 call c90 <memset> cmd->left = left; a01: 89 5e 04 mov %ebx,0x4(%esi) cmd->right = right; a04: 83 c4 10 add $0x10,%esp a07: 89 f3 mov %esi,%ebx cmd->type = LIST; a09: c7 06 04 00 00 00 movl $0x4,(%esi) } a0f: 89 d8 mov %ebx,%eax cmd->right = right; a11: 89 7e 08 mov %edi,0x8(%esi) } a14: 8d 65 f4 lea -0xc(%ebp),%esp a17: 5b pop %ebx a18: 5e pop %esi a19: 5f pop %edi a1a: 5d pop %ebp a1b: c3 ret a1c: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000a20 <parseblock>: struct cmd *parseblock(char **ps, char *es) { a20: 55 push %ebp a21: 89 e5 mov %esp,%ebp a23: 57 push %edi a24: 56 push %esi a25: 53 push %ebx a26: 83 ec 10 sub $0x10,%esp a29: 8b 5d 08 mov 0x8(%ebp),%ebx a2c: 8b 75 0c mov 0xc(%ebp),%esi if (!peek(ps, es, "(")) a2f: 68 62 13 00 00 push $0x1362 a34: 56 push %esi a35: 53 push %ebx a36: e8 95 fb ff ff call 5d0 <peek> a3b: 83 c4 10 add $0x10,%esp a3e: 85 c0 test %eax,%eax a40: 74 4a je a8c <parseblock+0x6c> gettoken(ps, es, 0, 0); a42: 6a 00 push $0x0 a44: 6a 00 push $0x0 a46: 56 push %esi a47: 53 push %ebx a48: e8 23 fa ff ff call 470 <gettoken> cmd = parseline(ps, es); a4d: 58 pop %eax a4e: 5a pop %edx a4f: 56 push %esi a50: 53 push %ebx a51: e8 ea fe ff ff call 940 <parseline> if (!peek(ps, es, ")")) a56: 83 c4 0c add $0xc,%esp a59: 68 9e 13 00 00 push $0x139e cmd = parseline(ps, es); a5e: 89 c7 mov %eax,%edi if (!peek(ps, es, ")")) a60: 56 push %esi a61: 53 push %ebx a62: e8 69 fb ff ff call 5d0 <peek> a67: 83 c4 10 add $0x10,%esp a6a: 85 c0 test %eax,%eax a6c: 74 2b je a99 <parseblock+0x79> gettoken(ps, es, 0, 0); a6e: 6a 00 push $0x0 a70: 6a 00 push $0x0 a72: 56 push %esi a73: 53 push %ebx a74: e8 f7 f9 ff ff call 470 <gettoken> cmd = parseredirs(cmd, ps, es); a79: 83 c4 0c add $0xc,%esp a7c: 56 push %esi a7d: 53 push %ebx a7e: 57 push %edi a7f: e8 cc fb ff ff call 650 <parseredirs> } a84: 8d 65 f4 lea -0xc(%ebp),%esp a87: 5b pop %ebx a88: 5e pop %esi a89: 5f pop %edi a8a: 5d pop %ebp a8b: c3 ret panic("parseblock"); a8c: 83 ec 0c sub $0xc,%esp a8f: 68 82 13 00 00 push $0x1382 a94: e8 d7 f6 ff ff call 170 <panic> panic("syntax - missing )"); a99: 83 ec 0c sub $0xc,%esp a9c: 68 8d 13 00 00 push $0x138d aa1: e8 ca f6 ff ff call 170 <panic> aa6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi aad: 8d 76 00 lea 0x0(%esi),%esi 00000ab0 <nulterminate>: // NUL-terminate all the counted strings. struct cmd *nulterminate(struct cmd *cmd) { ab0: 55 push %ebp ab1: 89 e5 mov %esp,%ebp ab3: 53 push %ebx ab4: 83 ec 04 sub $0x4,%esp ab7: 8b 5d 08 mov 0x8(%ebp),%ebx struct execcmd *ecmd; struct listcmd *lcmd; struct pipecmd *pcmd; struct redircmd *rcmd; if (cmd == 0) aba: 85 db test %ebx,%ebx abc: 0f 84 8e 00 00 00 je b50 <nulterminate+0xa0> return 0; switch (cmd->type) { ac2: 83 3b 05 cmpl $0x5,(%ebx) ac5: 77 61 ja b28 <nulterminate+0x78> ac7: 8b 03 mov (%ebx),%eax ac9: ff 24 85 e0 13 00 00 jmp *0x13e0(,%eax,4) nulterminate(pcmd->right); break; case LIST: lcmd = (struct listcmd *)cmd; nulterminate(lcmd->left); ad0: 83 ec 0c sub $0xc,%esp ad3: ff 73 04 push 0x4(%ebx) ad6: e8 d5 ff ff ff call ab0 <nulterminate> nulterminate(lcmd->right); adb: 58 pop %eax adc: ff 73 08 push 0x8(%ebx) adf: e8 cc ff ff ff call ab0 <nulterminate> break; ae4: 83 c4 10 add $0x10,%esp ae7: 89 d8 mov %ebx,%eax bcmd = (struct backcmd *)cmd; nulterminate(bcmd->cmd); break; } return cmd; } ae9: 8b 5d fc mov -0x4(%ebp),%ebx aec: c9 leave aed: c3 ret aee: 66 90 xchg %ax,%ax nulterminate(bcmd->cmd); af0: 83 ec 0c sub $0xc,%esp af3: ff 73 04 push 0x4(%ebx) af6: e8 b5 ff ff ff call ab0 <nulterminate> break; afb: 89 d8 mov %ebx,%eax afd: 83 c4 10 add $0x10,%esp } b00: 8b 5d fc mov -0x4(%ebp),%ebx b03: c9 leave b04: c3 ret b05: 8d 76 00 lea 0x0(%esi),%esi for (i = 0; ecmd->argv[i]; i++) b08: 8b 4b 04 mov 0x4(%ebx),%ecx b0b: 8d 43 08 lea 0x8(%ebx),%eax b0e: 85 c9 test %ecx,%ecx b10: 74 16 je b28 <nulterminate+0x78> b12: 8d b6 00 00 00 00 lea 0x0(%esi),%esi *ecmd->eargv[i] = 0; b18: 8b 50 24 mov 0x24(%eax),%edx for (i = 0; ecmd->argv[i]; i++) b1b: 83 c0 04 add $0x4,%eax *ecmd->eargv[i] = 0; b1e: c6 02 00 movb $0x0,(%edx) for (i = 0; ecmd->argv[i]; i++) b21: 8b 50 fc mov -0x4(%eax),%edx b24: 85 d2 test %edx,%edx b26: 75 f0 jne b18 <nulterminate+0x68> switch (cmd->type) { b28: 89 d8 mov %ebx,%eax } b2a: 8b 5d fc mov -0x4(%ebp),%ebx b2d: c9 leave b2e: c3 ret b2f: 90 nop nulterminate(rcmd->cmd); b30: 83 ec 0c sub $0xc,%esp b33: ff 73 04 push 0x4(%ebx) b36: e8 75 ff ff ff call ab0 <nulterminate> *rcmd->efile = 0; b3b: 8b 43 0c mov 0xc(%ebx),%eax break; b3e: 83 c4 10 add $0x10,%esp *rcmd->efile = 0; b41: c6 00 00 movb $0x0,(%eax) break; b44: 89 d8 mov %ebx,%eax } b46: 8b 5d fc mov -0x4(%ebp),%ebx b49: c9 leave b4a: c3 ret b4b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi b4f: 90 nop return 0; b50: 31 c0 xor %eax,%eax b52: eb 95 jmp ae9 <nulterminate+0x39> b54: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi b5b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi b5f: 90 nop 00000b60 <parsecmd>: struct cmd *parsecmd(char *s) { b60: 55 push %ebp b61: 89 e5 mov %esp,%ebp b63: 57 push %edi b64: 56 push %esi cmd = parseline(&s, es); b65: 8d 7d 08 lea 0x8(%ebp),%edi struct cmd *parsecmd(char *s) { b68: 53 push %ebx b69: 83 ec 18 sub $0x18,%esp es = s + strlen(s); b6c: 8b 5d 08 mov 0x8(%ebp),%ebx b6f: 53 push %ebx b70: e8 eb 00 00 00 call c60 <strlen> cmd = parseline(&s, es); b75: 59 pop %ecx b76: 5e pop %esi es = s + strlen(s); b77: 01 c3 add %eax,%ebx cmd = parseline(&s, es); b79: 53 push %ebx b7a: 57 push %edi b7b: e8 c0 fd ff ff call 940 <parseline> peek(&s, es, ""); b80: 83 c4 0c add $0xc,%esp b83: 68 2c 13 00 00 push $0x132c cmd = parseline(&s, es); b88: 89 c6 mov %eax,%esi peek(&s, es, ""); b8a: 53 push %ebx b8b: 57 push %edi b8c: e8 3f fa ff ff call 5d0 <peek> if (s != es) { b91: 8b 45 08 mov 0x8(%ebp),%eax b94: 83 c4 10 add $0x10,%esp b97: 39 d8 cmp %ebx,%eax b99: 75 13 jne bae <parsecmd+0x4e> nulterminate(cmd); b9b: 83 ec 0c sub $0xc,%esp b9e: 56 push %esi b9f: e8 0c ff ff ff call ab0 <nulterminate> } ba4: 8d 65 f4 lea -0xc(%ebp),%esp ba7: 89 f0 mov %esi,%eax ba9: 5b pop %ebx baa: 5e pop %esi bab: 5f pop %edi bac: 5d pop %ebp bad: c3 ret printf(2, "leftovers: %s\n", s); bae: 52 push %edx baf: 50 push %eax bb0: 68 a0 13 00 00 push $0x13a0 bb5: 6a 02 push $0x2 bb7: e8 14 04 00 00 call fd0 <printf> panic("syntax"); bbc: c7 04 24 64 13 00 00 movl $0x1364,(%esp) bc3: e8 a8 f5 ff ff call 170 <panic> bc8: 66 90 xchg %ax,%ax bca: 66 90 xchg %ax,%ax bcc: 66 90 xchg %ax,%ax bce: 66 90 xchg %ax,%ax 00000bd0 <strcpy>: #include "stat.h" #include "types.h" #include "user.h" #include "x86.h" char *strcpy(char *s, const char *t) { bd0: 55 push %ebp char *os; os = s; while ((*s++ = *t++) != 0) bd1: 31 c0 xor %eax,%eax char *strcpy(char *s, const char *t) { bd3: 89 e5 mov %esp,%ebp bd5: 53 push %ebx bd6: 8b 4d 08 mov 0x8(%ebp),%ecx bd9: 8b 5d 0c mov 0xc(%ebp),%ebx bdc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi while ((*s++ = *t++) != 0) be0: 0f b6 14 03 movzbl (%ebx,%eax,1),%edx be4: 88 14 01 mov %dl,(%ecx,%eax,1) be7: 83 c0 01 add $0x1,%eax bea: 84 d2 test %dl,%dl bec: 75 f2 jne be0 <strcpy+0x10> ; return os; } bee: 8b 5d fc mov -0x4(%ebp),%ebx bf1: 89 c8 mov %ecx,%eax bf3: c9 leave bf4: c3 ret bf5: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi bfc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 00000c00 <strcmp>: int strcmp(const char *p, const char *q) { c00: 55 push %ebp c01: 89 e5 mov %esp,%ebp c03: 53 push %ebx c04: 8b 55 08 mov 0x8(%ebp),%edx c07: 8b 4d 0c mov 0xc(%ebp),%ecx while (*p && *p == *q) c0a: 0f b6 02 movzbl (%edx),%eax c0d: 84 c0 test %al,%al c0f: 75 17 jne c28 <strcmp+0x28> c11: eb 3a jmp c4d <strcmp+0x4d> c13: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c17: 90 nop c18: 0f b6 42 01 movzbl 0x1(%edx),%eax p++, q++; c1c: 83 c2 01 add $0x1,%edx c1f: 8d 59 01 lea 0x1(%ecx),%ebx while (*p && *p == *q) c22: 84 c0 test %al,%al c24: 74 1a je c40 <strcmp+0x40> p++, q++; c26: 89 d9 mov %ebx,%ecx while (*p && *p == *q) c28: 0f b6 19 movzbl (%ecx),%ebx c2b: 38 c3 cmp %al,%bl c2d: 74 e9 je c18 <strcmp+0x18> return (uchar)*p - (uchar)*q; c2f: 29 d8 sub %ebx,%eax } c31: 8b 5d fc mov -0x4(%ebp),%ebx c34: c9 leave c35: c3 ret c36: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi c3d: 8d 76 00 lea 0x0(%esi),%esi return (uchar)*p - (uchar)*q; c40: 0f b6 59 01 movzbl 0x1(%ecx),%ebx c44: 31 c0 xor %eax,%eax c46: 29 d8 sub %ebx,%eax } c48: 8b 5d fc mov -0x4(%ebp),%ebx c4b: c9 leave c4c: c3 ret return (uchar)*p - (uchar)*q; c4d: 0f b6 19 movzbl (%ecx),%ebx c50: 31 c0 xor %eax,%eax c52: eb db jmp c2f <strcmp+0x2f> c54: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi c5b: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi c5f: 90 nop 00000c60 <strlen>: uint strlen(const char *s) { c60: 55 push %ebp c61: 89 e5 mov %esp,%ebp c63: 8b 55 08 mov 0x8(%ebp),%edx int n; for (n = 0; s[n]; n++) c66: 80 3a 00 cmpb $0x0,(%edx) c69: 74 15 je c80 <strlen+0x20> c6b: 31 c0 xor %eax,%eax c6d: 8d 76 00 lea 0x0(%esi),%esi c70: 83 c0 01 add $0x1,%eax c73: 80 3c 02 00 cmpb $0x0,(%edx,%eax,1) c77: 89 c1 mov %eax,%ecx c79: 75 f5 jne c70 <strlen+0x10> ; return n; } c7b: 89 c8 mov %ecx,%eax c7d: 5d pop %ebp c7e: c3 ret c7f: 90 nop for (n = 0; s[n]; n++) c80: 31 c9 xor %ecx,%ecx } c82: 5d pop %ebp c83: 89 c8 mov %ecx,%eax c85: c3 ret c86: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi c8d: 8d 76 00 lea 0x0(%esi),%esi 00000c90 <memset>: void *memset(void *dst, int c, uint n) { c90: 55 push %ebp c91: 89 e5 mov %esp,%ebp c93: 57 push %edi c94: 8b 55 08 mov 0x8(%ebp),%edx } static inline void stosb(void *addr, int data, int cnt) { asm volatile("cld; rep stosb" : c97: 8b 4d 10 mov 0x10(%ebp),%ecx c9a: 8b 45 0c mov 0xc(%ebp),%eax c9d: 89 d7 mov %edx,%edi c9f: fc cld ca0: f3 aa rep stos %al,%es:(%edi) stosb(dst, c, n); return dst; } ca2: 8b 7d fc mov -0x4(%ebp),%edi ca5: 89 d0 mov %edx,%eax ca7: c9 leave ca8: c3 ret ca9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 00000cb0 <strchr>: char *strchr(const char *s, char c) { cb0: 55 push %ebp cb1: 89 e5 mov %esp,%ebp cb3: 8b 45 08 mov 0x8(%ebp),%eax cb6: 0f b6 4d 0c movzbl 0xc(%ebp),%ecx for (; *s; s++) cba: 0f b6 10 movzbl (%eax),%edx cbd: 84 d2 test %dl,%dl cbf: 75 12 jne cd3 <strchr+0x23> cc1: eb 1d jmp ce0 <strchr+0x30> cc3: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cc7: 90 nop cc8: 0f b6 50 01 movzbl 0x1(%eax),%edx ccc: 83 c0 01 add $0x1,%eax ccf: 84 d2 test %dl,%dl cd1: 74 0d je ce0 <strchr+0x30> if (*s == c) cd3: 38 d1 cmp %dl,%cl cd5: 75 f1 jne cc8 <strchr+0x18> return (char *)s; return 0; } cd7: 5d pop %ebp cd8: c3 ret cd9: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi return 0; ce0: 31 c0 xor %eax,%eax } ce2: 5d pop %ebp ce3: c3 ret ce4: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ceb: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi cef: 90 nop 00000cf0 <gets>: char *gets(char *buf, int max) { cf0: 55 push %ebp cf1: 89 e5 mov %esp,%ebp cf3: 57 push %edi cf4: 56 push %esi int i, cc; char c; for (i = 0; i + 1 < max;) { cc = read(0, &c, 1); cf5: 8d 7d e7 lea -0x19(%ebp),%edi char *gets(char *buf, int max) { cf8: 53 push %ebx for (i = 0; i + 1 < max;) { cf9: 31 db xor %ebx,%ebx char *gets(char *buf, int max) { cfb: 83 ec 1c sub $0x1c,%esp for (i = 0; i + 1 < max;) { cfe: eb 27 jmp d27 <gets+0x37> cc = read(0, &c, 1); d00: 83 ec 04 sub $0x4,%esp d03: 6a 01 push $0x1 d05: 57 push %edi d06: 6a 00 push $0x0 d08: e8 4e 01 00 00 call e5b <read> if (cc < 1) d0d: 83 c4 10 add $0x10,%esp d10: 85 c0 test %eax,%eax d12: 7e 1d jle d31 <gets+0x41> break; buf[i++] = c; d14: 0f b6 45 e7 movzbl -0x19(%ebp),%eax d18: 8b 55 08 mov 0x8(%ebp),%edx d1b: 88 44 1a ff mov %al,-0x1(%edx,%ebx,1) if (c == '\n' || c == '\r') d1f: 3c 0a cmp $0xa,%al d21: 74 1d je d40 <gets+0x50> d23: 3c 0d cmp $0xd,%al d25: 74 19 je d40 <gets+0x50> for (i = 0; i + 1 < max;) { d27: 89 de mov %ebx,%esi d29: 83 c3 01 add $0x1,%ebx d2c: 3b 5d 0c cmp 0xc(%ebp),%ebx d2f: 7c cf jl d00 <gets+0x10> break; } buf[i] = '\0'; d31: 8b 45 08 mov 0x8(%ebp),%eax d34: c6 04 30 00 movb $0x0,(%eax,%esi,1) return buf; } d38: 8d 65 f4 lea -0xc(%ebp),%esp d3b: 5b pop %ebx d3c: 5e pop %esi d3d: 5f pop %edi d3e: 5d pop %ebp d3f: c3 ret buf[i] = '\0'; d40: 8b 45 08 mov 0x8(%ebp),%eax d43: 89 de mov %ebx,%esi d45: c6 04 30 00 movb $0x0,(%eax,%esi,1) } d49: 8d 65 f4 lea -0xc(%ebp),%esp d4c: 5b pop %ebx d4d: 5e pop %esi d4e: 5f pop %edi d4f: 5d pop %ebp d50: c3 ret d51: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi d58: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi d5f: 90 nop 00000d60 <stat>: int stat(const char *n, struct stat *st) { d60: 55 push %ebp d61: 89 e5 mov %esp,%ebp d63: 56 push %esi d64: 53 push %ebx int fd; int r; fd = open(n, O_RDONLY); d65: 83 ec 08 sub $0x8,%esp d68: 6a 00 push $0x0 d6a: ff 75 08 push 0x8(%ebp) d6d: e8 11 01 00 00 call e83 <open> if (fd < 0) d72: 83 c4 10 add $0x10,%esp d75: 85 c0 test %eax,%eax d77: 78 27 js da0 <stat+0x40> return -1; r = fstat(fd, st); d79: 83 ec 08 sub $0x8,%esp d7c: ff 75 0c push 0xc(%ebp) d7f: 89 c3 mov %eax,%ebx d81: 50 push %eax d82: e8 14 01 00 00 call e9b <fstat> close(fd); d87: 89 1c 24 mov %ebx,(%esp) r = fstat(fd, st); d8a: 89 c6 mov %eax,%esi close(fd); d8c: e8 da 00 00 00 call e6b <close> return r; d91: 83 c4 10 add $0x10,%esp } d94: 8d 65 f8 lea -0x8(%ebp),%esp d97: 89 f0 mov %esi,%eax d99: 5b pop %ebx d9a: 5e pop %esi d9b: 5d pop %ebp d9c: c3 ret d9d: 8d 76 00 lea 0x0(%esi),%esi return -1; da0: be ff ff ff ff mov $0xffffffff,%esi da5: eb ed jmp d94 <stat+0x34> da7: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi dae: 66 90 xchg %ax,%ax 00000db0 <atoi>: int atoi(const char *s) { db0: 55 push %ebp db1: 89 e5 mov %esp,%ebp db3: 56 push %esi db4: be 01 00 00 00 mov $0x1,%esi db9: 8b 4d 08 mov 0x8(%ebp),%ecx dbc: 53 push %ebx i = 0; sign = 1; val = 0; nbr = 0; if (s[0] == '-') { dbd: 0f b6 11 movzbl (%ecx),%edx dc0: 80 fa 2d cmp $0x2d,%dl dc3: 75 0c jne dd1 <atoi+0x21> sign = -1; s++; } i = 0; while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') { dc5: 0f b6 51 01 movzbl 0x1(%ecx),%edx sign = -1; dc9: be ff ff ff ff mov $0xffffffff,%esi s++; dce: 83 c1 01 add $0x1,%ecx while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') { dd1: 8d 5a d0 lea -0x30(%edx),%ebx dd4: 80 fb 09 cmp $0x9,%bl dd7: 77 2f ja e08 <atoi+0x58> dd9: 83 c1 01 add $0x1,%ecx val = 0; ddc: 31 db xor %ebx,%ebx dde: 66 90 xchg %ax,%ax nbr = (int)(s[i] - '0'); de0: 83 ea 30 sub $0x30,%edx val = (val * 10) + nbr; de3: 8d 1c 9b lea (%ebx,%ebx,4),%ebx while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') { de6: 83 c1 01 add $0x1,%ecx nbr = (int)(s[i] - '0'); de9: 0f be d2 movsbl %dl,%edx val = (val * 10) + nbr; dec: 8d 1c 5a lea (%edx,%ebx,2),%ebx while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') { def: 0f b6 51 ff movzbl -0x1(%ecx),%edx df3: 8d 42 d0 lea -0x30(%edx),%eax df6: 3c 09 cmp $0x9,%al df8: 76 e6 jbe de0 <atoi+0x30> i++; } i++; return (val * sign); dfa: 89 f0 mov %esi,%eax dfc: 0f af c3 imul %ebx,%eax } dff: 5b pop %ebx e00: 5e pop %esi e01: 5d pop %ebp e02: c3 ret e03: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi e07: 90 nop e08: 5b pop %ebx while (s[i] >= '0' && s[i] <= '9' && s[i] != '\0') { e09: 31 c0 xor %eax,%eax } e0b: 5e pop %esi e0c: 5d pop %ebp e0d: c3 ret e0e: 66 90 xchg %ax,%ax 00000e10 <memmove>: void *memmove(void *vdst, const void *vsrc, int n) { e10: 55 push %ebp e11: 89 e5 mov %esp,%ebp e13: 57 push %edi e14: 8b 45 10 mov 0x10(%ebp),%eax e17: 8b 55 08 mov 0x8(%ebp),%edx e1a: 56 push %esi e1b: 8b 75 0c mov 0xc(%ebp),%esi char *dst; const char *src; dst = vdst; src = vsrc; while (n-- > 0) e1e: 85 c0 test %eax,%eax e20: 7e 13 jle e35 <memmove+0x25> e22: 01 d0 add %edx,%eax dst = vdst; e24: 89 d7 mov %edx,%edi e26: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi e2d: 8d 76 00 lea 0x0(%esi),%esi *dst++ = *src++; e30: a4 movsb %ds:(%esi),%es:(%edi) while (n-- > 0) e31: 39 f8 cmp %edi,%eax e33: 75 fb jne e30 <memmove+0x20> return vdst; } e35: 5e pop %esi e36: 89 d0 mov %edx,%eax e38: 5f pop %edi e39: 5d pop %ebp e3a: c3 ret 00000e3b <fork>: SYSCALL(fork) e3b: b8 01 00 00 00 mov $0x1,%eax e40: cd 40 int $0x40 e42: c3 ret 00000e43 <exit>: SYSCALL(exit) e43: b8 02 00 00 00 mov $0x2,%eax e48: cd 40 int $0x40 e4a: c3 ret 00000e4b <wait>: SYSCALL(wait) e4b: b8 03 00 00 00 mov $0x3,%eax e50: cd 40 int $0x40 e52: c3 ret 00000e53 <pipe>: SYSCALL(pipe) e53: b8 04 00 00 00 mov $0x4,%eax e58: cd 40 int $0x40 e5a: c3 ret 00000e5b <read>: SYSCALL(read) e5b: b8 05 00 00 00 mov $0x5,%eax e60: cd 40 int $0x40 e62: c3 ret 00000e63 <write>: SYSCALL(write) e63: b8 10 00 00 00 mov $0x10,%eax e68: cd 40 int $0x40 e6a: c3 ret 00000e6b <close>: SYSCALL(close) e6b: b8 15 00 00 00 mov $0x15,%eax e70: cd 40 int $0x40 e72: c3 ret 00000e73 <kill>: SYSCALL(kill) e73: b8 06 00 00 00 mov $0x6,%eax e78: cd 40 int $0x40 e7a: c3 ret 00000e7b <exec>: SYSCALL(exec) e7b: b8 07 00 00 00 mov $0x7,%eax e80: cd 40 int $0x40 e82: c3 ret 00000e83 <open>: SYSCALL(open) e83: b8 0f 00 00 00 mov $0xf,%eax e88: cd 40 int $0x40 e8a: c3 ret 00000e8b <mknod>: SYSCALL(mknod) e8b: b8 11 00 00 00 mov $0x11,%eax e90: cd 40 int $0x40 e92: c3 ret 00000e93 <unlink>: SYSCALL(unlink) e93: b8 12 00 00 00 mov $0x12,%eax e98: cd 40 int $0x40 e9a: c3 ret 00000e9b <fstat>: SYSCALL(fstat) e9b: b8 08 00 00 00 mov $0x8,%eax ea0: cd 40 int $0x40 ea2: c3 ret 00000ea3 <link>: SYSCALL(link) ea3: b8 13 00 00 00 mov $0x13,%eax ea8: cd 40 int $0x40 eaa: c3 ret 00000eab <mkdir>: SYSCALL(mkdir) eab: b8 14 00 00 00 mov $0x14,%eax eb0: cd 40 int $0x40 eb2: c3 ret 00000eb3 <chdir>: SYSCALL(chdir) eb3: b8 09 00 00 00 mov $0x9,%eax eb8: cd 40 int $0x40 eba: c3 ret 00000ebb <dup>: SYSCALL(dup) ebb: b8 0a 00 00 00 mov $0xa,%eax ec0: cd 40 int $0x40 ec2: c3 ret 00000ec3 <getpid>: SYSCALL(getpid) ec3: b8 0b 00 00 00 mov $0xb,%eax ec8: cd 40 int $0x40 eca: c3 ret 00000ecb <sbrk>: SYSCALL(sbrk) ecb: b8 0c 00 00 00 mov $0xc,%eax ed0: cd 40 int $0x40 ed2: c3 ret 00000ed3 <sleep>: SYSCALL(sleep) ed3: b8 0d 00 00 00 mov $0xd,%eax ed8: cd 40 int $0x40 eda: c3 ret 00000edb <uptime>: SYSCALL(uptime) edb: b8 0e 00 00 00 mov $0xe,%eax ee0: cd 40 int $0x40 ee2: c3 ret 00000ee3 <shutdown>: #SYSCALL(dup) #SYSCALL(getpid) #SYSCALL(sbrk) #SYSCALL(sleep) #SYSCALL(uptime) SYSCALL(shutdown) ee3: b8 16 00 00 00 mov $0x16,%eax ee8: cd 40 int $0x40 eea: c3 ret 00000eeb <incr>: SYSCALL(incr) eeb: b8 17 00 00 00 mov $0x17,%eax ef0: cd 40 int $0x40 ef2: c3 ret 00000ef3 <add>: SYSCALL(add) ef3: b8 18 00 00 00 mov $0x18,%eax ef8: cd 40 int $0x40 efa: c3 ret 00000efb <mult>: SYSCALL(mult) efb: b8 19 00 00 00 mov $0x19,%eax f00: cd 40 int $0x40 f02: c3 ret 00000f03 <div>: SYSCALL(div) f03: b8 1a 00 00 00 mov $0x1a,%eax f08: cd 40 int $0x40 f0a: c3 ret 00000f0b <mod>: SYSCALL(mod) f0b: b8 1b 00 00 00 mov $0x1b,%eax f10: cd 40 int $0x40 f12: c3 ret f13: 66 90 xchg %ax,%ax f15: 66 90 xchg %ax,%ax f17: 66 90 xchg %ax,%ax f19: 66 90 xchg %ax,%ax f1b: 66 90 xchg %ax,%ax f1d: 66 90 xchg %ax,%ax f1f: 90 nop 00000f20 <printint>: write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { f20: 55 push %ebp f21: 89 e5 mov %esp,%ebp f23: 57 push %edi f24: 56 push %esi f25: 53 push %ebx f26: 83 ec 3c sub $0x3c,%esp f29: 89 4d c4 mov %ecx,-0x3c(%ebp) uint x; neg = 0; if(sgn && xx < 0){ neg = 1; x = -xx; f2c: 89 d1 mov %edx,%ecx { f2e: 89 45 b8 mov %eax,-0x48(%ebp) if(sgn && xx < 0){ f31: 85 d2 test %edx,%edx f33: 0f 89 7f 00 00 00 jns fb8 <printint+0x98> f39: f6 45 08 01 testb $0x1,0x8(%ebp) f3d: 74 79 je fb8 <printint+0x98> neg = 1; f3f: c7 45 bc 01 00 00 00 movl $0x1,-0x44(%ebp) x = -xx; f46: f7 d9 neg %ecx } else { x = xx; } i = 0; f48: 31 db xor %ebx,%ebx f4a: 8d 75 d7 lea -0x29(%ebp),%esi f4d: 8d 76 00 lea 0x0(%esi),%esi do{ buf[i++] = digits[x % base]; f50: 89 c8 mov %ecx,%eax f52: 31 d2 xor %edx,%edx f54: 89 cf mov %ecx,%edi f56: f7 75 c4 divl -0x3c(%ebp) f59: 0f b6 92 58 14 00 00 movzbl 0x1458(%edx),%edx f60: 89 45 c0 mov %eax,-0x40(%ebp) f63: 89 d8 mov %ebx,%eax f65: 8d 5b 01 lea 0x1(%ebx),%ebx }while((x /= base) != 0); f68: 8b 4d c0 mov -0x40(%ebp),%ecx buf[i++] = digits[x % base]; f6b: 88 14 1e mov %dl,(%esi,%ebx,1) }while((x /= base) != 0); f6e: 39 7d c4 cmp %edi,-0x3c(%ebp) f71: 76 dd jbe f50 <printint+0x30> if(neg) f73: 8b 4d bc mov -0x44(%ebp),%ecx f76: 85 c9 test %ecx,%ecx f78: 74 0c je f86 <printint+0x66> buf[i++] = '-'; f7a: c6 44 1d d8 2d movb $0x2d,-0x28(%ebp,%ebx,1) buf[i++] = digits[x % base]; f7f: 89 d8 mov %ebx,%eax buf[i++] = '-'; f81: ba 2d 00 00 00 mov $0x2d,%edx while(--i >= 0) f86: 8b 7d b8 mov -0x48(%ebp),%edi f89: 8d 5c 05 d7 lea -0x29(%ebp,%eax,1),%ebx f8d: eb 07 jmp f96 <printint+0x76> f8f: 90 nop putc(fd, buf[i]); f90: 0f b6 13 movzbl (%ebx),%edx f93: 83 eb 01 sub $0x1,%ebx write(fd, &c, 1); f96: 83 ec 04 sub $0x4,%esp f99: 88 55 d7 mov %dl,-0x29(%ebp) f9c: 6a 01 push $0x1 f9e: 56 push %esi f9f: 57 push %edi fa0: e8 be fe ff ff call e63 <write> while(--i >= 0) fa5: 83 c4 10 add $0x10,%esp fa8: 39 de cmp %ebx,%esi faa: 75 e4 jne f90 <printint+0x70> } fac: 8d 65 f4 lea -0xc(%ebp),%esp faf: 5b pop %ebx fb0: 5e pop %esi fb1: 5f pop %edi fb2: 5d pop %ebp fb3: c3 ret fb4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi neg = 0; fb8: c7 45 bc 00 00 00 00 movl $0x0,-0x44(%ebp) fbf: eb 87 jmp f48 <printint+0x28> fc1: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi fc8: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi fcf: 90 nop 00000fd0 <printf>: // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, const char *fmt, ...) { fd0: 55 push %ebp fd1: 89 e5 mov %esp,%ebp fd3: 57 push %edi fd4: 56 push %esi fd5: 53 push %ebx fd6: 83 ec 2c sub $0x2c,%esp int c, i, state; uint *ap; state = 0; ap = (uint*)(void*)&fmt + 1; for(i = 0; fmt[i]; i++){ fd9: 8b 5d 0c mov 0xc(%ebp),%ebx { fdc: 8b 75 08 mov 0x8(%ebp),%esi for(i = 0; fmt[i]; i++){ fdf: 0f b6 13 movzbl (%ebx),%edx fe2: 84 d2 test %dl,%dl fe4: 74 6a je 1050 <printf+0x80> ap = (uint*)(void*)&fmt + 1; fe6: 8d 45 10 lea 0x10(%ebp),%eax fe9: 83 c3 01 add $0x1,%ebx write(fd, &c, 1); fec: 8d 7d e7 lea -0x19(%ebp),%edi state = 0; fef: 31 c9 xor %ecx,%ecx ap = (uint*)(void*)&fmt + 1; ff1: 89 45 d0 mov %eax,-0x30(%ebp) ff4: eb 36 jmp 102c <printf+0x5c> ff6: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi ffd: 8d 76 00 lea 0x0(%esi),%esi 1000: 89 4d d4 mov %ecx,-0x2c(%ebp) c = fmt[i] & 0xff; if(state == 0){ if(c == '%'){ state = '%'; 1003: b9 25 00 00 00 mov $0x25,%ecx if(c == '%'){ 1008: 83 f8 25 cmp $0x25,%eax 100b: 74 15 je 1022 <printf+0x52> write(fd, &c, 1); 100d: 83 ec 04 sub $0x4,%esp 1010: 88 55 e7 mov %dl,-0x19(%ebp) 1013: 6a 01 push $0x1 1015: 57 push %edi 1016: 56 push %esi 1017: e8 47 fe ff ff call e63 <write> 101c: 8b 4d d4 mov -0x2c(%ebp),%ecx } else { putc(fd, c); 101f: 83 c4 10 add $0x10,%esp for(i = 0; fmt[i]; i++){ 1022: 0f b6 13 movzbl (%ebx),%edx 1025: 83 c3 01 add $0x1,%ebx 1028: 84 d2 test %dl,%dl 102a: 74 24 je 1050 <printf+0x80> c = fmt[i] & 0xff; 102c: 0f b6 c2 movzbl %dl,%eax if(state == 0){ 102f: 85 c9 test %ecx,%ecx 1031: 74 cd je 1000 <printf+0x30> } } else if(state == '%'){ 1033: 83 f9 25 cmp $0x25,%ecx 1036: 75 ea jne 1022 <printf+0x52> if(c == 'd'){ 1038: 83 f8 25 cmp $0x25,%eax 103b: 0f 84 07 01 00 00 je 1148 <printf+0x178> 1041: 83 e8 63 sub $0x63,%eax 1044: 83 f8 15 cmp $0x15,%eax 1047: 77 17 ja 1060 <printf+0x90> 1049: ff 24 85 00 14 00 00 jmp *0x1400(,%eax,4) putc(fd, c); } state = 0; } } } 1050: 8d 65 f4 lea -0xc(%ebp),%esp 1053: 5b pop %ebx 1054: 5e pop %esi 1055: 5f pop %edi 1056: 5d pop %ebp 1057: c3 ret 1058: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 105f: 90 nop write(fd, &c, 1); 1060: 83 ec 04 sub $0x4,%esp 1063: 88 55 d4 mov %dl,-0x2c(%ebp) 1066: 6a 01 push $0x1 1068: 57 push %edi 1069: 56 push %esi 106a: c6 45 e7 25 movb $0x25,-0x19(%ebp) 106e: e8 f0 fd ff ff call e63 <write> putc(fd, c); 1073: 0f b6 55 d4 movzbl -0x2c(%ebp),%edx write(fd, &c, 1); 1077: 83 c4 0c add $0xc,%esp 107a: 88 55 e7 mov %dl,-0x19(%ebp) 107d: 6a 01 push $0x1 107f: 57 push %edi 1080: 56 push %esi 1081: e8 dd fd ff ff call e63 <write> putc(fd, c); 1086: 83 c4 10 add $0x10,%esp state = 0; 1089: 31 c9 xor %ecx,%ecx 108b: eb 95 jmp 1022 <printf+0x52> 108d: 8d 76 00 lea 0x0(%esi),%esi printint(fd, *ap, 16, 0); 1090: 83 ec 0c sub $0xc,%esp 1093: b9 10 00 00 00 mov $0x10,%ecx 1098: 6a 00 push $0x0 109a: 8b 45 d0 mov -0x30(%ebp),%eax 109d: 8b 10 mov (%eax),%edx 109f: 89 f0 mov %esi,%eax 10a1: e8 7a fe ff ff call f20 <printint> ap++; 10a6: 83 45 d0 04 addl $0x4,-0x30(%ebp) 10aa: 83 c4 10 add $0x10,%esp state = 0; 10ad: 31 c9 xor %ecx,%ecx 10af: e9 6e ff ff ff jmp 1022 <printf+0x52> 10b4: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi s = (char*)*ap; 10b8: 8b 45 d0 mov -0x30(%ebp),%eax 10bb: 8b 10 mov (%eax),%edx ap++; 10bd: 83 c0 04 add $0x4,%eax 10c0: 89 45 d0 mov %eax,-0x30(%ebp) if(s == 0) 10c3: 85 d2 test %edx,%edx 10c5: 0f 84 8d 00 00 00 je 1158 <printf+0x188> while(*s != 0){ 10cb: 0f b6 02 movzbl (%edx),%eax state = 0; 10ce: 31 c9 xor %ecx,%ecx while(*s != 0){ 10d0: 84 c0 test %al,%al 10d2: 0f 84 4a ff ff ff je 1022 <printf+0x52> 10d8: 89 5d d4 mov %ebx,-0x2c(%ebp) 10db: 89 d3 mov %edx,%ebx 10dd: 8d 76 00 lea 0x0(%esi),%esi write(fd, &c, 1); 10e0: 83 ec 04 sub $0x4,%esp s++; 10e3: 83 c3 01 add $0x1,%ebx 10e6: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 10e9: 6a 01 push $0x1 10eb: 57 push %edi 10ec: 56 push %esi 10ed: e8 71 fd ff ff call e63 <write> while(*s != 0){ 10f2: 0f b6 03 movzbl (%ebx),%eax 10f5: 83 c4 10 add $0x10,%esp 10f8: 84 c0 test %al,%al 10fa: 75 e4 jne 10e0 <printf+0x110> state = 0; 10fc: 8b 5d d4 mov -0x2c(%ebp),%ebx 10ff: 31 c9 xor %ecx,%ecx 1101: e9 1c ff ff ff jmp 1022 <printf+0x52> 1106: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 110d: 8d 76 00 lea 0x0(%esi),%esi printint(fd, *ap, 10, 1); 1110: 83 ec 0c sub $0xc,%esp 1113: b9 0a 00 00 00 mov $0xa,%ecx 1118: 6a 01 push $0x1 111a: e9 7b ff ff ff jmp 109a <printf+0xca> 111f: 90 nop putc(fd, *ap); 1120: 8b 45 d0 mov -0x30(%ebp),%eax write(fd, &c, 1); 1123: 83 ec 04 sub $0x4,%esp putc(fd, *ap); 1126: 8b 00 mov (%eax),%eax write(fd, &c, 1); 1128: 6a 01 push $0x1 112a: 57 push %edi 112b: 56 push %esi putc(fd, *ap); 112c: 88 45 e7 mov %al,-0x19(%ebp) write(fd, &c, 1); 112f: e8 2f fd ff ff call e63 <write> ap++; 1134: 83 45 d0 04 addl $0x4,-0x30(%ebp) 1138: 83 c4 10 add $0x10,%esp state = 0; 113b: 31 c9 xor %ecx,%ecx 113d: e9 e0 fe ff ff jmp 1022 <printf+0x52> 1142: 8d b6 00 00 00 00 lea 0x0(%esi),%esi putc(fd, c); 1148: 88 55 e7 mov %dl,-0x19(%ebp) write(fd, &c, 1); 114b: 83 ec 04 sub $0x4,%esp 114e: e9 2a ff ff ff jmp 107d <printf+0xad> 1153: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi 1157: 90 nop s = "(null)"; 1158: ba f8 13 00 00 mov $0x13f8,%edx while(*s != 0){ 115d: 89 5d d4 mov %ebx,-0x2c(%ebp) 1160: b8 28 00 00 00 mov $0x28,%eax 1165: 89 d3 mov %edx,%ebx 1167: e9 74 ff ff ff jmp 10e0 <printf+0x110> 116c: 66 90 xchg %ax,%ax 116e: 66 90 xchg %ax,%ax 00001170 <free>: static Header base; static Header *freep; void free(void *ap) { 1170: 55 push %ebp Header *bp, *p; bp = (Header*)ap - 1; for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1171: a1 c4 1a 00 00 mov 0x1ac4,%eax { 1176: 89 e5 mov %esp,%ebp 1178: 57 push %edi 1179: 56 push %esi 117a: 53 push %ebx 117b: 8b 5d 08 mov 0x8(%ebp),%ebx bp = (Header*)ap - 1; 117e: 8d 4b f8 lea -0x8(%ebx),%ecx for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr) 1181: 8d b4 26 00 00 00 00 lea 0x0(%esi,%eiz,1),%esi 1188: 89 c2 mov %eax,%edx 118a: 8b 00 mov (%eax),%eax 118c: 39 ca cmp %ecx,%edx 118e: 73 30 jae 11c0 <free+0x50> 1190: 39 c1 cmp %eax,%ecx 1192: 72 04 jb 1198 <free+0x28> if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 1194: 39 c2 cmp %eax,%edx 1196: 72 f0 jb 1188 <free+0x18> break; if(bp + bp->s.size == p->s.ptr){ 1198: 8b 73 fc mov -0x4(%ebx),%esi 119b: 8d 3c f1 lea (%ecx,%esi,8),%edi 119e: 39 f8 cmp %edi,%eax 11a0: 74 30 je 11d2 <free+0x62> bp->s.size += p->s.ptr->s.size; bp->s.ptr = p->s.ptr->s.ptr; 11a2: 89 43 f8 mov %eax,-0x8(%ebx) } else bp->s.ptr = p->s.ptr; if(p + p->s.size == bp){ 11a5: 8b 42 04 mov 0x4(%edx),%eax 11a8: 8d 34 c2 lea (%edx,%eax,8),%esi 11ab: 39 f1 cmp %esi,%ecx 11ad: 74 3a je 11e9 <free+0x79> p->s.size += bp->s.size; p->s.ptr = bp->s.ptr; 11af: 89 0a mov %ecx,(%edx) } else p->s.ptr = bp; freep = p; } 11b1: 5b pop %ebx freep = p; 11b2: 89 15 c4 1a 00 00 mov %edx,0x1ac4 } 11b8: 5e pop %esi 11b9: 5f pop %edi 11ba: 5d pop %ebp 11bb: c3 ret 11bc: 8d 74 26 00 lea 0x0(%esi,%eiz,1),%esi if(p >= p->s.ptr && (bp > p || bp < p->s.ptr)) 11c0: 39 c2 cmp %eax,%edx 11c2: 72 c4 jb 1188 <free+0x18> 11c4: 39 c1 cmp %eax,%ecx 11c6: 73 c0 jae 1188 <free+0x18> if(bp + bp->s.size == p->s.ptr){ 11c8: 8b 73 fc mov -0x4(%ebx),%esi 11cb: 8d 3c f1 lea (%ecx,%esi,8),%edi 11ce: 39 f8 cmp %edi,%eax 11d0: 75 d0 jne 11a2 <free+0x32> bp->s.size += p->s.ptr->s.size; 11d2: 03 70 04 add 0x4(%eax),%esi 11d5: 89 73 fc mov %esi,-0x4(%ebx) bp->s.ptr = p->s.ptr->s.ptr; 11d8: 8b 02 mov (%edx),%eax 11da: 8b 00 mov (%eax),%eax 11dc: 89 43 f8 mov %eax,-0x8(%ebx) if(p + p->s.size == bp){ 11df: 8b 42 04 mov 0x4(%edx),%eax 11e2: 8d 34 c2 lea (%edx,%eax,8),%esi 11e5: 39 f1 cmp %esi,%ecx 11e7: 75 c6 jne 11af <free+0x3f> p->s.size += bp->s.size; 11e9: 03 43 fc add -0x4(%ebx),%eax freep = p; 11ec: 89 15 c4 1a 00 00 mov %edx,0x1ac4 p->s.size += bp->s.size; 11f2: 89 42 04 mov %eax,0x4(%edx) p->s.ptr = bp->s.ptr; 11f5: 8b 4b f8 mov -0x8(%ebx),%ecx 11f8: 89 0a mov %ecx,(%edx) } 11fa: 5b pop %ebx 11fb: 5e pop %esi 11fc: 5f pop %edi 11fd: 5d pop %ebp 11fe: c3 ret 11ff: 90 nop 00001200 <malloc>: return freep; } void* malloc(uint nbytes) { 1200: 55 push %ebp 1201: 89 e5 mov %esp,%ebp 1203: 57 push %edi 1204: 56 push %esi 1205: 53 push %ebx 1206: 83 ec 1c sub $0x1c,%esp Header *p, *prevp; uint nunits; nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1209: 8b 45 08 mov 0x8(%ebp),%eax if((prevp = freep) == 0){ 120c: 8b 3d c4 1a 00 00 mov 0x1ac4,%edi nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1; 1212: 8d 70 07 lea 0x7(%eax),%esi 1215: c1 ee 03 shr $0x3,%esi 1218: 83 c6 01 add $0x1,%esi if((prevp = freep) == 0){ 121b: 85 ff test %edi,%edi 121d: 0f 84 9d 00 00 00 je 12c0 <malloc+0xc0> base.s.ptr = freep = prevp = &base; base.s.size = 0; } for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1223: 8b 17 mov (%edi),%edx if(p->s.size >= nunits){ 1225: 8b 4a 04 mov 0x4(%edx),%ecx 1228: 39 f1 cmp %esi,%ecx 122a: 73 6a jae 1296 <malloc+0x96> 122c: bb 00 10 00 00 mov $0x1000,%ebx 1231: 39 de cmp %ebx,%esi 1233: 0f 43 de cmovae %esi,%ebx p = sbrk(nu * sizeof(Header)); 1236: 8d 04 dd 00 00 00 00 lea 0x0(,%ebx,8),%eax 123d: 89 45 e4 mov %eax,-0x1c(%ebp) 1240: eb 17 jmp 1259 <malloc+0x59> 1242: 8d b6 00 00 00 00 lea 0x0(%esi),%esi for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 1248: 8b 02 mov (%edx),%eax if(p->s.size >= nunits){ 124a: 8b 48 04 mov 0x4(%eax),%ecx 124d: 39 f1 cmp %esi,%ecx 124f: 73 4f jae 12a0 <malloc+0xa0> p->s.size = nunits; } freep = prevp; return (void*)(p + 1); } if(p == freep) 1251: 8b 3d c4 1a 00 00 mov 0x1ac4,%edi 1257: 89 c2 mov %eax,%edx 1259: 39 d7 cmp %edx,%edi 125b: 75 eb jne 1248 <malloc+0x48> p = sbrk(nu * sizeof(Header)); 125d: 83 ec 0c sub $0xc,%esp 1260: ff 75 e4 push -0x1c(%ebp) 1263: e8 63 fc ff ff call ecb <sbrk> if(p == (char*)-1) 1268: 83 c4 10 add $0x10,%esp 126b: 83 f8 ff cmp $0xffffffff,%eax 126e: 74 1c je 128c <malloc+0x8c> hp->s.size = nu; 1270: 89 58 04 mov %ebx,0x4(%eax) free((void*)(hp + 1)); 1273: 83 ec 0c sub $0xc,%esp 1276: 83 c0 08 add $0x8,%eax 1279: 50 push %eax 127a: e8 f1 fe ff ff call 1170 <free> return freep; 127f: 8b 15 c4 1a 00 00 mov 0x1ac4,%edx if((p = morecore(nunits)) == 0) 1285: 83 c4 10 add $0x10,%esp 1288: 85 d2 test %edx,%edx 128a: 75 bc jne 1248 <malloc+0x48> return 0; } } 128c: 8d 65 f4 lea -0xc(%ebp),%esp return 0; 128f: 31 c0 xor %eax,%eax } 1291: 5b pop %ebx 1292: 5e pop %esi 1293: 5f pop %edi 1294: 5d pop %ebp 1295: c3 ret if(p->s.size >= nunits){ 1296: 89 d0 mov %edx,%eax 1298: 89 fa mov %edi,%edx 129a: 8d b6 00 00 00 00 lea 0x0(%esi),%esi if(p->s.size == nunits) 12a0: 39 ce cmp %ecx,%esi 12a2: 74 4c je 12f0 <malloc+0xf0> p->s.size -= nunits; 12a4: 29 f1 sub %esi,%ecx 12a6: 89 48 04 mov %ecx,0x4(%eax) p += p->s.size; 12a9: 8d 04 c8 lea (%eax,%ecx,8),%eax p->s.size = nunits; 12ac: 89 70 04 mov %esi,0x4(%eax) freep = prevp; 12af: 89 15 c4 1a 00 00 mov %edx,0x1ac4 } 12b5: 8d 65 f4 lea -0xc(%ebp),%esp return (void*)(p + 1); 12b8: 83 c0 08 add $0x8,%eax } 12bb: 5b pop %ebx 12bc: 5e pop %esi 12bd: 5f pop %edi 12be: 5d pop %ebp 12bf: c3 ret base.s.ptr = freep = prevp = &base; 12c0: c7 05 c4 1a 00 00 c8 movl $0x1ac8,0x1ac4 12c7: 1a 00 00 base.s.size = 0; 12ca: bf c8 1a 00 00 mov $0x1ac8,%edi base.s.ptr = freep = prevp = &base; 12cf: c7 05 c8 1a 00 00 c8 movl $0x1ac8,0x1ac8 12d6: 1a 00 00 for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){ 12d9: 89 fa mov %edi,%edx base.s.size = 0; 12db: c7 05 cc 1a 00 00 00 movl $0x0,0x1acc 12e2: 00 00 00 if(p->s.size >= nunits){ 12e5: e9 42 ff ff ff jmp 122c <malloc+0x2c> 12ea: 8d b6 00 00 00 00 lea 0x0(%esi),%esi prevp->s.ptr = p->s.ptr; 12f0: 8b 08 mov (%eax),%ecx 12f2: 89 0a mov %ecx,(%edx) 12f4: eb b9 jmp 12af <malloc+0xaf>
Transynther/x86/_processed/NONE/_xt_/i9-9900K_12_0xa0_notsx.log_21829_182.asm
ljhsiun2/medusa
9
19507
.global s_prepare_buffers s_prepare_buffers: push %r10 push %r14 push %r8 push %rax push %rcx push %rdx lea addresses_normal_ht+0x1113d, %rdx nop nop nop nop sub $62267, %r14 movups (%rdx), %xmm6 vpextrq $0, %xmm6, %rax nop nop nop nop nop and $65025, %r10 lea addresses_D_ht+0x1587d, %r8 nop nop nop xor %rdx, %rdx vmovups (%r8), %ymm0 vextracti128 $0, %ymm0, %xmm0 vpextrq $1, %xmm0, %rcx nop nop nop xor $24737, %rdx pop %rdx pop %rcx pop %rax pop %r8 pop %r14 pop %r10 ret .global s_faulty_load s_faulty_load: push %r13 push %r8 push %rax push %rbp push %rbx push %rdx // Store lea addresses_UC+0xda65, %rax nop nop cmp $24446, %rbx mov $0x5152535455565758, %rdx movq %rdx, (%rax) nop sub $39183, %rax // Store lea addresses_UC+0x173d, %rax add %r13, %r13 movw $0x5152, (%rax) nop nop nop sub $27733, %rbx // Faulty Load lea addresses_D+0x373d, %rdx nop nop nop cmp $37158, %rbp vmovups (%rdx), %ymm2 vextracti128 $1, %ymm2, %xmm2 vpextrq $0, %xmm2, %r8 lea oracles, %rbp and $0xff, %r8 shlq $12, %r8 mov (%rbp,%r8,1), %r8 pop %rdx pop %rbx pop %rbp pop %rax pop %r8 pop %r13 ret /* <gen_faulty_load> [REF] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 0}, 'OP': 'LOAD'} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 8, 'NT': False, 'same': False, 'congruent': 3}} {'OP': 'STOR', 'dst': {'type': 'addresses_UC', 'AVXalign': False, 'size': 2, 'NT': False, 'same': False, 'congruent': 11}} [Faulty Load] {'src': {'type': 'addresses_D', 'AVXalign': False, 'size': 32, 'NT': False, 'same': True, 'congruent': 0}, 'OP': 'LOAD'} <gen_prepare_buffer> {'src': {'type': 'addresses_normal_ht', 'AVXalign': False, 'size': 16, 'NT': False, 'same': False, 'congruent': 8}, 'OP': 'LOAD'} {'src': {'type': 'addresses_D_ht', 'AVXalign': False, 'size': 32, 'NT': False, 'same': False, 'congruent': 6}, 'OP': 'LOAD'} {'36': 21829} 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 36 */
source/amf/mof/cmof/amf-cmof-namespaces-collections.ads
svn2github/matreshka
24
18091
<filename>source/amf/mof/cmof/amf-cmof-namespaces-collections.ads ------------------------------------------------------------------------------ -- -- -- Matreshka Project -- -- -- -- Ada Modeling Framework -- -- -- -- Runtime Library Component -- -- -- ------------------------------------------------------------------------------ -- -- -- Copyright © 2011-2012, <NAME> <<EMAIL>> -- -- All rights reserved. -- -- -- -- Redistribution and use in source and binary forms, with or without -- -- modification, are permitted provided that the following conditions -- -- are met: -- -- -- -- * Redistributions of source code must retain the above copyright -- -- notice, this list of conditions and the following disclaimer. -- -- -- -- * Redistributions in binary form must reproduce the above copyright -- -- notice, this list of conditions and the following disclaimer in the -- -- documentation and/or other materials provided with the distribution. -- -- -- -- * Neither the name of the Vadim Godunko, IE nor the names of its -- -- contributors may be used to endorse or promote products derived from -- -- this software without specific prior written permission. -- -- -- -- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- -- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- -- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- -- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- -- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- -- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- -- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- -- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- -- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- -- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- -- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- -- -- ------------------------------------------------------------------------------ -- $Revision$ $Date$ ------------------------------------------------------------------------------ -- This file is generated, don't edit it. ------------------------------------------------------------------------------ with AMF.Generic_Collections; package AMF.CMOF.Namespaces.Collections is pragma Preelaborate; package CMOF_Namespace_Collections is new AMF.Generic_Collections (CMOF_Namespace, CMOF_Namespace_Access); type Set_Of_CMOF_Namespace is new CMOF_Namespace_Collections.Set with null record; Empty_Set_Of_CMOF_Namespace : constant Set_Of_CMOF_Namespace; type Ordered_Set_Of_CMOF_Namespace is new CMOF_Namespace_Collections.Ordered_Set with null record; Empty_Ordered_Set_Of_CMOF_Namespace : constant Ordered_Set_Of_CMOF_Namespace; type Bag_Of_CMOF_Namespace is new CMOF_Namespace_Collections.Bag with null record; Empty_Bag_Of_CMOF_Namespace : constant Bag_Of_CMOF_Namespace; type Sequence_Of_CMOF_Namespace is new CMOF_Namespace_Collections.Sequence with null record; Empty_Sequence_Of_CMOF_Namespace : constant Sequence_Of_CMOF_Namespace; private Empty_Set_Of_CMOF_Namespace : constant Set_Of_CMOF_Namespace := (CMOF_Namespace_Collections.Set with null record); Empty_Ordered_Set_Of_CMOF_Namespace : constant Ordered_Set_Of_CMOF_Namespace := (CMOF_Namespace_Collections.Ordered_Set with null record); Empty_Bag_Of_CMOF_Namespace : constant Bag_Of_CMOF_Namespace := (CMOF_Namespace_Collections.Bag with null record); Empty_Sequence_Of_CMOF_Namespace : constant Sequence_Of_CMOF_Namespace := (CMOF_Namespace_Collections.Sequence with null record); end AMF.CMOF.Namespaces.Collections;
esame_20210702/multiplo/conta_multipli.asm
samdsk/lab_arch2
0
164403
.text .globl conta_multipli conta_multipli: move $t0 $fp addi $fp $sp -4 sw $t0 0($fp) sw $sp -4($fp) sw $ra -8($fp) sw $s0 -12($fp) add $sp $fp -12 move $s1 $a0 move $s2 $a1 move $t2 $a2 # N li $s0 0 #ultima pos del array addi $a2 $a2 -1 mul $t3 $a2 4 #4x5 add $s1 $s1 $t3 add $s2 $s2 $t3 loop: blt $a2 $0 exit lw $a0 0($s1) lw $a1 0($s2) addi $s1 $s1 -4 addi $s2 $s2 -4 jal multiplo add $s0 $s0 $v0 addi $a2 $a2 -1 j loop exit: move $v0 $s0 lw $t0 0($fp) lw $sp -4($fp) lw $ra -8($fp) lw $s0 -12($fp) move $fp $t0 jr $ra
util.asm
maikmerten/tinyload
5
161850
<filename>util.asm<gh_stars>1-10 .proc util_clear_arg1 lda #0 sta ARG1 sta ARG1+1 sta ARG1+2 sta ARG1+3 rts .endproc
Task/Permutations/Ada/permutations-2.ada
LaudateCorpus1/RosettaCodeData
1
4007
package body Generic_Perm is procedure Set_To_First(P: out Permutation; Is_Last: out Boolean) is begin for I in P'Range loop P (I) := I; end loop; Is_Last := P'Length = 1; -- if P has a single element, the fist permutation is the last one end Set_To_First; procedure Go_To_Next(P: in out Permutation; Is_Last: out Boolean) is procedure Swap (A, B : in out Integer) is C : Integer := A; begin A := B; B := C; end Swap; I, J, K : Element; begin -- find longest tail decreasing sequence -- after the loop, this sequence is I+1 .. n, -- and the ith element will be exchanged later -- with some element of the tail Is_Last := True; I := N - 1; loop if P (I) < P (I+1) then Is_Last := False; exit; end if; -- next instruction will raise an exception if I = 1, so -- exit now (this is the last permutation) exit when I = 1; I := I - 1; end loop; -- if all the elements of the permutation are in -- decreasing order, this is the last one if Is_Last then return; end if; -- sort the tail, i.e. reverse it, since it is in decreasing order J := I + 1; K := N; while J < K loop Swap (P (J), P (K)); J := J + 1; K := K - 1; end loop; -- find lowest element in the tail greater than the ith element J := N; while P (J) > P (I) loop J := J - 1; end loop; J := J + 1; -- exchange them -- this will give the next permutation in lexicographic order, -- since every element from ith to the last is minimum Swap (P (I), P (J)); end Go_To_Next; end Generic_Perm;
oeis/001/A001748.asm
neoneye/loda-programs
11
240407
; A001748: 3 * primes. ; Submitted by <NAME>(s3) ; 6,9,15,21,33,39,51,57,69,87,93,111,123,129,141,159,177,183,201,213,219,237,249,267,291,303,309,321,327,339,381,393,411,417,447,453,471,489,501,519,537,543,573,579,591,597,633,669,681,687,699,717,723,753,771,789,807,813,831,843,849,879,921,933,939,951,993,1011,1041,1047,1059,1077,1101,1119,1137,1149,1167,1191,1203,1227,1257,1263,1293,1299,1317,1329,1347,1371,1383,1389,1401,1437,1461,1473,1497,1509,1527,1563,1569,1623 mul $0,2 max $0,1 seq $0,173919 ; Numbers that are prime or one less than a prime. mul $0,3
test/fail/IrrelevantRecordField.agda
asr/agda-kanso
1
13760
<filename>test/fail/IrrelevantRecordField.agda module IrrelevantRecordField where import Common.Irrelevance record R (A : Set) : Set where constructor inn field .out : A proj : {A : Set} -> R A -> A proj (inn a) = a -- needs to fail, since a is irrelevant under inn
3-mid/impact/source/3d/impact-d3-object.adb
charlie5/lace
20
2731
with impact.d3.Transform; package body impact.d3.Object is procedure define (Self : in out Item) is use impact.d3.Transform; begin Self.m_anisotropicFriction := (1.0, 1.0, 1.0); Self.m_hasAnisotropicFriction := False; Self.m_contactProcessingThreshold := math.Real'Last; Self.m_collisionFlags := CF_STATIC_OBJECT; Self.m_islandTag1 := -1; Self.m_companionId := -1; Self.m_activationState1 := 1; Self.m_deactivationTime := 0.0; Self.m_friction := 0.5; Self.m_restitution := 0.0; Self.m_internalType := CO_COLLISION_OBJECT; Self.m_hitFraction := 1.0; Self.m_ccdSweptSphereRadius := 0.0; Self.m_ccdMotionThreshold := 0.0; Self.m_checkCollideWith := False; setIdentity (Self.m_worldTransform); end define; procedure destruct (Self : in out Item) is begin null; end destruct; function mergesSimulationIslands (Self : in Item) return Boolean is begin -- Static objects, kinematic and object without contact response don't merge islands. -- return ( Self.m_collisionFlags and ( CF_STATIC_OBJECT or CF_KINEMATIC_OBJECT or CF_NO_CONTACT_RESPONSE)) = 0; end mergesSimulationIslands; function getAnisotropicFriction (Self : in Item) return math.Vector_3 is begin return Self.m_anisotropicFriction; end getAnisotropicFriction; function getBroadphaseHandle (Self : access Item) return access impact.d3.collision.Proxy.item'Class is begin return Self.m_broadphaseHandle; end getBroadphaseHandle; procedure setBroadphaseHandle (Self : in out Item; To : access impact.d3.collision.Proxy.item'Class) is begin Self.m_broadphaseHandle := To; end setBroadphaseHandle; function checkCollideWithOverride (Self : in Item; co : access Item'Class) return Boolean is pragma Unreferenced (Self, co); begin return False; end checkCollideWithOverride; function getWorldTransform (Self : access Item) return access Transform_3d is begin for row in 1 .. 3 loop for col in 1 .. 3 loop if not Self.m_worldTransform.Rotation (row, col)'Valid then raise Constraint_Error; end if; end loop; end loop; return Self.m_worldTransform'Unchecked_Access; end getWorldTransform; function WorldTransform (Self : in Item) return Transform_3d is begin for row in 1 .. 3 loop for col in 1 .. 3 loop if not Self.m_worldTransform.Rotation (row, col)'Valid then raise Constraint_Error; end if; end loop; end loop; return Self.m_worldTransform; end WorldTransform; function getFriction (Self : in Item) return math.Real is begin return Self.m_friction; end getFriction; function getRestitution (Self : in Item) return math.Real is begin return Self.m_restitution; end getRestitution; function getCollisionFlags (Self : in Item) return Flags is begin return Self.m_collisionFlags; end getCollisionFlags; function getCollisionShape (Self : in Item) return access impact.d3.Shape.item'Class is begin return Self.m_collisionShape; end getCollisionShape; procedure setAnisotropicFriction (Self : in out Item; To : in math.Vector_3) is begin Self.m_anisotropicFriction := To; Self.m_hasAnisotropicFriction := (To (1) /= 1.0) or else (To (2) /= 1.0) or else (To (3) /= 1.0); end setAnisotropicFriction; function hasAnisotropicFriction (Self : in Item) return Boolean is begin return Self.m_hasAnisotropicFriction; end hasAnisotropicFriction; procedure setContactProcessingThreshold (Self : in out Item; To : in math.Real) is begin Self.m_contactProcessingThreshold := To; end setContactProcessingThreshold; function getContactProcessingThreshold (Self : in Item) return math.Real is begin return Self.m_contactProcessingThreshold; end getContactProcessingThreshold; function isStaticObject (Self : in Item) return Boolean is begin return (Self.m_collisionFlags and CF_STATIC_OBJECT) /= 0; end isStaticObject; function isKinematicObject (Self : in Item) return Boolean is begin return (Self.m_collisionFlags and CF_KINEMATIC_OBJECT) /= 0; end isKinematicObject; function isStaticOrKinematicObject (Self : in Item) return Boolean is begin return (Self.m_collisionFlags and (CF_KINEMATIC_OBJECT or CF_STATIC_OBJECT)) /= 0; end isStaticOrKinematicObject; function hasContactResponse (Self : in Item) return Boolean is begin return (Self.m_collisionFlags and CF_NO_CONTACT_RESPONSE) = 0; end hasContactResponse; procedure setCollisionShape (Self : in out Item; To : access impact.d3.Shape.item'Class) is begin Self.m_collisionShape := To; Self.m_rootCollisionShape := To; end setCollisionShape; function getRootCollisionShape (Self : in Item) return access impact.d3.Shape.item'Class is begin return Self.m_rootCollisionShape; end getRootCollisionShape; procedure internalSetTemporaryCollisionShape (Self : in out Item; To : access impact.d3.Shape.item'Class) is begin Self.m_collisionShape := To; end internalSetTemporaryCollisionShape; function internalGetExtensionPointer (Self : in Item) return access Any'Class is begin return Self.m_extensionPointer; end internalGetExtensionPointer; procedure internalSetExtensionPointer (Self : in out Item; To : access Any'Class) is begin Self.m_extensionPointer := To; end internalSetExtensionPointer; function getActivationState (Self : in Item) return Integer is begin return Self.m_activationState1; end getActivationState; -- void setActivationState(int newState); -- procedure setDeactivationTime (Self : in out Item; To : in math.Real) is begin Self.m_deactivationTime := To; end setDeactivationTime; function getDeactivationTime (Self : in Item) return math.Real is begin return Self.m_deactivationTime; end getDeactivationTime; procedure setActivationState (Self : in out Item; To : in Integer) is begin -- if To = 3 then -- put_Line ("H"); -- end if; -- put_Line ("new activation state => " & Integer'Image (To)); if (Self.m_activationState1 /= DISABLE_DEACTIVATION) and then (Self.m_activationState1 /= DISABLE_SIMULATION) then Self.m_activationState1 := To; end if; end setActivationState; procedure forceActivationState (Self : in out Item; To : in Integer) is begin Self.m_activationState1 := To; end forceActivationState; procedure activate (Self : in out Item; forceActivation : in Boolean := False) is begin if forceActivation or else (( Self.m_collisionFlags and (CF_STATIC_OBJECT or CF_KINEMATIC_OBJECT)) = 0) then Self.setActivationState (ACTIVE_TAG); Self.m_deactivationTime := 0.0; end if; end activate; function isActive (Self : in Item) return Boolean is begin return ((Self.getActivationState /= ISLAND_SLEEPING) and then (Self.getActivationState /= DISABLE_SIMULATION)); end isActive; procedure setRestitution (Self : in out Item; To : in math.Real) is begin Self.m_restitution := To; end setRestitution; procedure setFriction (Self : in out Item; To : in math.Real) is begin Self.m_friction := To; end setFriction; function getInternalType (Self : in Item) return Flags is begin return Self.m_internalType; end getInternalType; procedure setInternalType (Self : out Item; To : in Flags) is begin Self.m_internalType := To; end setInternalType; procedure setWorldTransform (Self : in out Item; To : in Transform_3d) is begin Self.m_worldTransform := To; end setWorldTransform; function getInterpolationWorldTransform (Self : access Item) return access Transform_3d is begin return Self.m_interpolationWorldTransform'Access; end getInterpolationWorldTransform; function getInterpolationWorldTransform (Self : in Item) return Transform_3d is begin return Self.m_interpolationWorldTransform; end getInterpolationWorldTransform; procedure setInterpolationWorldTransform (Self : in out Item; To : in Transform_3d) is begin Self.m_interpolationWorldTransform := To; end setInterpolationWorldTransform; procedure setInterpolationLinearVelocity (Self : in out Item; To : in math.Vector_3) is begin Self.m_interpolationLinearVelocity := To; end setInterpolationLinearVelocity; procedure setInterpolationAngularVelocity (Self : in out Item; To : in math.Vector_3) is begin Self.m_interpolationAngularVelocity := To; end setInterpolationAngularVelocity; function getInterpolationLinearVelocity (Self : in Item) return math.Vector_3 is begin return Self.m_interpolationLinearVelocity; end getInterpolationLinearVelocity; function getInterpolationAngularVelocity (Self : in Item) return math.Vector_3 is begin return Self.m_interpolationAngularVelocity; end getInterpolationAngularVelocity; function getIslandTag (Self : in Item) return Integer is begin return Self.m_islandTag1; end getIslandTag; procedure setIslandTag (Self : in out Item; To : in Integer) is begin Self.m_islandTag1 := To; end setIslandTag; function getCompanionId (Self : in Item) return Integer is begin return Self.m_companionId; end getCompanionId; procedure setCompanionId (Self : in out Item; To : in Integer) is begin Self.m_companionId := To; end setCompanionId; function getHitFraction (Self : in Item) return math.Real is begin return Self.m_hitFraction; end getHitFraction; procedure setHitFraction (Self : in out Item; To : in math.Real) is begin Self.m_hitFraction := To; end setHitFraction; procedure setCollisionFlags (Self : in out Item; To : in Flags) is begin Self.m_collisionFlags := To; end setCollisionFlags; function getCcdSweptSphereRadius (Self : in Item) return math.Real is begin return Self.m_ccdSweptSphereRadius; end getCcdSweptSphereRadius; procedure setCcdSweptSphereRadius (Self : in out Item; To : in math.Real) is begin Self.m_ccdSweptSphereRadius := To; end setCcdSweptSphereRadius; function getCcdMotionThreshold (Self : in Item) return math.Real is begin return Self.m_ccdMotionThreshold; end getCcdMotionThreshold; function getCcdSquareMotionThreshold (Self : in Item) return math.Real is begin return Self.m_ccdMotionThreshold * Self.m_ccdMotionThreshold; end getCcdSquareMotionThreshold; procedure setCcdMotionThreshold (Self : in out Item; To : in math.Real) is begin Self.m_ccdMotionThreshold := To; end setCcdMotionThreshold; function getUserPointer (Self : in Item) return access Any'Class is begin return Self.m_userObjectPointer; end getUserPointer; procedure setUserPointer (Self : in out Item; To : access Any'Class) is begin Self.m_userObjectPointer := To; end setUserPointer; function checkCollideWith (Self : in Item; co : access Item'Class) return Boolean is begin if Self.m_checkCollideWith then return Self.checkCollideWithOverride (co); end if; return True; end checkCollideWith; procedure setCheckCollideWith (Self : in out Item; To : in Boolean) is begin Self.m_checkCollideWith := To; end setCheckCollideWith; end impact.d3.Object;
programs/oeis/128/A128093.asm
neoneye/loda
22
23255
<filename>programs/oeis/128/A128093.asm ; A128093: a(n) = smallest multiple of n which is >= 2^n. ; 2,4,9,16,35,66,133,256,513,1030,2057,4104,8203,16394,32775,65536,131087,262152,524305,1048580,2097165,4194322,8388629,16777224,33554450,67108886,134217729,268435468,536870939,1073741850,2147483677,4294967296,8589934617,17179869214,34359738385,68719476744,137438953507,274877906978,549755813919,1099511627800,2199023255591,4398046511124,8796093022249,17592186044444,35184372088860,70368744177706,140737488355373,281474976710688,562949953421331,1125899906842650,2251799813685291,4503599627370532,9007199254741043,18014398509482010,36028797018963980,72057594037927960,144115188075855921,288230376151711798,576460752303423545,1152921504606847020,2305843009213694011,4611686018427387962,9223372036854775863,18446744073709551616,36893488147419103265,73786976294838206466,147573952589676412993,295147905179352825908,590295810358705651773,1180591620717411303450,2361183241434822606917,4722366482869645213704,9444732965739290427463,18889465931478580854854,37778931862957161709575,75557863725914323419196,151115727451828646838331,302231454903657293676558,604462909807314587353165,1208925819614629174706240,2417851639229258349412353,4835703278458516698824782,9671406556917033397649489,19342813113834066795298836,38685626227668133590597685,77371252455336267181195346,154742504910672534362390607,309485009821345068724781064,618970019642690137449562199,1237940039285380274899124250,2475880078570760549798248502,4951760157141521099596496972,9903520314283042199192993877,19807040628566084398385987674,39614081257132168796771975250,79228162514264337593543950368,158456325028528675187087900767,316912650057057350374175801424,633825300114114700748351602770,1267650600228229401496703205400 add $0,1 mov $1,$0 mov $2,2 pow $2,$0 sub $2,1 div $2,$0 mul $0,$2 add $0,$1
icalendar/ICalendar.g4
ChristianWulf/grammars-v4
28
6191
<reponame>ChristianWulf/grammars-v4<gh_stars>10-100 /* * The MIT License (MIT) * * Copyright (c) 2013-2014 by <NAME> * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, * copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ /* * An iCalendar grammar for ANTLR v4 based on: * https://tools.ietf.org/html/rfc5545 * * For more information, and unit tests, see the GitHub repository: * https://github.com/bkiers/ICalParser */ grammar ICalendar; ////////////////////////////// parser rules ////////////////////////////// parse : icalstream EOF ; // 3.4 - iCalendar Object icalstream : CRLF* icalobject (CRLF+ icalobject)* CRLF* ; icalobject : k_begin COL k_vcalendar CRLF calprop*? component+? k_end COL k_vcalendar ; calprop : prodid | version | calscale | method | x_prop | iana_prop ; // 3.7.1 - Calendar Scale calscale : k_calscale (SCOL other_param)* COL k_gregorian CRLF ; // 3.7.2 - Method method : k_method (SCOL other_param)* COL iana_token CRLF ; // 3.7.3 - Product Identifier prodid : k_prodid (SCOL other_param)* COL text CRLF ; // 3.7.4 - Version version : k_version (SCOL other_param)* COL vervalue CRLF ; vervalue : float_num SCOL float_num | float_num ; component : eventc | todoc | journalc | freebusyc | timezonec | iana_comp | x_comp ; iana_comp : k_begin COL iana_token CRLF contentline+? k_end COL iana_token CRLF ; x_comp : k_begin COL x_name CRLF contentline+? k_end COL x_name CRLF ; contentline : name (SCOL icalparameter)* COL value CRLF ; name : iana_token | x_name ; value : value_char* ; // 3.6.1 - Event Component eventc : k_begin COL k_vevent CRLF eventprop*? alarmc*? k_end COL k_vevent CRLF ; // 3.6.2 - To-Do Component todoc : k_begin COL k_vtodo CRLF todoprop*? alarmc*? k_end COL k_vtodo CRLF ; // 3.6.3 - Journal Component journalc : k_begin COL k_vjournal CRLF jourprop*? k_end COL k_vjournal CRLF ; // 3.6.4 - Free/Busy Component freebusyc : k_begin COL k_vfreebusy CRLF fbprop*? k_end COL k_vfreebusy CRLF ; // 3.6.5 - Time Zone Component timezonec : k_begin COL k_vtimezone CRLF timezoneprop*? k_end COL k_vtimezone CRLF ; // 3.6.6 - Alarm Component alarmc : k_begin COL k_valarm CRLF alarmprop+? k_end COL k_valarm CRLF ; eventprop : dtstamp | uid | dtstart | clazz | created | description | geo | last_mod | location | organizer | priority | seq | status | summary | transp | url | recurid | rrule | dtend | duration | attach | attendee | categories | comment | contact | exdate | rstatus | related | resources | rdate | x_prop | iana_prop ; todoprop : dtstamp | uid | clazz | completed | created | description | dtstart | geo | last_mod | location | organizer | percent | priority | recurid | seq | status | summary | url | rrule | due | duration | attach | attendee | categories | comment | contact | exdate | rstatus | related | resources | rdate | x_prop | iana_prop ; jourprop : dtstamp | uid | clazz | created | dtstart | last_mod | organizer | recurid | seq | status | summary | url | rrule | attach | attendee | categories | comment | contact | description | exdate | related | rdate | rstatus | x_prop | iana_prop ; fbprop : dtstamp | uid | contact | dtstart | dtend | organizer | url | attendee | comment | freebusy | rstatus | x_prop | iana_prop ; timezoneprop : tzid | last_mod | tzurl | standardc | daylightc | x_prop | iana_prop ; tzprop : dtstart | tzoffsetto | tzoffsetfrom | rrule | comment | rdate | tzname | x_prop | iana_prop ; alarmprop : action | description | trigger | summary | attendee | duration | repeat | attach | x_prop | iana_prop ; standardc : k_begin COL k_standard CRLF tzprop*? k_end COL k_standard CRLF ; daylightc : k_begin COL k_daylight CRLF tzprop*? k_end COL k_daylight CRLF ; // 3.8.1.1 - Attachment attach : k_attach attachparam* ( COL uri | SCOL k_encoding ASSIGN k_base D6 D4 SCOL k_value ASSIGN k_binary COL binary ) CRLF ; attachparam : SCOL fmttypeparam | SCOL other_param ; // 3.8.1.2 - Categories categories : k_categories catparam* COL text (COMMA text)* CRLF ; catparam : SCOL languageparam | SCOL other_param ; // 3.8.1.3 - Classification clazz : k_class (SCOL other_param)* COL classvalue CRLF ; classvalue : k_public | k_private | k_confidential | iana_token | x_name ; // 3.8.1.4 - Comment comment : k_comment commparam* COL text CRLF ; commparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 3.8.1.5 - Description description : k_description descparam* COL text CRLF ; descparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 3.8.1.6 - Geographic Position geo : k_geo (SCOL other_param)* COL geovalue CRLF ; geovalue : float_num SCOL float_num ; // 3.8.1.7 - Location location : k_location locparam* COL text CRLF ; locparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 3.8.1.8 - Percent Complete percent : k_percent_complete (SCOL other_param)* COL integer CRLF ; // 3.8.1.9 - Priority priority : k_priority (SCOL other_param)* COL priovalue CRLF ; priovalue : integer ; // 172.16.17.32 - Resources resources : k_resources resrcparam* COL text (COMMA text)* CRLF ; resrcparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 192.168.127.12 - Status status : k_status (SCOL other_param)* COL statvalue CRLF ; statvalue : statvalue_event | statvalue_todo | statvalue_jour ; statvalue_event : k_tentative | k_confirmed | k_cancelled ; statvalue_todo : k_needs_action | k_completed | k_in_progress | k_cancelled ; statvalue_jour : k_draft | k_final | k_cancelled ; // 3.8.1.12 - Summary summary : k_summary summparam* COL text CRLF ; summparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 3.8.2.1 - Date-Time Completed completed : k_completed (SCOL other_param)* COL date_time CRLF ; // 3.8.2.2 - Date-Time End dtend : k_dtend dtendparam* COL date_time_date CRLF ; dtendparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL tzidparam | SCOL other_param ; // 3.8.2.3 - Date-Time Due due : k_due dueparam* COL date_time_date CRLF ; dueparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL tzidparam | SCOL other_param ; // 3.8.2.4 - Date-Time Start dtstart : k_dtstart dtstparam* COL date_time_date CRLF ; dtstparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL tzidparam | SCOL other_param ; // 3.8.2.5 - Duration duration : k_duration (SCOL other_param)* COL dur_value CRLF ; // 3.8.2.6 - Free/Busy Time freebusy : k_freebusy fbparam* COL fbvalue CRLF ; fbparam : SCOL fbtypeparam | SCOL other_param ; fbvalue : period (COMMA period)* ; // 3.8.2.7 - Time Transparency transp : k_transp (SCOL other_param)* COL transvalue CRLF ; transvalue : k_opaque | k_transparent ; // 3.8.3.1 - Time Zone Identifier tzid : k_tzid (SCOL other_param)* COL FSLASH? text CRLF ; // 3.8.3.2. Time Zone Name tzname : k_tzname tznparam* COL text CRLF ; tznparam : SCOL languageparam | SCOL other_param ; // 3.8.3.3 - Time Zone Offset From tzoffsetfrom : k_tzoffsetfrom (SCOL other_param)* COL utc_offset CRLF ; // 3.8.3.4 - Time Zone Offset To tzoffsetto : k_tzoffsetto (SCOL other_param)* COL utc_offset CRLF ; // 3.8.3.5. Time Zone URL tzurl : k_tzurl (SCOL other_param)* COL uri CRLF ; // 3.8.4.1 - Attendee attendee : k_attendee attparam* COL cal_address CRLF ; attparam : SCOL cutypeparam | SCOL memberparam | SCOL roleparam | SCOL partstatparam | SCOL rsvpparam | SCOL deltoparam | SCOL delfromparam | SCOL sentbyparam | SCOL cnparam | SCOL dirparam | SCOL languageparam | SCOL other_param ; // 3.8.4.2 - Contact contact : k_contact contparam* COL text CRLF ; contparam : SCOL altrepparam | SCOL languageparam | SCOL other_param ; // 3.8.4.3 - Organizer organizer : k_organizer orgparam* COL cal_address CRLF ; orgparam : SCOL cnparam | SCOL dirparam | SCOL sentbyparam | SCOL languageparam | SCOL other_param ; // 3.8.4.4 - Recurrence ID recurid : k_recurrence_id ridparam* COL date_time_date CRLF ; ridparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL tzidparam | SCOL rangeparam | SCOL other_param ; // 3.8.4.5. Related To related : k_related_to relparam* COL text CRLF ; relparam : SCOL reltypeparam | SCOL other_param ; // 3.8.4.6 - Uniform Resource Locator url : k_url (SCOL other_param)* COL uri CRLF ; // 3.8.4.7 - Unique Identifier uid : k_uid (SCOL other_param)* COL text CRLF ; // 3.8.5.1 - Exception Date-Times exdate : k_exdate exdtparam* COL date_time_date (COMMA date_time_date)* CRLF ; exdtparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL tzidparam | SCOL other_param ; // 3.8.5.2 - Recurrence Date-Times rdate : k_rdate rdtparam* COL rdtval (COMMA rdtval)* CRLF ; rdtparam : SCOL k_value ASSIGN k_date_time | SCOL k_value ASSIGN k_date | SCOL k_value ASSIGN k_period | SCOL tzidparam | SCOL other_param ; rdtval : date_time | date | period ; date_time_date : date_time | date ; // 3.8.5.3 - Recurrence Rule rrule : k_rrule (SCOL other_param)* COL recur CRLF ; // 3.8.6.1 - Action action : k_action (SCOL other_param)* COL actionvalue CRLF ; actionvalue : k_audio | k_display | k_email | iana_token | x_name ; // 3.8.6.2 - Repeat Count repeat : k_repeat (SCOL other_param)* COL integer CRLF ; // 3.8.6.3 - Trigger trigger : k_trigger trigrel* COL dur_value CRLF | k_trigger trigabs* COL date_time CRLF ; trigrel : SCOL k_value ASSIGN k_duration | SCOL trigrelparam | SCOL other_param ; trigabs : SCOL k_value ASSIGN k_date_time | SCOL other_param ; // 3.8.7.1 - Date-Time Created created : k_created (SCOL other_param)* COL date_time CRLF ; // 3.8.7.2 - Date-Time Stamp dtstamp : k_dtstamp (SCOL other_param)* COL date_time CRLF ; // 3.8.7.3 - Last Modified last_mod : k_last_modified (SCOL other_param)* COL date_time CRLF ; // 3.8.7.4 - Sequence Number seq : k_sequence (SCOL other_param)* COL integer CRLF ; // 3.8.8.1 - IANA Properties iana_prop : iana_token (SCOL icalparameter)* COL value CRLF ; // 3.8.8.2 - Non-Standard Propertie x_prop : x_name (SCOL icalparameter)* COL value CRLF ; // 3.8.8.3 - Request Status rstatus : k_request_status rstatparam* COL statcode SCOL text (SCOL text)? ; rstatparam : SCOL languageparam | SCOL other_param ; statcode : digit+ DOT digit+ (DOT digit+)? ; param_name : iana_token | x_name ; param_value : paramtext | quoted_string ; paramtext : safe_char* ; quoted_string : DQUOTE qsafe_char* DQUOTE ; // iCalendar identifier registered with IANA iana_token : (alpha | MINUS)+ ; // 3.2 icalparameter : altrepparam | cnparam | cutypeparam | delfromparam | deltoparam | dirparam | encodingparam | fmttypeparam | fbtypeparam | languageparam | memberparam | partstatparam | rangeparam | trigrelparam | reltypeparam | roleparam | rsvpparam | sentbyparam | tzidparam | valuetypeparam | other_param ; // 3.2.1 altrepparam : k_altrep ASSIGN DQUOTE uri DQUOTE ; // 3.2.2 cnparam : k_cn ASSIGN param_value ; // 3.2.3 cutypeparam : k_cutype ASSIGN ( k_individual | k_group | k_resource | k_room | k_unknown | x_name | iana_token ) ; // 3.2.4 delfromparam : k_delegated_from ASSIGN DQUOTE cal_address DQUOTE (COMMA DQUOTE cal_address DQUOTE)* ; // 3.2.5 deltoparam : k_delegated_to ASSIGN DQUOTE cal_address DQUOTE (COMMA DQUOTE cal_address DQUOTE)* ; // 3.2.6 dirparam : k_dir ASSIGN DQUOTE uri DQUOTE ; // 3.2.7 encodingparam : k_encoding ASSIGN ( D8 k_bit | k_base D6 D4 ) ; // 3.2.8 fmttypeparam : k_fmttype ASSIGN type_name FSLASH subtype_name ; // 3.2.9 fbtypeparam : k_fbtype ASSIGN ( k_free | k_busy | k_busy_unavailable | k_busy_tentative | x_name | iana_token ) ; // 3.2.10 languageparam : k_language ASSIGN language ; // 3.2.11 memberparam : k_member ASSIGN DQUOTE cal_address DQUOTE (COMMA DQUOTE cal_address DQUOTE)* ; // 3.2.12 partstatparam : k_partstat ASSIGN ( partstat_event | partstat_todo | partstat_jour ) ; // 3.2.13 rangeparam : k_range ASSIGN k_thisandfuture ; // 3.2.14 trigrelparam : k_related ASSIGN ( k_start | k_end ) ; // 3.2.15 reltypeparam : k_reltype ASSIGN ( k_parent | k_child | k_sibling | x_name | iana_token ) ; // 3.2.16 roleparam : k_role ASSIGN ( k_chair | k_req_participant | k_opt_participant | k_non_participant | iana_token | x_name ) ; // 3.2.17 rsvpparam : k_rsvp ASSIGN ( k_true | k_false ) ; // 3.2.18 sentbyparam : k_sent_by ASSIGN DQUOTE cal_address DQUOTE ; // 3.2.19 tzidparam : k_tzid ASSIGN FSLASH? paramtext ; // 3.2.20 valuetypeparam : k_value ASSIGN valuetype ; valuetype : k_binary | k_boolean | k_cal_address | k_date | k_date_time | k_duration | k_float | k_integer | k_period | k_recur | k_text | k_time | k_uri | k_utc_offset | x_name | iana_token ; // 3.3.1 - A "BASE64" encoded character string, as defined by [RFC4648]. binary : b_chars b_end? ; b_chars : b_char* ; b_end : ASSIGN ASSIGN? ; // 3.3.2 bool : k_true | k_false ; // 3.3.3 cal_address : uri ; // 3.3.4 date : date_value ; // 3.3.5 date_time : date T time ; // 3.3.6 dur_value : MINUS P (dur_date | dur_time | dur_week) | PLUS? P (dur_date | dur_time | dur_week) ; // 3.3.7 float_num : MINUS digits (DOT digits)? | PLUS? digits (DOT digits)? ; digits : digit+ ; // 3.3.8 integer : MINUS digits | PLUS? digits ; // 3.3.9 period : period_explicit | period_start ; // 3.3.10 recur : recur_rule_part (SCOL recur_rule_part)* ; // 3.3.11 text : (tsafe_char | COL | DQUOTE | ESCAPED_CHAR)* ; // 3.3.12 time : time_hour time_minute time_second Z? ; // 3.3.13 - As defined in Section 3 of [RFC3986]. uri : qsafe_char+ ; // 3.3.14 utc_offset : time_numzone ; // Applications MUST ignore x-param and iana-param values they don't // recognize. other_param : iana_param | x_param ; // Some other IANA-registered iCalendar parameter. iana_param : iana_token ASSIGN param_value (COMMA param_value)* ; // A non-standard, experimental parameter. x_param : x_name ASSIGN param_value (COMMA param_value)* ; // As defined in Section 4.2 of [RFC4288]. type_name : reg_name ; // As defined in Section 4.2 of [RFC4288]. subtype_name : reg_name ; // Between 1 and 127 chars allowed as defined in Section 4.2 of [RFC4288]. reg_name : reg_name_char+ ; // Loosely matched language (see [RFC5646]). language : language_char+ ; partstat_event : k_needs_action | k_accepted | k_declined | k_tentative | k_delegated | x_name | iana_token ; partstat_todo : k_needs_action | k_accepted | k_declined | k_tentative | k_delegated | k_completed | k_in_progress | x_name | iana_token ; partstat_jour : k_needs_action | k_accepted | k_declined | x_name | iana_token ; b_char : alpha | digit | PLUS | FSLASH ; date_value : date_fullyear date_month date_mday ; date_fullyear : digits_2 digits_2 ; date_month : digits_2 ; date_mday : digits_2 ; time_hour : digits_2 ; time_minute : digits_2 ; time_second : digits_2 ; dur_date : dur_day dur_time? ; dur_day : digit+ D ; dur_time : T? (dur_hour | dur_minute | dur_second) ; dur_week : digit+ W ; dur_hour : digit+ H dur_minute? ; dur_minute : digit+ M dur_second? ; dur_second : digit+ S ; period_explicit : date_time FSLASH date_time ; period_start : date_time FSLASH dur_value ; recur_rule_part : k_freq ASSIGN freq | k_until ASSIGN enddate | k_count ASSIGN count | k_interval ASSIGN interval | k_bysecond ASSIGN byseclist | k_byminute ASSIGN byminlist | k_byhour ASSIGN byhrlist | k_byday ASSIGN bywdaylist | k_bymonthday ASSIGN bymodaylist | k_byyearday ASSIGN byyrdaylist | k_byweekno ASSIGN bywknolist | k_bymonth ASSIGN bymolist | k_bysetpos ASSIGN bysplist | k_wkst ASSIGN weekday ; freq : k_secondly | k_minutely | k_hourly | k_daily | k_weekly | k_monthly | k_yearly ; enddate : date | date_time ; count : digits ; interval : digits ; byseclist : digits_1_2 (COMMA digits_1_2)* ; byminlist : digits_1_2 (COMMA digits_1_2)* ; byhrlist : digits_1_2 (COMMA digits_1_2)* ; bywdaylist : weekdaynum (COMMA weekdaynum)* ; weekdaynum : ((PLUS | MINUS)? digits_1_2)? weekday ; weekday : S U | M O | T U | W E | T H | F R | S A ; bymodaylist : monthdaynum (COMMA monthdaynum)* ; monthdaynum : (PLUS | MINUS)? digits_1_2 ; byyrdaylist : yeardaynum (COMMA yeardaynum)* ; yeardaynum : (PLUS | MINUS)? ordyrday ; ordyrday : digit (digit digit?)? ; bywknolist : weeknum (COMMA weeknum)* ; weeknum : (PLUS | MINUS)? digits_1_2 ; bymolist : digits_1_2 (COMMA digits_1_2)* ; bysplist : yeardaynum (COMMA yeardaynum)* ; digits_2 : digit digit ; digits_1_2 : digit digit? ; // Any character except CONTROL, DQUOTE, ";", ":", "," safe_char : ~(CRLF | CONTROL | DQUOTE | SCOL | COL | COMMA) ; // Any textual character value_char : ~(CRLF | CONTROL | ESCAPED_CHAR) ; // Any character except CONTROL and DQUOTE qsafe_char : ~(CRLF | CONTROL | DQUOTE) ; // Any character except CONTROLs not needed by the current // character set, DQUOTE, ";", ":", "\", "," tsafe_char : ~(CRLF | CONTROL | DQUOTE | SCOL | COL | BSLASH | COMMA) ; time_numzone : (PLUS | MINUS) time_hour time_minute time_second? ; reg_name_char : alpha | digit | EXCLAMATION | HASH | DOLLAR | AMP | DOT | PLUS | MINUS | CARET | USCORE ; language_char : alpha | digit | MINUS | COL | WSP ; // Reserved for experimental use. x_name : X (alpha_num alpha_num alpha_num+ MINUS)? (alpha_num | MINUS)+ ; alpha_num : alpha | digit ; // The digits: 0..9 digit : D0 | D1 | D2 | D3 | D4 | D5 | D6 | D7 | D8 | D9 ; // Any alpha char alpha : A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z ; // Case insensitive keywords k_accepted : A C C E P T E D; k_action : A C T I O N; k_address : A D D R E S S; k_altrep : A L T R E P; k_attach : A T T A C H; k_attendee : A T T E N D E E; k_audio : A U D I O; k_base : B A S E; k_begin : B E G I N; k_binary : B I N A R Y; k_bit : B I T; k_boolean : B O O L E A N; k_busy : B U S Y; k_busy_unavailable : B U S Y MINUS U N A V A I L A B L E; k_busy_tentative : B U S Y MINUS T E N T A T I V E; k_byday : B Y D A Y; k_byhour : B Y H O U R; k_byminute : B Y M I N U T E; k_bymonth : B Y M O N T H; k_bymonthday : B Y M O N T H D A Y; k_bysecond : B Y S E C O N D; k_bysetpos : B Y S E T P O S; k_byweekno : B Y W E E K N O; k_byyearday : B Y Y E A R D A Y; k_cal_address : C A L MINUS A D D R E S S; k_calscale : C A L S C A L E; k_cancelled : C A N C E L L E D; k_categories : C A T E G O R I E S; k_chair : C H A I R; k_child : C H I L D; k_class : C L A S S; k_cn : C N; k_comment : C O M M E N T; k_completed : C O M P L E T E D; k_confidential : C O N F I D E N T I A L; k_confirmed : C O N F I R M E D; k_contact : C O N T A C T; k_count : C O U N T; k_created : C R E A T E D; k_cutype : C U T Y P E; k_daily : D A I L Y; k_date : D A T E; k_date_time : D A T E MINUS T I M E; k_daylight : D A Y L I G H T; k_declined : D E C L I N E D; k_delegated : D E L E G A T E D; k_delegated_from : D E L E G A T E D MINUS F R O M; k_delegated_to : D E L E G A T E D MINUS T O; k_description : D E S C R I P T I O N; k_dir : D I R; k_display : D I S P L A Y; k_draft : D R A F T; k_dtend : D T E N D; k_dtstamp : D T S T A M P; k_dtstart : D T S T A R T; k_due : D U E; k_duration : D U R A T I O N; k_email : E M A I L; k_encoding : E N C O D I N G; k_end : E N D; k_exdate : E X D A T E; k_false : F A L S E; k_fbtype : F B T Y P E; k_final : F I N A L; k_float : F L O A T; k_fmttype : F M T T Y P E; k_fr : F R; k_free : F R E E; k_freebusy : F R E E B U S Y; k_freq : F R E Q; k_geo : G E O; k_gregorian : G R E G O R I A N; k_group : G R O U P; k_hourly : H O U R L Y; k_in_progress : I N MINUS P R O G R E S S; k_individual : I N D I V I D U A L; k_integer : I N T E G E R; k_interval : I N T E R V A L; k_language : L A N G U A G E; k_last_modified : L A S T MINUS M O D I F I E D; k_location : L O C A T I O N; k_member : M E M B E R; k_method : M E T H O D; k_minutely : M I N U T E L Y; k_mo : M O; k_monthly : M O N T H L Y; k_needs_action : N E E D S MINUS A C T I O N; k_non_participant : N O N MINUS P A R T I C I P A N T; k_opaque : O P A Q U E; k_opt_participant : O P T MINUS P A R T I C I P A N T; k_organizer : O R G A N I Z E R; k_parent : P A R E N T; k_participant : P A R T I C I P A N T; k_partstat : P A R T S T A T; k_percent_complete : P E R C E N T MINUS C O M P L E T E; k_period : P E R I O D; k_priority : P R I O R I T Y; k_private : P R I V A T E; k_process : P R O C E S S; k_prodid : P R O D I D; k_public : P U B L I C; k_range : R A N G E; k_rdate : R D A T E; k_recur : R E C U R; k_recurrence_id : R E C U R R E N C E MINUS I D; k_relat : R E L A T; k_related : R E L A T E D; k_related_to : R E L A T E D MINUS T O; k_reltype : R E L T Y P E; k_repeat : R E P E A T; k_req_participant : R E Q MINUS P A R T I C I P A N T; k_request_status : R E Q U E S T MINUS S T A T U S; k_resource : R E S O U R C E; k_resources : R E S O U R C E S; k_role : R O L E; k_room : R O O M; k_rrule : R R U L E; k_rsvp : R S V P; k_sa : S A; k_secondly : S E C O N D L Y; k_sent_by : S E N T MINUS B Y; k_sequence : S E Q U E N C E; k_sibling : S I B L I N G; k_standard : S T A N D A R D; k_start : S T A R T; k_status : S T A T U S; k_su : S U; k_summary : S U M M A R Y; k_tentative : T E N T A T I V E; k_text : T E X T; k_th : T H; k_thisandfuture : T H I S A N D F U T U R E; k_time : T I M E; k_transp : T R A N S P; k_transparent : T R A N S P A R E N T; k_trigger : T R I G G E R; k_true : T R U E; k_tu : T U; k_tzid : T Z I D; k_tzname : T Z N A M E; k_tzoffsetfrom : T Z O F F S E T F R O M; k_tzoffsetto : T Z O F F S E T T O; k_tzurl : T Z U R L; k_uid : U I D; k_unknown : U N K N O W N; k_until : U N T I L; k_uri : U R I; k_url : U R L; k_utc_offset : U T C MINUS O F F S E T; k_valarm : V A L A R M; k_value : V A L U E; k_vcalendar : V C A L E N D A R; k_version : V E R S I O N; k_vevent : V E V E N T; k_vfreebusy : V F R E E B U S Y; k_vjournal : V J O U R N A L; k_vtimezone : V T I M E Z O N E; k_vtodo : V T O D O; k_we : W E; k_weekly : W E E K L Y; k_wkst : W K S T; k_yearly : Y E A R L Y; ////////////////////////////// lexer rules ////////////////////////////// LINE_FOLD : CRLF WSP -> skip ; WSP : ' ' | '\t' ; ESCAPED_CHAR : '\\' (CRLF WSP)? '\\' | '\\' (CRLF WSP)? ';' | '\\' (CRLF WSP)? ',' | '\\' (CRLF WSP)? N ; CRLF : '\r'? '\n' | '\r' ; // All the ASCII controls except HTAB and CRLF CONTROL : [\u0000-\u0008] | [\u000B-\u000C] | [\u000E-\u001F] | [\u007F] ; A : [aA]; B : [bB]; C : [cC]; D : [dD]; E : [eE]; F : [fF]; G : [gG]; H : [hH]; I : [iI]; J : [jJ]; K : [kK]; L : [lL]; M : [mM]; N : [nN]; O : [oO]; P : [pP]; Q : [qQ]; R : [rR]; S : [sS]; T : [tT]; U : [uU]; V : [vV]; W : [wW]; X : [xX]; Y : [yY]; Z : [zZ]; EXCLAMATION : '!'; DQUOTE : '"'; HASH : '#'; DOLLAR : '$'; X25 : '%'; AMP : '&'; X27 : '\''; X28 : '('; X29 : ')'; X2A : '*'; PLUS : '+'; COMMA : ','; MINUS : '-'; DOT : '.'; FSLASH : '/'; D0 : '0'; D1 : '1'; D2 : '2'; D3 : '3'; D4 : '4'; D5 : '5'; D6 : '6'; D7 : '7'; D8 : '8'; D9 : '9'; COL : ':'; SCOL : ';'; X3C : '<'; ASSIGN : '='; X3E : '>'; X3F : '?'; X40 : '@'; X5B : '['; BSLASH : '\\'; X5D : ']'; CARET : '^'; USCORE : '_'; X60 : '`'; X7B : '{'; X7C : '|'; X7D : '}'; X7E : '~'; NON_US_ASCII : . ;
libsrc/math/z88math/dadd.asm
grancier/z180
0
83365
; ; Z88dk Z88 Maths Library ; ; ; $Id: dadd.asm,v 1.4 2016/06/22 19:55:06 dom Exp $ SECTION code_fp PUBLIC dadd EXTERN fsetup EXTERN stkequ INCLUDE "fpp.def" .dadd call fsetup fpp(FP_ADD) jp stkequ
programs/oeis/095/A095915.asm
neoneye/loda
22
95532
<reponame>neoneye/loda<filename>programs/oeis/095/A095915.asm<gh_stars>10-100 ; A095915: Each number is twice times the product of the digits of the previous number. ; 1,2,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16,12,4,8,16 mov $1,1 mov $2,8 lpb $0 sub $0,1 mod $1,$2 mul $1,2 mov $2,10 lpe mov $0,$1