<commit_before>/* -*- tab-width : 2 -*- */
#include "cmd-run.h"

char** cmd_run_sbcl(int argc,char** argv,struct sub_command* cmd) {
  char* home=configdir();
  char* arch=uname_m();
  char* os=uname();
  char* impl=(char*)cmd->name;
  char* version=(char*)cmd->short_name;
  /*[binpath for sbcl] --noinform --core param --eval init.lisp
    --no-sysinit --no-userinit [terminating NULL] that total 9 are default. */
  int i;
  char* impl_path=impldir(arch,os,impl,version);
  char* help=get_opt("help",0);
  char* script=get_opt("script",0);
  char* image=get_opt("image",0);
  char* program=get_opt("program",0);
  char* dynamic_space_size=get_opt("dynamic-space-size",0);
  char* control_stack_size=get_opt("control-stack-size",0);
  char* withoutroswell=get_opt("without-roswell",0);
  char* enable_debugger=get_opt("enable-debugger",0);

  char* sbcl_home=cat(home,impl_path,"/lib/sbcl",NULL);
  LVal ret=0;

  int issystem=(strcmp("system",version)==0);
  char *bin=issystem?
    strcmp(impl,"sbcl32")==0?truename(which("sbcl32")):truename(which("sbcl")):
    cat(home,impl_path,SLASH,"bin",SLASH,"sbcl",EXE_EXTENTION,NULL);
  setenv("SBCL_HOME",sbcl_home,1);

  s(arch),s(os),s(sbcl_home);
  ret=conss(bin,ret);

  /* runtime options from here */
  if(image) {
    char* core=NULL;
    char* ld=lispdir();
    char* base=basedir();
    char* bindir=cat(base,"bin"SLASH,NULL);
    char* script2=q(script?script+1:"");
    int pos= position_char("\"",script2);
    core=cat(base,impl_path,SLASH,"dump",SLASH,image,".core",NULL);
    if(pos!=-1)
      script2[pos]='\0';
    if(script &&
       (strncmp(ld,script2,strlen(ld)) ==0 ||
        strncmp(bindir,script2,strlen(bindir)) ==0) &&
       (!file_exist_p(core) ||
        (file_newer_p(script2,core) && !file_newer_p(core,script2)))) {
      cond_printf(1,"\nbuildcore:%s\ncause newer script:%s\n",core,script2);
      setup(image);
    }
    s(ld),s(script2),s(bindir);
    if(file_exist_p(core)) {
      ret=conss(core,conss(q("--core"),ret));
    }else
      cond_printf(1,"core not found:%s\n",core);
  }else if(!issystem)
    ret=conss(cat(home,impl_path,SLASH,"lib",SLASH,"sbcl",SLASH,"sbcl.core",NULL),
              conss(q("--core"),ret));
  if(help)
    ret=conss(q("--help"),ret);
  if(!withoutroswell)
    ret=conss(q("--noinform"),ret);

  if(dynamic_space_size)
    ret=conss(q(dynamic_space_size),conss(q("--dynamic-space-size"),ret));
  if(control_stack_size)
    ret=conss(q(control_stack_size),conss(q("--control-stack-size"),ret));
  if(get_opt("version",0))
    ret=conss(q("--version"),ret);

  for(i=1;i<argc;++i) {
    if(strcmp(argv[i],"--eval")==0||<commit_msg>fix guicho mentioned at #285.<commit_after>/* -*- tab-width : 2 -*- */
#include "cmd-run.h"

char** cmd_run_sbcl(int argc,char** argv,struct sub_command* cmd) {
  char* home=configdir();
  char* arch=uname_m();
  char* os=uname();
  char* impl=(char*)cmd->name;
  char* version=(char*)cmd->short_name;
  /*[binpath for sbcl] --noinform --core param --eval init.lisp
    --no-sysinit --no-userinit [terminating NULL] that total 9 are default. */
  int i;
  char* impl_path=impldir(arch,os,impl,version);
  char* help=get_opt("help",0);
  char* script=get_opt("script",0);
  char* image=get_opt("image",0);
  char* program=get_opt("program",0);
  char* dynamic_space_size=get_opt("dynamic-space-size",0);
  char* control_stack_size=get_opt("control-stack-size",0);
  char* withoutroswell=get_opt("without-roswell",0);
  char* enable_debugger=get_opt("enable-debugger",0);

  char* sbcl_home=cat(home,impl_path,"/lib/sbcl",NULL);
  LVal ret=0;

  int issystem=(strcmp("system",version)==0);
  char *bin=issystem?
    strcmp(impl,"sbcl32")==0?truename(which("sbcl32")):truename(which("sbcl")):
    cat(home,impl_path,SLASH,"bin",SLASH,"sbcl",EXE_EXTENTION,NULL);
  setenv("SBCL_HOME",sbcl_home,1);

  s(arch),s(os),s(sbcl_home);
  ret=conss(bin,ret);

  /* runtime options from here */
  if(image) {
    char* core=NULL;
    char* ld=lispdir();
    char* base=basedir();
    char* bindir=cat(base,"bin"SLASH,NULL);
    char* script2=q(script?script+1:"");
    int pos= position_char("\"",script2);
    core=cat(base,impl_path,SLASH,"dump",SLASH,image,".core",NULL);
    if(pos!=-1)
      script2[pos]='\0';
    if(script &&
       (strncmp(ld,script2,strlen(ld)) ==0 ||
        strncmp(bindir,script2,strlen(bindir)) ==0) &&
       (!file_exist_p(core) ||
        (file_newer_p(script2,core) && !file_newer_p(core,script2))) &&
       strcmp(impl,DEFAULT_IMPL)==0) {
      cond_printf(1,"\nbuildcore:%s\ncause newer script:%s\n",core,script2);
      setup(image);
    }
    s(ld),s(script2),s(bindir);
    if(file_exist_p(core)) {
      ret=conss(core,conss(q("--core"),ret));
    }else
      cond_printf(1,"core not found:%s\n",core);
  }else if(!issystem)
    ret=conss(cat(home,impl_path,SLASH,"lib",SLASH,"sbcl",SLASH,"sbcl.core",NULL),
              conss(q("--core"),ret));
  if(help)
    ret=conss(q("--help"),ret);
  if(!withoutroswell)
    ret=conss(q("--noinform"),ret);

  if(dynamic_space_size)
    ret=conss(q(dynamic_space_size),conss(q("--dynamic-space-size"),ret));
  if(control_stack_size)
    ret=conss(q(control_stack_size),conss(q("--control-stack-size"),ret));
  if(get_opt("version",0))
    ret=conss(q("--version"),ret);

  for(i=1;i<argc;++i) {
    if(strcmp(argv[i],"--eval")==0||
{'fraction_non_alphanumeric': 0.21451281092201235, 'fraction_numerical': 0.014587619225734056, 'mean_word_length': 4.883388338833884, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '763986', 'n_tokens_mistral': 2168, 'n_tokens_neox': 2149, 'n_words': 258}