Back to index

texmacs  1.0.7.15
Classes | Defines | Functions | Variables
tinyscheme_tm.cpp File Reference
#include "tinyscheme_tm.hpp"
#include "object.hpp"
#include "glue.hpp"

Go to the source code of this file.

Classes

struct  arg_list

Defines

#define TST_BLACKBOX   17

Functions

void finalize_blackbox (void *p)
scm scm_eval_string (const char *str)
scm scm_eval_file (FILE *f)
scm scm_apply (scm func, scm args)
scm scm_lookup_string (const char *name)
void scm_define (scm symbol, scm value)
void start_scheme (int argc, char **argv, void(*call_back)(int, char **))
void initialize_scheme ()
scm eval_scheme_file (string file)
scm eval_scheme (string s)
scm TeXmacs_call_scm (arg_list *args)
scm call_scheme (scm fun)
scm call_scheme (scm fun, scm a1)
scm call_scheme (scm fun, scm a1, scm a2)
scm call_scheme (scm fun, scm a1, scm a2, scm a3)
scm call_scheme (scm fun, scm a1, scm a2, scm a3, scm a4)
scm call_scheme (scm fun, array< scm > a)
string scheme_dialect ()
void scm_define_glue (const char *name, scm_foreign_func f)
scm string_to_scm (string s)
scm symbol_to_scm (string s)

Variables

schemethe_scheme = scheme_init_new()
scm object_stack

Class Documentation

struct arg_list

Definition at line 141 of file guile_tm.cpp.

Collaboration diagram for arg_list:
Class Members
SCM * a
scm * a
int n

Define Documentation

#define TST_BLACKBOX   17

Definition at line 19 of file tinyscheme_tm.cpp.


Function Documentation

scm call_scheme ( scm  fun)

Definition at line 235 of file tinyscheme_tm.cpp.

                      {
       scm a[]= { fun }; arg_list args= { 0, a };
       return TeXmacs_call_scm (&args);
}

Here is the call graph for this function:

scm call_scheme ( scm  fun,
scm  a1 
)

Definition at line 241 of file tinyscheme_tm.cpp.

                              {
       scm a[]= { fun, a1 }; arg_list args= { 1, a };
       return TeXmacs_call_scm (&args);
}

Here is the call graph for this function:

scm call_scheme ( scm  fun,
scm  a1,
scm  a2 
)

Definition at line 247 of file tinyscheme_tm.cpp.

                                      {
       scm a[]= { fun, a1, a2 }; arg_list args= { 2, a };
       return TeXmacs_call_scm (&args);
}

Here is the call graph for this function:

scm call_scheme ( scm  fun,
scm  a1,
scm  a2,
scm  a3 
)

Definition at line 253 of file tinyscheme_tm.cpp.

                                              {
       scm a[]= { fun, a1, a2, a3 }; arg_list args= { 3, a };
       return TeXmacs_call_scm (&args);
}

Here is the call graph for this function:

scm call_scheme ( scm  fun,
scm  a1,
scm  a2,
scm  a3,
scm  a4 
)

Definition at line 259 of file tinyscheme_tm.cpp.

                                                      {
       scm a[]= { fun, a1, a2, a3, a4 }; arg_list args= { 4, a };
       return TeXmacs_call_scm (&args);
}

Here is the call graph for this function:

scm call_scheme ( scm  fun,
array< scm a 
)

Definition at line 265 of file tinyscheme_tm.cpp.

                                    {
       const int n= N(a);
       STACK_NEW_ARRAY(v, scm, n+1);
       int i;
       v[0]= fun;
       for (i=0; i<n; i++) v[i+1]= a[i];
       arg_list args= { n, v };
       scm ret= TeXmacs_call_scm (&args);
       STACK_DELETE_ARRAY(scm);
       return ret;
}

Here is the call graph for this function:

Definition at line 192 of file tinyscheme_tm.cpp.

                       {
       // cout << "Eval] " << s << "\n";
       char* _s= as_charp (s);
       scm result= scm_eval_string (_s);
       tm_delete_array (_s);
       return result;
}

Here is the call graph for this function:

