Skip to content

Commit

Permalink
10.5.7
Browse files Browse the repository at this point in the history
  • Loading branch information
ab25cq committed Mar 23, 2021
1 parent adcee38 commit 0b5190d
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@

version 10.5.7

Fixed String.insert(int, char) bug

version 10.4.6

Fixed block size bug
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

この言語はアプリケーションを作るタイプの言語ではないかもしれません。iclover2を使ってシェルとして使うといいと思います。

version 10.5.6
version 10.5.7

サポートしている機能

Expand Down
48 changes: 47 additions & 1 deletion String.clcl
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,53 @@ inherit String
}

def insert(index:int, c:char): String {
return insert(index, c.toString());
if(index < 0) {
index += self.len + 1;
}
if(index < 0) {
index = 0;
}
if(index > len) {
index = self.len;
}

len := 1;

if(self.len+len + 1 < self.size) {
i:=0;
for(i=self.len -1; i>=index; i--) {
self.buffer[i+len] = self.buffer[i];
}
for(i = 0; i<len; i++) {
self.buffer[index+i] = c;
}
self.buffer[self.len+len] = '\0';

self.len += len;
}
else {
new_size:int = (self.len + len + 1) * 2 + 1;
new_buffer:char[] = char[new_size];

i := 0;
for(i=0; i<index; i++) {
new_buffer[i] = self.buffer[i];
}
for(i=index; i<self.len; i++) {
new_buffer[i+len] = self.buffer[i];
}
for(i=0; i<len; i++) {
new_buffer[index+i] = c;
}
new_buffer[self.len+len] = '\0';

self.buffer = new_buffer;
self.size = new_size;

self.len += len;
}

return self;
}

def delete(index:int): String {
Expand Down
2 changes: 1 addition & 1 deletion src/compiler.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static BOOL class_compiler(char* fname)

int gARGC;
char** gARGV;
char* gVersion = "10.5.6";
char* gVersion = "10.5.7";

char gScriptDirPath[PATH_MAX];
BOOL gRunningCompiler = TRUE;
Expand Down
2 changes: 1 addition & 1 deletion src/interpreter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ static void compiler_final()

int gARGC;
char** gARGV;
char* gVersion = "10.5.6";
char* gVersion = "10.5.7";

char gScriptDirPath[PATH_MAX];
BOOL gRunningCompiler = FALSE;
Expand Down
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static void set_signal()

int gARGC;
char** gARGV;
char* gVersion = "10.5.6";
char* gVersion = "10.5.7";
BOOL gCompilingCore = FALSE;

char gScriptDirPath[PATH_MAX];
Expand Down

0 comments on commit 0b5190d

Please sign in to comment.