コード例 #1
0
ファイル: ridl_logging.c プロジェクト: mgalloy/ridl
void ridl_initnotebook(char *filename) {
  char *ts = ridl_currenttimestamp();
  
  notebook_filename = (char *)malloc(strlen(filename) + 1);
  strcpy(notebook_filename, filename);
  
  notebook_fp = fopen(filename, "w");
  IDL_ToutPush(ridl_notebookoutput);
  
  switch(ridl_logging_format) {
    case 0:
      fprintf(notebook_fp, "<html>\n");
  
      fprintf(notebook_fp, "  <head>\n");
      fprintf(notebook_fp, "    <title>Notebook from %s</title>\n", ts);
  
      // TODO: eventually this should be put into a stylesheet file and imported
      fprintf(notebook_fp, "    <style type=\"text/css\" media=\"all\">\n");
      fprintf(notebook_fp, "      p.command { whitespace: pre; font-family: Monaco; margin-top: 0em; margin-bottom: 0em; }\n");
      fprintf(notebook_fp, "      span.prompt { color: #C65D09; }\n");
      fprintf(notebook_fp, "      pre.output { color: #4A62A4; font-family: Monaco; margin-top: 0em; margin-bottom: 0em; }\n");
      fprintf(notebook_fp, "      p.date { color: #666; font-size: 0.9em; }\n");
      fprintf(notebook_fp, "    </style>\n");
      fprintf(notebook_fp, "  </head>\n");

      fprintf(notebook_fp, "  <body>\n");
      break;
    case 1:
      fprintf(notebook_fp, "Notebook from %s\n\n", ts);
      ridl_new_codeblock = 1;
      break;
  }
  
  free(ts);
}
コード例 #2
0
ファイル: mg_cmdline_tools.c プロジェクト: jiezhou87/mglib
static void IDL_CDECL IDL_mg_tout_push(int argc, IDL_VPTR *argv) {
  if (diverting) {
    IDL_ToutPop();
  } else diverting = 1;

  if (argc > 0) {
    IDL_ENSURE_STRING(argv[0]);
    outf_fp = fopen(IDL_VarGetString(argv[0]), "w");
    IDL_ToutPush(mg_tout_outf_file);
  } else {
    outf_buffer_loc = 0;
    outf_buffer_size = OUTF_BUFFER_BLOCKSIZE;
    outf_buffer = (char *) malloc(OUTF_BUFFER_BLOCKSIZE);
    IDL_ToutPush(mg_tout_outf_buffer);
  }

}
コード例 #3
0
ファイル: ridl_logging.c プロジェクト: mgalloy/ridl
void ridl_initlog(char *filename) {
  log_fp = fopen(filename, "w");
  IDL_ToutPush(ridl_logoutput);
}