Skip to content

Commit

Permalink
Merge pull request EOSIO#162 from EOSIO/release/1.3.x
Browse files Browse the repository at this point in the history
Release v1.3.2
  • Loading branch information
larryk85 authored Oct 17, 2018
2 parents 1d0398f + 1e8a63e commit 32c9ae7
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 40 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ project(eosio_cdt)

set(VERSION_MAJOR 1)
set(VERSION_MINOR 3)
set(VERSION_PATCH 1)
set(VERSION_PATCH 2)

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(WARNING "CMAKE_INSTALL_PREFIX is set to default path of ${CMAKE_INSTALL_PREFIX}, resetting to ${CMAKE_INSTALL_PREFIX}/eosio.cdt")
Expand Down
77 changes: 41 additions & 36 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# EOSIO.CDT (Contract Development Toolkit)
## Version : 1.3.1
## Version : 1.3.2

EOSIO.CDT is a toolchain for WebAssembly (WASM) and set of tools to facilitate contract writing for the EOSIO platform. In addition to being a general purpose WebAssembly toolchain, [EOSIO](https://github.com/eosio/eos) specific optimizations are available to support building EOSIO smart contracts. This new toolchain is built around [Clang 7](https://github.com/eosio/llvm), which means that EOSIO.CDT has the most currently available optimizations and analyses from LLVM, but as the WASM target is still considered experimental, some optimizations are not available or incomplete.

Expand All @@ -22,18 +22,18 @@ $ brew remove eosio.cdt
```
#### Debian Package Install
```sh
$ wget https://github.com/eosio/eosio.cdt/releases/download/v1.3.1/eosio.cdt-1.3.1.x86_64.deb
$ sudo apt install ./eosio.cdt-1.3.1.x86_64.deb
$ wget https://github.com/eosio/eosio.cdt/releases/download/v1.3.2/eosio.cdt-1.3.2.x86_64.deb
$ sudo apt install ./eosio.cdt-1.3.2.x86_64.deb
```
#### Debian Package Uninstall
```sh
$ sudo apt uninstall eosio.cdt
$ sudo apt remove eosio.cdt
```

#### RPM Package Install
```sh
$ wget https://github.com/eosio/eosio.cdt/releases/download/v1.3.1/eosio.cdt-1.3.1.x86_64-0.x86_64.rpm
$ sudo yum install ./eosio.cdt-1.3.1.x86_64-0.x86_64.rpm
$ wget https://github.com/eosio/eosio.cdt/releases/download/v1.3.2/eosio.cdt-1.3.2.x86_64-0.x86_64.rpm
$ sudo yum install ./eosio.cdt-1.3.2.x86_64-0.x86_64.rpm
```

#### RPM Package Uninstall
Expand All @@ -56,12 +56,12 @@ $ sudo ./install.sh
$ eosio-cpp -abigen hello.cpp -o hello.wasm
```
- Or with CMake
```sh
$ mkdir build
$ cd build
$ cmake ..
$ make
```
```sh
$ mkdir build
$ cd build
$ cmake ..
$ make
```
This will generate two files:
* The compiled binary wasm (hello.wasm)
* The generated ABI file (hello.abi)
Expand Down Expand Up @@ -182,7 +182,7 @@ This will generate one file:
- Added new type `ignore`:
- This type acts as a placeholder for actions that don't want to deserialize their fields but want the types to be reflected in the ABI.
```c
ACTION action(ignore<some_type>) { some_type st; _ds >> st; }
ACTION action(ignore<some_type>) { some_type st; _ds >> st; }
```
- Added new type `ignore_wrapper`:
- This allows for calling `SEND_INLINE_ACTION` with `ignore_wrapper(some_value)` against an action with an `ignore` of matching types.
Expand All @@ -207,23 +207,28 @@ This will generate one file:

### attributes
- Added `[[eosio::ignore]]` attribute to flag a type as being ignored by the deserializer. This attribute is primarily only used for internal use within eosiolib.
- Added `[[eosio::contract]]` attribute. This new attribute is used to mark a contract class as "contract" with the name being either the C++ name of the class or a user specified name (i.e. `[[eosio::contract("somecontract")]]`). This attribute can also be used in conjunction with the `eosio::action` and `eosio::table` attributes for tables that you would like to define outside of the `eosio::contract` class. This is used in conjunction with either the raw `eosio-cpp` option `--contract <name>`, `-o <name>/.wasm` or with CMake `add_contract`. It acts as a filter enabling contract developers to include a header file with attributes from another contract (e.g. eosio.token) while generating an ABI devoid of those actions and tables.
```c
CONTRACT test {
ACTION acta(){}
TABLE taba {
uint64_t a;
float b;
uint64_t primary_key() { return a; }
};
- Added `[[eosio::contract]]` attribute. This new attribute is used to mark a contract class as "contract" with the name being either the C++ name of the class or a user specified name (i.e. `[[eosio::contract("somecontract")]]`). This attribute can also be used in conjunction with the `eosio::action` and `eosio::table` attributes for tables that you would like to define outside of the `eosio::contract` class. This is used in conjunction with either the raw `eosio-cpp` option `--contract <name>`, `-o <name>.wasm` or with CMake `add_contract`. It acts as a filter enabling contract developers to include a header file with attributes from another contract (e.g. eosio.token) while generating an ABI devoid of those actions and tables.
```c++
#include <eosiolib/eosio.hpp>
using namespace eosio;
CONTRACT test : public eosio::contract {
public:
using contract::contract;
ACTION acta(){}
TABLE taba {
uint64_t a;
float b;
uint64_t primary_key() const { return a; }
};
};
struct [[eosio::table, eosio::contract("test")]]
tabb {
uint64_t a;
int b
uint64_t a;
int b;
};
typedef eosio::multi_index<"testtaba"_n, test::taba> table_a;
typedef eosio::multi_index<"testtabb"_n, tabb> table_b;
EOSIO_DISPATCH( test, (acta) )
```
The above code will produce the tables `testtaba` and `testtabb` in your ABI. Example: `eosio-cpp -abigen test.cpp -o test.wasm` will mark this compilation and ABI generation for the `eosio::contract` `test`. The same thing can be done with `eosio-cpp -abigen test.cpp -o test_contract.wasm --contract test` or with the CMake command `add_contract( test, test_contract, test.cpp )`. Either of the previous two approaches will produce a test_contract.wasm and test_contract.abi generated under the context of the contract name of `test`.
Expand All @@ -240,40 +245,40 @@ Example (four ways to declare an action for ABI generation):
// this is the C++11 and greater style attribute
[[eosio::action]]
void testa( name n ) {
// do something
// do something
}
// this is the GNU style attribute, this can be used in C code and prior to C++ 11
__attribute__((eosio_action))
void testa( name n ){
// do something
// do something
}
struct [[eosio::action]] testa {
name n;
EOSLIB_SERIALIZE( testa, (n) )
name n;
EOSLIB_SERIALIZE( testa, (n) )
};
struct __attribute__((eosio_action)) testa {
name n;
EOSLIB_SERIALIZE( testa, (n) )
name n;
EOSLIB_SERIALIZE( testa, (n) )
};
```
If your action name is not a valid [EOSIO name](https://developers.eos.io/eosio-cpp/docs/naming-conventions) you can explicitly specify the name in the attribute ```c++ [[eosio::action("<valid action name>")]]```

Example (two ways to declare a table for ABI generation):
```c++
struct [[eosio::table]] testtable {
uint64_t owner;
/* all other fields */
uint64_t owner;
/* all other fields */
};

struct __attribute__((eosio_table)) testtable {
uint64_t owner;
/* all other fields */
uint64_t owner;
/* all other fields */
};

typedef eosio::multi_index<N(tablename), testtable> testtable_t;
typedef eosio::multi_index<"tablename"_n, testtable> testtable_t;
```
If you don't want to use the multi-index you can explicitly specify the name in the attribute ```c++ [[eosio::table("<valid action name>")]]```.

Expand Down Expand Up @@ -327,7 +332,7 @@ CONTRACT test : public eosio::contract {
public:
using contract::contract;
ACTION testact( account_name test ) {
ACTION testact( name test ) {
}
};
Expand Down
2 changes: 1 addition & 1 deletion eosio_llvm
Submodule eosio_llvm updated 1 files
+1 −1 tools/clang
4 changes: 2 additions & 2 deletions libraries/eosiolib/symbol.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ namespace eosio {

constexpr extended_symbol( symbol sym, name con ) : symbol(sym), contract(con) {}

constexpr symbol get_symbol() { return symbol; }
constexpr symbol get_symbol() const { return symbol; }

constexpr name get_contract() { return contract; }
constexpr name get_contract() const { return contract; }

/**
* %Print the extended symbol
Expand Down

0 comments on commit 32c9ae7

Please sign in to comment.