<commit_before>/* 
 * (c) The GHC Team 2001
 *
 * $Id: ilxstubs.c,v 1.2 2001/07/16 09:23:24 rrt Exp $
 *
 * ILX stubs for external function calls
 */

/*
  All foreign imports from the C standard library are stubbed out here,
  so that they are all in the same DLL (HSstd_cbits), and the ILX code
  generator doesn't have to be told or guess which DLL they are in.
  Calls to the Win32 API are annotated with the DLL they come from.

  The general rule is that all foreign imports are assumed to be in
  <current_package>_cbits.dll unless a DLL is explicitly given.
*/


#include "Stg.h"
#include "HsStd.h"
#include <stdlib.h>
#include <stddef.h>
#include <dirent.h>
#include <limits.h>

/* From the RTS */

    /* StgPrimFloat Add to mini-RTS, which is put in a DLL */

    /* Need to be implemented in ILX RTS */
     /*foreign label "prog_argv" prog_argv_label :: Ptr (Ptr (Ptr CChar))
foreign label "prog_argc" prog_argc_label :: Ptr CInt
foreign label "ErrorHdrHook" errorHdrHook :: Ptr ()
../PrelStable.lhs:37:foreign import unsafe freeStablePtr :: StablePtr a -> IO ()
../PrelTopHandler.lhs:49:foreign import ccall "shutdownHaskellAndExit" 
../PrelTopHandler.lhs:77:foreign import ccall "stackOverflow" unsafe
../PrelTopHandler.lhs:80:foreign import ccall "stg_exit" unsafe */

void
stg_exit(I_ n)
{
  fprintf(stderr, "doing stg_exit(%d)\n", n);
  exit(n);
}

/* The code is in includes/Stable.h [sic] */
void
freeStablePtr(StgStablePtr sp)
{<commit_msg>[project @ 2001-08-15 09:23:25 by rrt] Fake argc & argv<commit_after>/* 
 * (c) The GHC Team 2001
 *
 * $Id: ilxstubs.c,v 1.3 2001/08/15 09:23:25 rrt Exp $
 *
 * ILX stubs for external function calls
 */

/*
  All foreign imports from the C standard library are stubbed out here,
  so that they are all in the same DLL (HSstd_cbits), and the ILX code
  generator doesn't have to be told or guess which DLL they are in.
  Calls to the Win32 API are annotated with the DLL they come from.

  The general rule is that all foreign imports are assumed to be in
  <current_package>_cbits.dll unless a DLL is explicitly given.
*/


#include "Stg.h"
#include "HsStd.h"
#include <stdlib.h>
#include <stddef.h>
#include <dirent.h>
#include <limits.h>

/* From the RTS */

    /* StgPrimFloat Add to mini-RTS, which is put in a DLL */

    /* Need to be implemented in ILX RTS */
/*../PrelStable.lhs:37:foreign import unsafe freeStablePtr :: StablePtr a -> IO ()
../PrelTopHandler.lhs:49:foreign import ccall "shutdownHaskellAndExit" 
../PrelTopHandler.lhs:77:foreign import ccall "stackOverflow" unsafe
../PrelTopHandler.lhs:80:foreign import ccall "stg_exit" unsafe */

/* Fake this for now, as a DLL can't refer to main() */
int argc = 0;
char **argv = NULL;

int
prog_argc_addr(void)
{
  return &argc;
}

char ***
prog_argv_addr(void)
{
  return &argv;
}

void
stg_exit(I_ n)
{
  fprintf(stderr, "doing stg_exit(%d)\n", n);
  exit(n);
}

/* The code is in includes/Stable.h [sic] */
void
freeStablePtr(StgStablePtr sp)
{
{'fraction_non_alphanumeric': 0.11667787491593813, 'fraction_numerical': 0.025218560860793545, 'mean_word_length': 3.7147385103011095, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, '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': '4983624', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1056, 'n_words': 373}