-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix math package with 0.981.0 ballerina version
- Loading branch information
1 parent
33ea628
commit b446ce9
Showing
9 changed files
with
245 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!-- | ||
~ /* | ||
~ * Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
~ * | ||
~ * 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. | ||
~ */ | ||
--> | ||
<assembly> | ||
<includeBaseDirectory>true</includeBaseDirectory> | ||
<baseDirectory>/</baseDirectory> | ||
<id>ballerina-binary-repo</id> | ||
<formats> | ||
<format>zip</format> | ||
</formats> | ||
|
||
<fileSets> | ||
<fileSet> | ||
<directory>${project.build.directory}/generated-balo</directory> | ||
<outputDirectory>/</outputDirectory> | ||
<includes> | ||
<include>**</include> | ||
</includes> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[project] | ||
org-name="wso2" | ||
version="0.0.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
documentation { | ||
Add two integers and return the value. | ||
|
||
P{{a}} Value to be added | ||
P{{b}} Value to be added | ||
R{{}} Added value | ||
} | ||
public extern function addInt(int a, int b) returns int; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. | ||
* | ||
* WSO2 Inc. licenses this file to you under the Apache License, | ||
* Version 2.0 (the "License"); you may not use this file except | ||
* in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.wso2.ballerina.math; | ||
|
||
import org.ballerinalang.bre.Context; | ||
import org.ballerinalang.bre.bvm.BlockingNativeCallableUnit; | ||
import org.ballerinalang.model.types.TypeKind; | ||
import org.ballerinalang.model.values.BInteger; | ||
import org.ballerinalang.natives.annotations.Argument; | ||
import org.ballerinalang.natives.annotations.BallerinaFunction; | ||
import org.ballerinalang.natives.annotations.ReturnType; | ||
|
||
/** | ||
* Native function wso2.ballerina.math:addInt. | ||
*/ | ||
@BallerinaFunction( | ||
orgName = "wso2", | ||
packageName = "math:0.0.0", | ||
functionName = "addInt", | ||
args = {@Argument(name = "a", type = TypeKind.INT), | ||
@Argument(name = "b", type = TypeKind.INT)}, | ||
returnType = {@ReturnType(type = TypeKind.INT)}, | ||
isPublic = true | ||
) | ||
public class AddInt extends BlockingNativeCallableUnit { | ||
|
||
@Override | ||
public void execute(Context context) { | ||
System.out.println("**** Method addInt called ****"); | ||
long a = context.getIntArgument(0); | ||
long b = context.getIntArgument(1); | ||
BInteger result = new BInteger(a + b); | ||
context.setReturnValues(result); | ||
} | ||
} |
Oops, something went wrong.