void file_fillbitmap(struct _gfxdevice*dev, gfxline_t*line, gfximage_t*img, gfxmatrix_t*matrix, gfxcxform_t*cxform) { internal_t*i = (internal_t*)dev->internal; fprintf(i->fi, "fillbitmap\n"); dumpmatrix(i->fi, matrix); dumpline(i->fi, line); }
hexdump(char * fname) { unsigned char buff[16]; unsigned long offset; struct _IO_FILE * fp; struct stat st; int cnt; if(stat(fname, & (st.st_dev)) == 0) { perror(fname); eax = 1; } else { fp = fopen(fname, 0x80489e4); if(fp == 0) { perror(fname); eax = 1; } else { for(offset = 0; st.st_size > offset; offset = offset + cnt) { cnt = fread( & buff, 1, 16, fp); if(cnt == 0) { break; } dumpline( & buff, offset, cnt); } fclose(fp); eax = 0; } } }
void yyerror(const char *s) { Errcount++; outfl(O_ERR|O_NONL, File, Line, "%s, tokens: ", s); dumpline(O_ERR); }
void file_fillgradient(struct _gfxdevice*dev, gfxline_t*line, gfxgradient_t*gradient, gfxgradienttype_t type, gfxmatrix_t*matrix) { internal_t*i = (internal_t*)dev->internal; fprintf(i->fi, "fillgradient\n"); dumpmatrix(i->fi, matrix); dumpgradient(i->fi, gradient); dumpline(i->fi, line); }
main() { int i; int j; printf("0\n255\n6\n6\n"); for(i=0;i<256;i++) { if(i<32 && i!=13) printf("%d %d (redirected)\n",i,ascii2me[i]); else if(i==127) printf("127 %d (redirected)\n",'e'); else { printf("%d %d\n",i,i); if(i==13) { dumpline(4,0); dumpline(4,8); dumpline(4,8); dumpline(4,10); dumpline(4,15); dumpline(4,2); } else for(j=0;j<6;j++) dumpline(4,font[6*i+j]); } } return 0; }
void file_stroke(struct _gfxdevice*dev, gfxline_t*line, gfxcoord_t width, gfxcolor_t*color, gfx_capType cap_style, gfx_joinType joint_style, gfxcoord_t miterLimit) { internal_t*i = (internal_t*)dev->internal; char* jointTypes[] = {"joinMiter", "joinRound", "joinBevel"}; char* capTypes[] = {"capButt", "capRound", "capSquare"}; fprintf(i->fi, "stroke %f %f %s %s %02x%02x%02x%02x\n", width, miterLimit, capTypes[cap_style], jointTypes[joint_style], color->r, color->g, color->b, color->a ); dumpline(i->fi, line); }
int lex_fini(void) { stats_elapse_stop(Lexelapse); closefile(); if (Lexecho) { outfl(O_OK, File, Line, "lex: "); dumpline(O_OK); } return (Errcount); }
static int record(int tok, const char *s) { stats_counter_bump(Tokcount); if (Line != Recordedline) { /* starting new line, dump out the previous line */ if (Lexecho && Recordedline) { outfl(O_NONL, File, Recordedline, "lex: "); dumpline(O_OK); } Recordedline = Line; Recordnext = 0; } if (Recordnext >= MAXRECORD) outfl(O_DIE, File, Line, "line too long, bailing out"); Recorded[Recordnext].tok = tok; Recorded[Recordnext++].s = s; yylval.tok.s = s; yylval.tok.file = File; yylval.tok.line = Line; return (tok); }
void file_startclip(struct _gfxdevice*dev, gfxline_t*line) { internal_t*i = (internal_t*)dev->internal; fprintf(i->fi, "startclip\n"); dumpline(i->fi, line); }
void file_drawlink(struct _gfxdevice*dev, gfxline_t*line, const char*action, const char*text) { internal_t*i = (internal_t*)dev->internal; fprintf(i->fi, "drawlink %s\n", action); dumpline(i->fi, line); }
void file_fill(struct _gfxdevice*dev, gfxline_t*line, gfxcolor_t*color) { internal_t*i = (internal_t*)dev->internal; fprintf(i->fi, "fill %02x%02x%02x%02x\n", color->r, color->g, color->b, color->a); dumpline(i->fi, line); }
/* function execShell * * Executes commands in a inputStream * inputMode determines whether interactive or batch mode runs * */ void execShell(FILE* inputStream, int inputMode) { char inputBuf[MAX_INPUT_LENGTH + 2]; // read file line by line until EOF or error reading inputstream while (fgets(inputBuf, (MAX_INPUT_LENGTH + 2), inputStream)) { // check to make sure fgets returns valid input if (inputBuf != NULL ) { size_t buflen = strlen(inputBuf); // Number of characters read into buffer (sans '\0') // Prints the command back in batch mode if (inputMode == BATCH_MODE) write(STDOUT_FILENO, inputBuf, buflen); // newline char index, if it exists if (inputBuf[buflen - 1] == '\n') { // input ends with ('\n')Acceptable length char* argTokens[MAX_INPUT_LENGTH / 2] = { NULL }; // stores cmd line args // Flags to keep track of special modes int bg_mode = 0; int redir_mode = 0; char* redirFile = NULL; // Parse command line and store into argTokens[] // Also sets the various special flags and files int parse_rc = parseCmdLn(inputBuf, argTokens, &bg_mode, &redir_mode, redirFile); // If bad return value, restart loop to get new input if (parse_rc <= 0) // redirection error or no input continue; // Built-in commands int builtin_rc = checkBuiltinCmds(argTokens); if (builtin_rc == -2) { exit(0); } if (builtin_rc == 0) // if builtin command not found or python // Create a new process to run the command runCmd(&argTokens, bg_mode, redir_mode, inputMode, redirFile); } else { //Line does not terminate with '\n' if (buflen + 1 == sizeof inputBuf) { // input line Too long displayError(); // Flush input stream to get rid of trailing new line character dumpline(inputStream); // write a newline character to stdout start on a new line write(STDOUT_FILENO,"\n",1); // prints "mysh> " printInteractivePrompt(inputMode); continue; } else { // EOF reached before line break break; } } } } }