Reading G_code in Local File System and encoding int array. this program is improvement edition of Make Sequencer and Make Sequencer 2. So,I want to use this program. Sample Code including in this cpp file. Solves arrays bug(Dynamic allocation,Initialize,release...)
Fork of MakeSequencer by
Revision 5:9b4fcc87af6a, committed 2018-10-17
- Comitter:
- satoyuki1111
- Date:
- Wed Oct 17 09:11:24 2018 +0000
- Parent:
- 4:1e606e2301f9
- Commit message:
- The first commit.; this program is improvement edition of Make Sequencer and Make Sequencer 2.; So,I want to use this program.; Solves arrays bug(Dynamic allocation,Initialize,release)
Changed in this revision
MakeSequencer.cpp | Show annotated file Show diff for this revision Revisions of this file |
MakeSequencer.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 1e606e2301f9 -r 9b4fcc87af6a MakeSequencer.cpp --- a/MakeSequencer.cpp Wed Oct 17 08:39:42 2018 +0000 +++ b/MakeSequencer.cpp Wed Oct 17 09:11:24 2018 +0000 @@ -3,7 +3,7 @@ #include "mbed.h" #include "MakeSequencer.h" -#define SIZE 5 +#define SIZE 6 #define ArraySize(array) (sizeof(array) / sizeof(array[0])) //A row is from 1 @@ -21,8 +21,19 @@ printf("%d,",array[i]); printf("\n\r%d\n\r",code.getGcodeSize()); //getGcodeSize() //return Gcode row -} + +Solves arrays bug(Dynamic allocation,Initialize,release) +//out.txt +//x0y0z0a0b0c0 +//x10y10 +//x20a20c20 +//c30 + +//output +//20,10,0,20,0,20, (3 rows data output) +//4 (this code has 4 rows) */ + #include "MakeSequencer.h" MakeSequencer::MakeSequencer(FILE *fp) { @@ -131,7 +142,6 @@ else return false; } - //printf("#(%d) ",i); for(int n = 0;n < _ele;n++) { _tempnum[n] = atoi(_tempstr[n].c_str()); @@ -142,9 +152,7 @@ _element[n][i] = (i != 0 && _check[n][i] && _element[n][i] != _element[n][0]) ? _element[n][0] : _element[n][i]; - //printf("%c:%d",_element[n][i],_data[n][i]); } - //printf("\n\r"); delete[] _tempstr; } }
diff -r 1e606e2301f9 -r 9b4fcc87af6a MakeSequencer.h --- a/MakeSequencer.h Wed Oct 17 08:39:42 2018 +0000 +++ b/MakeSequencer.h Wed Oct 17 09:11:24 2018 +0000 @@ -4,7 +4,7 @@ #include "mbed.h" #include "string" #define CODE_LENGTH 15 -#define ARRAY_EREMENT 5 +#define ARRAY_EREMENT 6 #define BUF 256