-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added string indent fnctin for formatting runtime help
- Loading branch information
Showing
12 changed files
with
198 additions
and
24 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
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 |
---|---|---|
|
@@ -8,3 +8,4 @@ function(error) | |
log(--error ${ARGN}) | ||
return_ans() | ||
endfunction() | ||
|
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 @@ | ||
function(warning ${ARGN}) | ||
return_ans() | ||
endfunction() |
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
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,6 @@ | ||
function(session) | ||
|
||
|
||
## maybe later some kind of session which restores values between cmakepp runs | ||
|
||
endfunction() |
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,66 @@ | ||
|
||
function(string_indent str indentation) | ||
string_codes() | ||
|
||
set(maxWidth ${ARGN}) | ||
if("${maxWidth}_" STREQUAL "_") | ||
set(maxWidth 0) | ||
endif() | ||
|
||
# normalize line endings | ||
string(REPLACE "\r\n" "\n" str "${str}") | ||
|
||
if("${maxWidth}" LESS 1) | ||
string(REPLACE "\n" "\n${indentation}" str "${str}") | ||
set(str "${indentation}${str}") | ||
return_ref(str) | ||
endif() | ||
|
||
# desemicolonize | ||
string(REPLACE ";" "${semicolon_code}" str "${str}") | ||
|
||
#string(REPLACE "\n" ";" str "${str}") | ||
|
||
string(REPLACE " " ";" str "${str}") | ||
string(REPLACE "\n" ";${free_token1}" str "${str}") | ||
set(result) | ||
|
||
set(currentLine) | ||
set(currentLength 0) | ||
## | ||
while(true) | ||
list(LENGTH str size) | ||
if(NOT size) | ||
if(NOT "${currentLine}_" STREQUAL "_") | ||
list(APPEND result "${currentLine}") | ||
endif() | ||
break() | ||
endif() | ||
|
||
list_pop_front(str) | ||
ans(word) | ||
|
||
if("${word}" STREQUAL "${free_token1}") | ||
list(APPEND result "${currentLine}") | ||
set(currentLine) | ||
continue() | ||
endif() | ||
|
||
|
||
set(currentLine "${currentLine} ${word}") | ||
string(LENGTH "${currentLine}" len) | ||
if(NOT "${len}" LESS "${maxWidth}") | ||
list(APPEND result "${currentLine}") | ||
set(currentLine) | ||
endif() | ||
endwhile() | ||
|
||
string(REPLACE "${free_token1}" "\n" result "${result}") | ||
|
||
string(REPLACE ";" "\n" result "${result}") | ||
string(REPLACE "\n" "\n${indentation}" result "${result}") | ||
string(REPLACE "${semicolon_code}" ";" result "${result}") | ||
set(result "${indentation}${result}") | ||
|
||
return_ref(result) | ||
endfunction() |
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
2 changes: 2 additions & 0 deletions
2
tests/package/package_source_tests/path/package_source_push_path_test.cmake
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
function(test) | ||
|
||
|
||
|
||
fwrite("test/asdasd/package.cmake" "{\"id\":\"mypkg\"}") | ||
mkdir("test/asdasd2") | ||
|
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,54 @@ | ||
function(test) | ||
set(session_file ".cmakepp-session") | ||
|
||
function(get_session) | ||
|
||
map_get(global "sess") | ||
return_ans() | ||
endfunction() | ||
|
||
function(set_session) | ||
map_set(global "sess" ${ARGN}) | ||
endfunction() | ||
|
||
function(session) | ||
file_find_anchor("${session_file}") | ||
ans(anchor) | ||
if(NOT anchor) | ||
fwrite("${session_file}" "") | ||
endif() | ||
cmake_read("${session_file}") | ||
ans(sessionData) | ||
set_session("${sessionData}") | ||
json_print("${sessionData}") | ||
return_ref(sessionData) | ||
|
||
|
||
endfunction() | ||
|
||
function(session_write) | ||
get_session() | ||
ans(sess) | ||
cmake_write("${session_file}" "${sess}") | ||
endfunction() | ||
|
||
|
||
|
||
set_session(asdasdasd) | ||
session_write() | ||
|
||
|
||
|
||
|
||
|
||
|
||
session() | ||
ans(session) | ||
|
||
|
||
|
||
|
||
assert(EXISTS "${test_dir}/.cmakepp-session") | ||
|
||
|
||
endfunction() |
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 |
---|---|---|
@@ -1,4 +1,23 @@ | ||
function(test) | ||
|
||
|
||
|
||
|
||
string_indent("aasdasdja kshdlkasjdl kajsddalska sdkajsd | ||
asdasdkasdkajsdlkajsd | ||
asdlasdk | ||
asdasd | ||
alskdjalksjdlkasjdlkajsdlkajsdlkajslkdjalksjdlkajsdlkajsdlkajsdlkjasldk" " " 20) | ||
|
||
assert("${__ans}" STREQUAL " aasdasdja kshdlkasjdl | ||
kajsddalska sdkajsd | ||
asdasdkasdkajsdlkajsd | ||
asdlasdk | ||
asdasd | ||
alskdjalksjdlkasjdlkajsdlkajsdlkajslkdjalksjdlkajsdlkajsdlkajsdlkjasldk") | ||
|
||
|
||
|
||
endfunction() | ||
endfunction() |