Waitrud Weber’s blog

things and reminders for memories

windows-make: csv: CSV frame ... 003

Patch of object is read_csv_003.o in C, which is going to be attached and its compilation is once.

-   - - -
 

.\read_csv_003.cpp  File modified time Sun Aug 06 18:09:44 2023

0001 #include <tchar.h>
0002 #include <windows.h>
0003 #include <windowsx.h>
0004 
0005 #include <ctime>
0006 
0007 #include <stdio.h>
0008 #include <stdlib.h>
0009 
0010 #include "Print.h"
0011 #include "array_counter.h"
0012 #include "parse.h"
0013 
0014 #include "read_csv_003.h"
0015 
0016 int endline_003 ( char bc, char c) ;
0017 
0018 int endline_003 ( char bc, char c) {
0019     if ( bc == '\r' && c == '\n' ) return 1;
0020     return 0;
0021 }
0022 
0023 

     
         
         
         

*

windows-make: csv: CSV frame ... 002

Setting a file name and which seek is well for the analyzation.
And, csv analyzation is commented out of function "put the word".

 

*

-   - - -
 

read_csv_002.h  File modified time Mon Aug 07 16:48:43 2023

0001 #ifndef _SETTLE_GRID_002_H_
0002 #define _SETTLE_GRID_002_H_
0003 
0004 extern int csv_once_002 (int *index, int *end_index ) ;
0005 extern char* m_concat_c_002 ( char* word_002 , int c ) ;
0006 extern int Set_Logging_read_csv_002 ( Logging* log ) ;
0007 extern int Set_Filename_002 ( char* filename ) ;
0008 
0009 #endif
0010 

     
 

read_csv_002.cpp  File modified time Mon Aug 07 16:48:49 2023

