<commit_before>#include <iostream>
#include <julia.h>
#include "JMain.h"
#include "Call.h"
#include "Script.h"
#include "Immediate.h"

using namespace std;

shared_ptr<nj::Result> JMain::eval(const shared_ptr<nj::Expr> &expr)
{
   if(expr.get()) return shared_ptr<nj::Result>(new nj::Result(expr->eval()));
   return shared_ptr<nj::Result>(new nj::Result());
}

JMain::JMain()
{
   initialized = false;
   deactivated = false;
}

void JMain::initialize(int argc,const char *argv[]) throw(nj::InitializationException)
{
   unique_lock<mutex> lock(m_state);

   if(argc >= 1) install_directory = argv[0];
   initialized = true;
}

void JMain::operator()()
{
   bool done = false;

   while(!done)
   {
      unique_lock<mutex> lock(m_state);

      if(!initialized) c_state.wait(lock);
      if(initialized || deactivated) done = true;
   }

   if(!deactivated)
   {
      if(install_directory == "") jl_init(0);
      else jl_init_with_image((char*)install_directory.c_str(),(char*)"sys.ji");
      JL_SET_STACK_BASE;
      done = false;

      while(!done)
      {
         shared_ptr<nj::Expr> expr = dequeue(eval_queue,m_evalq,c_evalq);

         if(expr.get())
         {
            shared_ptr<nj::Result> result = eval(expr);
            enqueue<nj::Result>(result,result_queue,m_resultq,c_resultq);
         }
         else
         {
            shared_ptr<nj::Result> result;
            
            enqueue<nj::Result>(result,result_queue,m_resultq,c_resultq);
         }
         {
            unique_lock<mutex> lock(m_state);

            if(deactivated) done = true;
         }
      }
   }<commit_msg>Conditionally use JL_SET_STACK_BASE only when it's actually defined<commit_after>#include <iostream>
#include <julia.h>
#include "JMain.h"
#include "Call.h"
#include "Script.h"
#include "Immediate.h"

using namespace std;

shared_ptr<nj::Result> JMain::eval(const shared_ptr<nj::Expr> &expr)
{
   if(expr.get()) return shared_ptr<nj::Result>(new nj::Result(expr->eval()));
   return shared_ptr<nj::Result>(new nj::Result());
}

JMain::JMain()
{
   initialized = false;
   deactivated = false;
}

void JMain::initialize(int argc,const char *argv[]) throw(nj::InitializationException)
{
   unique_lock<mutex> lock(m_state);

   if(argc >= 1) install_directory = argv[0];
   initialized = true;
}

void JMain::operator()()
{
   bool done = false;

   while(!done)
   {
      unique_lock<mutex> lock(m_state);

      if(!initialized) c_state.wait(lock);
      if(initialized || deactivated) done = true;
   }

   if(!deactivated)
   {
      if(install_directory == "") jl_init(0);
      else jl_init_with_image((char*)install_directory.c_str(),(char*)"sys.ji");

      #ifdef JL_SET_STACK_BASE
      JL_SET_STACK_BASE;
      #endif

      done = false;

      while(!done)
      {
         shared_ptr<nj::Expr> expr = dequeue(eval_queue,m_evalq,c_evalq);

         if(expr.get())
         {
            shared_ptr<nj::Result> result = eval(expr);
            enqueue<nj::Result>(result,result_queue,m_resultq,c_resultq);
         }
         else
         {
            shared_ptr<nj::Result> result;
            
            enqueue<nj::Result>(result,result_queue,m_resultq,c_resultq);
         }
         {
            unique_lock<mutex> lock(m_state);

            if(deactivated) done = true;
         }
      }
   }
{'fraction_non_alphanumeric': 0.14795918367346939, 'fraction_numerical': 0.001800720288115246, 'mean_word_length': 2.963139120095125, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3545735', 'n_tokens_mistral': 1180, 'n_tokens_neox': 1145, 'n_words': 180}