Exemple #1
0
int
xml_save_file (
    XML_ITEM   *item,
    const char *filename)
{
    FILE
        *xmlfile;                       /*  XML output stream                */
    int
        count;                          /*  How many symbols did we save?    */

    ASSERT (item);
    ASSERT (filename);
    init_charmaps ();                   /*  Initialise character maps        */

    if ((xmlfile = file_open (filename, 'w')) == NULL)
        return XML_FILEERROR;           /*  No permission to write file      */

    /*  Write XML file header                                                */
    fprintf (xmlfile, "<?xml version=\"1.0\"?>\n");

    /*  Output XML root                                                      */
    count = xml_save_file_item (xmlfile, item, 0);

    /*  Output a final carriage return  */
    fprintf (xmlfile, "\n");

    file_close (xmlfile);
    return XML_NOERROR;
}
Exemple #2
0
MODULE initialise_the_program (void)
{
    static Bool
        first_time = TRUE;

    *result = FALSE;                    /*  Assume condition is false        */
    *offset = 0;                        /*  Clear error position             */
    column  = 0;                        /*  Move to start of condition       */
    invert  = 0;                        /*  1 when 'not' found               */

    if (first_time)
      {
        init_charmaps ();               /*  Initialise character maps        */
        first_time = FALSE;
      }
    the_next_event = ok_event;
}
Exemple #3
0
void qore_init(qore_license_t license, const char *def_charset, bool show_module_errors, int n_qore_library_options) {
   qore_license = license;
   qore_library_options = n_qore_library_options;

   // initialize openssl library
   if (!qore_check_option(QLO_DISABLE_OPENSSL_INIT)) {
      OPENSSL_config(0);
      SSL_load_error_strings();
      OpenSSL_add_all_algorithms();
      SSL_library_init();
      ERR_load_crypto_strings();

      // create locks
      for (int i = 0; i < CRYPTO_num_locks(); ++i)
	 q_openssl_mutex_list.push_back(new QoreThreadLock());

      CRYPTO_set_id_callback(q_openssl_id_function);
      CRYPTO_set_locking_callback(q_openssl_locking_function);
   }

   if (qore_library_options & QLO_DISABLE_GARBAGE_COLLECTION)
      q_disable_gc = true;
   
   qore_string_init();
   QoreHttpClientObject::static_init();

   // init random salt
   qore_init_random_salt();
   
   // init threading infrastructure
   init_qore_threads();

   // initialize charset encoding support
   QEM.init(def_charset);

   // init character maps
   init_charmaps();

   init_lib_intern(environ);

   // create default type values
   init_qore_types();

   // set up core operators
   oplist.init();

   // init module subsystem
   QMM.init(show_module_errors);

#ifdef HAVE_SIGNAL_HANDLING
   // init signals
   QSM.init(qore_library_options & QLO_DISABLE_SIGNAL_HANDLING);
#endif

   // initialize static system namespaces
   staticSystemNamespace = new StaticSystemNamespace();

   // set up pseudo-methods
   pseudo_classes_init();

#ifdef _Q_WINDOWS 
   // do windows socket initialization
   WORD wsver = MAKEWORD(2, 2);
   WSADATA wsd;
   int err = WSAStartup(wsver, &wsd);
   if (err)
      printf("qore_init(): WSAStartup() failed with error: %d; sockets will not be available\n", err);
#endif
}