0001 #include <tchar.h>
0002 #include <windows.h>
0003 #include <windowsx.h>
0004 
0005 #include <ctime>
0006 
0007 #include <stdio.h>
0008 #include <stdlib.h>
0009 
0010 #include "Print.h"
0011 #include "array_counter.h"
0012 #include "parse.h"
0013 
0014 #include "log_001.h"
0015 
0016 #include "read_csv_002.h"
0017 #include "read_csv_003.h"
0018 #include "read_csv_004.h"
0019 
0020 static Logging* log_001;
0021 static LOG_001* dlog_001 = NULL;
0022 
0023 static char* filename_002 = NULL;
0024 static FILE* rfp = NULL;
0025 
0026 int csv_once (int *index, int *end_index ) ;
0027 char get_char_002 (int *index) ;
0028 int endline_002 ( char bc, char c) ;
0029 int puttheword_002 ( int ii, int jj, char* word_002 ) ;
0030 char* m_concat_c_002 ( char* word_002 , int c ) ;
0031 int Set_Logging_read_csv_002 ( Logging* log ) ;
0032 
0033 
0034 char* word_002  = NULL;
0035 char* word_002_c = NULL;
0036 
0037 // Add; mode and quotes
0038 // example
0039 int csv_once_002 (int *index, int *end_index ) {
0040     int i;
0041     int ii, jj;
0042     int mode;
0043     int count = 0;
0044     char c, bc;
0045     int word_002_cnt;
0046     int continued_flg = 0;
0047     char msg[255];
0048 
0049     dlog_001 = log_001->update_log ( (char*)"int csv_once_002 (int *index, int *end_index ) starts." );
0050 
0051     mode = 0;
0052     ii=0; jj=0;
0053 
0054     for ( i = *index; i< 10 + *index && i < *end_index; i++ ) {
0055         count++;
0056         c = get_char_002 (&i);
0057 
0058         if ( mode == 0 && c == '\,' ) {
0059             ii++;
0060 //            continued_flg = 1;
0061             continued_flg = 0;
0062         } if ( mode == 0 && endline_003 ( bc, c) ) {
0063             word_002_cnt = array_count (word_002);
0064             word_002[ word_002_cnt - 1 ] = '\0';
0065             ii++;
0066             jj++;
0067 //            continued_flg = 1;
0068             continued_flg = 0;
0069         }
0070 
0071         bc = c;
0072 
0073         if ( continued_flg == 1 ) {
0074             puttheword_004 ( ii, jj, (char*) word_002 );
0075             word_002 = NULL;
0076             continued_flg = 0;
0077             continue;
0078         }
0079 
0080 
0081         word_002_c = (char*) m_concat_c_002 ( (char*) word_002 , (int) c );
0082         aFree(word_002);
0083         word_002 = word_002_c;
0084 
0085         sprintf( msg, "count %d word_002 |%s| word_002_c |%s| c|%d|", count, word_002, word_002_c, c );
0086         dlog_001 = log_001->update_log ( (char*)msg );
0087     }
0088 
0089     *index += count;
0090     dlog_001 = log_001->update_log ( (char*)"int csv_once_002 (int *index, int *end_index ) ends." );
0091 }
0092 
0093 //
0094 char get_char_002 (int *index_r ) {
0095     char dummy[255];
0096     char rc;
0097     char msg[255];
0098 
0099     rfp = (FILE*) fopen( filename_002, "rb" );
0100     if (rfp == NULL) {
0101         exit(-1);
0102     }
0103 
0104     sprintf( msg, "SEEK index_r |%d|", *index_r );
0105     dlog_001 = log_001->update_log ( (char*)msg );
0106 
0107     fseek( rfp, *index_r, SEEK_SET);
0108     fread ( dummy, 1, 1, rfp );
0109 
0110     fclose(rfp);
0111     rc = dummy[0];
0112     return rc;
0113 }
0114 
0115 int endline_002 ( char bc, char c) {
0116     return 0;
0117 }
0118 
0119 
0120 int puttheword_002 ( int ii, int jj, char* word_002 ) {
0121     return 0;
0122 }
0123 
0124 
0125 char* m_concat_c_002 ( char* word_002 , int c ) {
0126     static char* dummy = NULL;
0127     char cc;
0128     char msg[255];
0129 
0130     cc = (char)c;
0131 
0132     if ( dummy == NULL ) {
0133         dummy = (char*) malloc ( sizeof(char) * 4 );
0134         if ( dummy == NULL ) return NULL;
0135     }
0136     dummy[0] = c;
0137     dummy[1] = '\0';
0138 
0139     sprintf( msg, "msg dummy |%s| c|%d|", dummy, c );
0140     dlog_001 = log_001->update_log ( (char*)msg );
0141 
0142     return m_concat( word_002, dummy );
0143 }
0144 
0145 //
0146 int Set_Logging_read_csv_002 ( Logging* log ) {
0147     log_001 = (Logging*)log;
0148     return 0;
0149 }
0150 
0151 int Set_Filename_002 ( char* filename ) {
0152     filename_002 = (char*)filename;
0153     return 0;
0154 }
0155 

     
         
         

windows-make: csv: CSV frame ... 001

windows-make: csv: CSV frame ... 001

In first step in csv, we created the frame.

 

001:

-   - - -
 

read_csv_001.cpp  File modified time Sat Aug 05 17:38:37 2023

