Skip to content

Commit be4597a

Browse files
adding extra functionalitys
1 parent f2b6b17 commit be4597a

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,7 @@ silverchain = require("LuaSilverChain")
4444
silverchain.remove("src")
4545
```
4646
## Building from Scratch
47-
if you want to build the code from scracth you need to have [Darwin](https://github.com/OUIsolutions/Darwin)
48-
installed on versio **0.020** and **Docker** our **Podman** installed on your machine.
49-
After install all dependecies,clone the repo on your machine , than run:
47+
5048
```shel
5149
darwin run_blueprint build/ --mode folder
5250
```

build/install_dependencies.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ function Install_dependencies()
44

55
local libs = {
66
{url="https://github.com/OUIsolutions/LuaCEmbed/releases/download/0.8.3/LuaCEmbedOne.c",path="dependencies/LuaCEmbedOne.c"},
7-
{url="https://github.com/OUIsolutions/SilverChain/releases/download/0.2.2/SilverChainApiNoDependenciesIncluded.h",path="dependencies/CSilverChainApiNoDependenciesIncluded.h"},
7+
{url="https://github.com/OUIsolutions/SilverChain/releases/download/0.3.0/SilverChainApiNoDependenciesIncluded.h",path="dependencies/CSilverChainApiNoDependenciesIncluded.h"},
88
{url="https://github.com/OUIsolutions/CTextEngine/releases/download/v2.002/CTextEngine.h",path="dependencies/CTextEngine.h"},
99
{url="https://github.com/OUIsolutions/DoTheWorld/releases/download/v8.002/doTheWorld.h",path="dependencies/doTheWorld.h"},
1010
{url="https://github.com/OUIsolutions/C-Cli-Entry/releases/download/0.001/CliEntry.h",path="dependencies/CliEntry.h"},

citerop.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,17 @@ LuaCEmbedResponse *private_silver_chain_lua_remove(LuaCEmbed *args){
5959
SilverCHain_remove_start_end_from_folder(src);
6060
return NULL;
6161
}
62+
LuaCEmbedResponse *private_silver_chain_lua_remove_from_content(LuaCEmbed *args){
63+
char *content = LuaCEmbed_get_str_arg(args, 0);
64+
char *result = SilverChain_remove_start_end_from_string(content);
65+
if(result){
66+
LuaCEmbedResponse *response = LuaCEmbed_send_str(result);
67+
free(result);
68+
return response;
69+
}
70+
return NULL;
71+
}
72+
6273

6374
//============================ Errors ========================================================
6475

@@ -105,6 +116,7 @@ int luaopen_private_silverchain_cinterop(lua_State *state){
105116
LuaCEmbed * l = newLuaCEmbedLib(state);
106117
LuaCEmbed_add_callback(l, "generate", private_silver_chain_lua_generator);
107118
LuaCEmbed_add_callback(l, "remove_source", private_silver_chain_lua_remove);
119+
LuaCEmbed_add_callback(l, "remove_from_content", private_silver_chain_lua_remove_from_content);
108120
LuaCEmbed_add_callback(l, "generate_watch", private_silver_chain_lua_generator_watch_mode);
109121
LuaCEmbed_add_callback(l, "get_error_msg", private_silver_chain_lua_get_error_msg);
110122
LuaCEmbed_add_callback(l, "get_error_path", private_silver_chain_lua_get_error_path);

public/remove.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,10 @@ public_lua_silverchain.remove = function(src)
44
error("src is required")
55
end
66
private_silverchain_cinterop.remove_source(src)
7+
end
8+
public_lua_silverchain.remove_from_content = function(content, src)
9+
if not content or not src then
10+
error("content and src are required")
11+
end
12+
private_silverchain_cinterop.remove_from_content(content, src)
713
end

0 commit comments

Comments
 (0)