text: /* include only picoc.h here - should be able to use it with only the external interfaces, no internals from interpreter.h */
  #include "picoc.h"
  
  /* platform-dependent code for running programs is in this file */
  
  #include <stdlib.h>
  #include <stdio.h>
  #include <string.h>
  #include "platform_conf.h"
  
  int picoc_main(int argc, char **argv)
  {
      int ParamCount = 1;
      int DontRunMain = FALSE;
      int StackSize = getenv("STACKSIZE") ? atoi(getenv("STACKSIZE")) : PICOC_STACK_SIZE;
      
      if (argc < 2)
      {
          printf("Format: picoc <csource1.c>... [- <arg1>...]    : run a program (calls main() to start it)\n"
                 "        picoc -s <csource1.c>... [- <arg1>...] : script mode - runs the program without calling main()\n"
                 "        picoc -i                               : interactive mode\n");
  	return 1;
      }
      
      PicocInitialise(StackSize);
      
      if (strcmp(argv[ParamCount], "-s") == 0 || strcmp(argv[ParamCount], "-m") == 0)
      {
          DontRunMain = TRUE;
          PicocIncludeAllSystemHeaders();
          ParamCount++;
      }
          
      if (argc > ParamCount && strcmp(argv[ParamCount], "-i") == 0)
      {
          PicocIncludeAllSystemHeaders();
          PicocParseInteractive();
      }
      else
      {
          if (PicocPlatformSetExitPoint())
          {
              PicocCleanup();
              return PicocExitValue;
          }
          
          for (; ParamCount < argc && strcmp(argv[ParamCount], "-") != 0; ParamCount++)
              PicocPlatformScanFile(argv[ParamCount]);
          
          if (!DontRunMain)
              PicocCallMain(argc - ParamCount, &argv[ParamCount]);
      }
      
      PicocCleanup();
      return PicocExitValue;
  }
  