0001 #include <tchar.h>
0002 #include <windows.h>
0003 #include <windowsx.h>
0004 
0005 #include <ctime>
0006 
0007 #include <stdio.h>
0008 #include <stdlib.h>
0009 
0010 #include "Print.h"
0011 #include "array_counter.h"
0012 #include "parse.h"
0013 
0014 #include "read_csv_001.h"
0015 
0016 int csv_once (int *index, int *end_index ) ;
0017 char get_char_001 () ;
0018 int endline ( char bc, char c) ;
0019 int puttheword ( int ii, int jj, char* word ) ;
0020 char* m_concat_c_001 ( char* word , int c ) ;
0021 
0022 
0023 char* word  = NULL;
0024 char* word_c = NULL;
0025 
0026 // Add; mode and quotes
0027 // example
0028 int csv_once (int *index, int *end_index ) {
0029     int i;
0030     int ii, jj;
0031     int mode;
0032     int count = 0;
0033     char c, bc;
0034     int word_cnt;
0035     int continued_flg = 0;
0036 
0037     mode = 0;
0038     ii=0; jj=0;
0039 
0040     for ( i = *index; i< 10 + *index && i < *end_index; i++ ) {
0041         count++;
0042         c = get_char_001 ();
0043 
0044         if ( mode == 0 && c == '\,' ) {
0045             ii++;
0046             continued_flg = 1;
0047         } if ( mode == 0 && endline ( bc, c) ) {
0048             word_cnt = array_count (word);
0049             word[ word_cnt - 1 ] = '\0';
0050             ii++;
0051             jj++;
0052             continued_flg = 1;
0053         }
0054 
0055         bc = c;
0056 
0057         if ( continued_flg == 1 ) {
0058             puttheword ( ii, jj, (char*) word );
0059             word = NULL;
0060             continued_flg = 0;
0061             continue;
0062         }
0063 
0064 
0065         word_c = (char*) m_concat_c_001 ( (char*) word , (int) c );
0066         aFree(word);
0067         word = word_c;
0068     }
0069 
0070     *index += count;
0071 }
0072 
0073 char get_char_001 () {
0074     return 0;
0075 }
0076 
0077 int endline ( char bc, char c) {
0078     return 0;
0079 }
0080 
0081 
0082 int puttheword ( int ii, int jj, char* word ) {
0083     return 0;
0084 }
0085 
0086 char* m_concat_c_001 ( char* word , int c ) {
0087     static char* dummy = NULL;
0088     char cc;
0089 
0090     cc = (char)c;
0091 
0092     if ( dummy == NULL ) {
0093         dummy = (char*) malloc ( sizeof(char) * 4 );
0094         if ( dummy == NULL ) return NULL;
0095     }
0096     dummy[0] = c;
0097     dummy[1] = '\0';
0098 
0099     return m_concat( word, dummy );
0100 }
0101 
0102 

     
         
         
         

002:

003:

windows-make: C++: mingw: Creation undefined numbered buffer-array.


*
For a creation of buffer as array, undefined number is failed. The below is as 6 example.*

.\settle_grid_001.h File modified time Thu Aug 03 16:16:55 2023
...
019   char** a_litteratures = NULL;
020   char* litteratures[6] = { "\"", "\,", "\{", "\}", "\ ", "\r\n" };
021
...
043 };
044
045 #endif

 

*

windows-make: Settle all drawing functions...

*
*Their values should be displayed and changed with keyboard operation. 
*parameters and functions

    value - -
bErase   true or not     
RefreshRect        
rect back ground mairgin      
rect a small band      
rect        
...        
fonts        
...        
SetPixel poisson      
SetPixel wave      

*
*
*
*
*
*

*

    region - -
background  a small band for the wave graph

 

a small rect only

(spacified part))

   
         
objects rectangle as cursol 

a small rect only

(spacified part)

   
         
         

 

*
*
*

    region - -
background poisson disk sampling

whole window

(the entire region)

   
         
objects rectangle as cursol 

a small rect only

(spacified part)

   
         
         

 

*InvalidateRect

learn.microsoft.com

* as written
If the bErase parameter is TRUE for any part of the update region, the background is erased in the entire region, not just in the specified part.


*
*
*
*
*
*

There are "Drawing funcions" and their all parameters and their orders only.

willinglytranslate.blogspot.com

windows-make: Using a picture buffer.

*
*
*
*
*
*
*
*
*

*

    region - -
background  a small band for the wave graph

 

a small rect only

(spacified part))

   
         
objects rectangle as cursol 

a small rect only

(spacified part)

   
         
         

 

*
*
*

    region - -
background poisson disk sampling

whole window

(the entire region)

   
         
objects rectangle as cursol 

a small rect only

(spacified part)

   
         
         

 

*InvalidateRect

learn.microsoft.com

* as written
If the bErase parameter is TRUE for any part of the update region, the background is erased in the entire region, not just in the specified part.


*
*
*
*
*
*

How is the background and also the entire region?
That effects in animation will express in the size of picture buffer.

willinglytranslate.blogspot.com







 

windows-make: a small band and cursol

*

- objects invalidate area keyup animation -
1          
2          
3 rect15, rect 17 rect 17(on a little band) (v) (v)  
4 rect15, rect 17 rect 17(on a little band)- (-) (v)  
-          

*

All cases with cursol invalidated area will be a on a band area.

 

*invalidate curosol

We invalidate 2 rects position which are previous and current cursol's positions if we focus on cursol on the animation.

previous: px1, py1, px2, py2

current:  cx1, cy1, cx2, cy2