Definition at line 159 of file tinyscheme_tm.cpp.

                               {
       //static int cumul= 0;
       //timer tm;
       if (DEBUG_STD) cout << "TeXmacs] Evaluating " << file << "...\n";
       char* _file= as_charp (file);
       FILE *f = fopen(_file, "r");
       scm result= scm_eval_file (f);
       fclose(f);
       tm_delete_array (_file);
       //int extra= tm->watch (); cumul += extra;
       //cout << extra << "\t" << cumul << "\t" << file << "\n";
       return result;
}

Here is the call graph for this function:

void finalize_blackbox ( void *  p)

Definition at line 25 of file tinyscheme_tm.cpp.

                                {
       tm_delete((blackbox*)p);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 79 of file tinyscheme_tm.cpp.

                     {
       if(!scheme_init(the_scheme)) {
              cout << "Could not initialize TinyScheme" << LF;
       }
       scheme_set_output_port_file(the_scheme, stdout);
       scheme_set_input_port_file(the_scheme, stdin);

       const char* init_prg =
#if 0
       "(read-set! keywords 'prefix)\n"
       "(read-enable 'positions)\n"
       "(debug-enable 'debug)\n"
       ";(debug-enable 'backtrace)\n"
       "\n"
#endif
       "(define (display-to-string obj)\n"
       "  (call-with-output-string\n"
       "    (lambda (port) (display obj port))))\n"
       "(define (object->string obj)\n"
       "  (call-with-output-string\n"
       "    (lambda (port) (write obj port))))\n"
       "\n"
       "(define (texmacs-version) \"" TEXMACS_VERSION "\")\n"
       "(define object-stack '(()))";
       
       scm_eval_string (init_prg);
       initialize_glue ();
       object_stack= scm_lookup_string ("object-stack");
       
       
       scm_eval_string("(load (url-concretize \"$TEXMACS_PATH/progs/init-tinyscheme.scm\"))");
       scm_eval_string("(load (url-concretize \"$TEXMACS_PATH/progs/init-scheme-tm.scm\"))");
       
       //REPL
       //scm_eval_file (stdin);
       scheme_load_named_file(the_scheme,stdin,0);

}

Here is the call graph for this function:

Definition at line 284 of file tinyscheme_tm.cpp.

                  {
       return "littlescheme";
}
scm scm_apply ( scm  func,
scm  args 
)

Definition at line 48 of file tinyscheme_tm.cpp.

{
       scheme_call(the_scheme, func, args);
       return the_scheme->value;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void scm_define ( scm  symbol,
scm  value 
)

Definition at line 60 of file tinyscheme_tm.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void scm_define_glue ( const char *  name,
scm_foreign_func  f 
)

Definition at line 288 of file tinyscheme_tm.cpp.

{
       //  cout << "Define glue: " << name << LF;
       scm_define(symbol_to_scm(name), mk_foreign_func (the_scheme, f));
}

Here is the call graph for this function:

scm scm_eval_file ( FILE *  f)

Definition at line 42 of file tinyscheme_tm.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

scm scm_eval_string ( const char *  str)

Definition at line 36 of file tinyscheme_tm.cpp.

{
       scheme_load_string(the_scheme, (char*)str);
       return the_scheme->value;
}

Here is the call graph for this function:

Here is the caller graph for this function:

scm scm_lookup_string ( const char *  name)

Definition at line 55 of file tinyscheme_tm.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void start_scheme ( int  argc,
char **  argv,
void(*)(int, char **)  call_back 
)

Definition at line 72 of file tinyscheme_tm.cpp.

                                                                      {
       // gh_enter (argc, argv, call_back);
       call_back(argc, argv);
       
}

Definition at line 302 of file tinyscheme_tm.cpp.

                         {
       char* _s= as_charp (s);
       scm r= mk_counted_string (the_scheme,_s, N(s));
       tm_delete_array (_s);
       return r;
}

Here is the call graph for this function:

Definition at line 314 of file tinyscheme_tm.cpp.

                         {
       char* _s= as_charp (s);
       scm r= mk_symbol (the_scheme,_s);
       tm_delete_array (_s);
       return r;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 207 of file tinyscheme_tm.cpp.

                                  {
       switch (args->n) {
              default:
              {
                     int i;
                     scm l= scm_null ();
                     for (i=args->n; i>=1; i--)
                            l= scm_cons (args->a[i], l);
                     return scm_apply (args->a[0], l);
              }
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 65 of file tinyscheme_tm.cpp.

Definition at line 22 of file tinyscheme_tm.cpp.