Beispiel #1
0
int main (int argc, char **argv) {
  if (argc != 3) {
    printf("Error on usage: %s <key> <value>\n", argv[0]);
    return EXIT_FAILURE;
  }

  char *key = argv[1];
  char *value = argv[2];

  // testing add function
  ht_add(key, value);
  ht_add("my", "diego");
  ht_add("baby", "looks");
  ht_add("rocks", "great!");
  printf("- Entity added for key %s is %s.\n", key, ht_find(key));

  // printing function
  printf("\nPrinting all entries:\n");
  ht_print();
  
  // testing remove function
  printf("\n- Trying to remove entry for key %s: %s.\n", key, (ht_remove(key) ? "done" : "fail"));

  // printing function
  printf("\nPrinting all entries:\n");
  ht_print();

  return EXIT_SUCCESS;
}
Beispiel #2
0
void SinglePass(char* filename,char* symboldef, char* opcode_mnemonic, char* operand, unsigned int* opcode){

	fp=fopen(filename,"r");

	if(fp == NULL){
		printf("해당 파일을 읽을 수 없습니다.\n");
		return;
	}

	while(!feof(fp) && !isDone){
		TokenParser(symboldef,opcode_mnemonic,operand);
		if(letThisLinePass == 0){
			Decoder(symboldef,opcode_mnemonic,operand,opcode);
			Translator(symboldef,opcode_mnemonic,operand,opcode);
		}
		//Initalize control signals before next line
		statusBit = 0;
		whereIsOnOPTAB = -1;
		whereIsOnASMTAB = -1;
	}
	if(whichPass == 1){
		DeployLiteral(&PC);
	}
	if(whichPass == 2){
		PrintModificationRecord(); //Print modification record
		ht_print(SYMTAB,"SYMTAB");
	}

	fclose(fp);
	letThisLinePass=0;
	isDone = 0;
	whereIsOnOPTAB =0;
	whereIsOnASMTAB =0;

}
int sba_jfs_print_journal(void)
{
	ht_print(h_sba_jfs_journal);
	return 1;
}