58 lines
1.3 KiB
Awk
58 lines
1.3 KiB
Awk
# We try to find a comment block -- how?
|
|
# check how much paragraphs it has
|
|
# check if
|
|
#
|
|
# this code is crap - at least not well written
|
|
|
|
# Check the buffer if the comment was found
|
|
function check_comments() {
|
|
_lastline = bufindex - (buflen - 1)
|
|
_comm_size = length(comments)
|
|
|
|
lastfreeline = 0
|
|
lastfreecommline = 0
|
|
comm_index = 0
|
|
|
|
# go through all lines
|
|
for(i = bufindex; i < _lastline; i++) {
|
|
_line = trim(linebuf[i])
|
|
|
|
# empty line?
|
|
if(_line == "") {
|
|
lastfreeline = i
|
|
continue
|
|
}
|
|
|
|
# line start matched
|
|
if(_line == trim(comments[comm_index])) {
|
|
# end? else continue
|
|
if(comm_index < _comm_size) {
|
|
continue
|
|
}
|
|
else {
|
|
|
|
}
|
|
}
|
|
# reset again cause not matched
|
|
else comm_index = 0
|
|
|
|
# empty comment line
|
|
if(is_comment(_line)) {
|
|
_comment = trim(substr(_line, 2))
|
|
|
|
# check if empty comment
|
|
if(_comment == "") {
|
|
lastfreecommline = i
|
|
}
|
|
}
|
|
|
|
# check if comments fit in or is too big
|
|
if((_lastline - bufindex) < _comm_size) {
|
|
# too short
|
|
}
|
|
else {
|
|
#if()
|
|
}
|
|
}
|
|
}
|