Example #1
0
File: encbc.c Project: adaroh/espl
int getLineToArray(int argc,char **argv){
  int i,j,numOfChar = 0;
  
  for(i = 1; i < argc; ++i)
  {
    for(j = 0; argv[i][j] ; ++j,++numOfChar)
    {
	bc_char2bits(argv[i][j],barcode[numOfChar]);
    }
    
    if(i < argc -1)
    {
      bc_char2bits(' ',barcode[numOfChar]);
      ++numOfChar;
    }
  }
  return numOfChar;
}
Example #2
0
File: encbc.c Project: bitc/espl
int main(int argc, char **argv) {
	int barcode[BC_WIDTH][BC_NBITS];
	int i, j;
	int n;
	char* c;

	n = 0;
	for(i=1; i<argc; ++i) {
		c = argv[i];
		while(*c != '\0') {
			bc_char2bits(*c, barcode[n]);
			++n;
			++c;
			/* Check for overflow */
			if(n == BC_WIDTH) {
				i = argc-1; /* Make sure that a space is not added below */
				break;
			}
		}
		/* Add space character between words */
		if(i!=argc-1) {
			bc_char2bits(' ', barcode[n]);
			++n;
		}
		if(n == BC_WIDTH) {
			/* Don't overflow */
			break;
		}
	}

	for(j=0; j<BC_NBITS; ++j) {
		for(i=0; i<n; ++i) {
			if(barcode[i][j]) {
				printf("#");
			}
			else {
				printf(" ");
			}
		}
		printf("\n");
	}

	return 0;
}
Example #3
0
      int read (int argc, char **argv){
      	int w = 1; // index of the word
	int j = 0; //index of a letted in each word
	int i = 0;  //index from whole chars
	for(w = 1; w < argc; ++w){ //read each words
	  for (j = 0 ; argv[w][j];++j,i++){
	    bc_char2bits( argv[w][j], barcode[i]);//read each char
	  }
	}
	return 1;
      }
Example #4
0
File: bclib.c Project: bitc/espl
/* converts ch to itself via bits, for testing */
static int char2char(int ch) {
	int bits[BC_NBITS];

	return bc_bits2char(bc_char2bits(ch, bits));
}
Example #5
0
  /* converts ch to itself via bits, for testing */
  static int char2char(int ch) {
  printf("char2cahr\n");	
    int bits[BC_NBITS];

	  return bc_bits2char(bc_char2bits(ch, bits));
  }