The Machine Perception Toolbox

[Introduction]- [News]- [Download]- [Screenshots]- [Manual (pdf)]- [Forums]- [API Reference]- [Repository ]

 

Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

builtins.h File Reference

#include "frames.h"

Include dependency graph for builtins.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void backtrace (FRAME *frame)
LISTbuiltin_backtrace (PARSE *parse, FRAME *args)
LISTbuiltin_calc (PARSE *parse, FRAME *args)
LISTbuiltin_caller_module (PARSE *parse, FRAME *args)
LISTbuiltin_delete_module (PARSE *parse, FRAME *args)
LISTbuiltin_depends (PARSE *parse, FRAME *args)
LISTbuiltin_echo (PARSE *parse, FRAME *args)
LISTbuiltin_exit (PARSE *parse, FRAME *args)
LISTbuiltin_export (PARSE *parse, FRAME *args)
LISTbuiltin_flags (PARSE *parse, FRAME *args)
LISTbuiltin_glob (PARSE *parse, FRAME *args)
LISTbuiltin_hdrmacro (PARSE *parse, FRAME *args)
LISTbuiltin_import (PARSE *parse, FRAME *args)
LISTbuiltin_import_module (PARSE *parse, FRAME *args)
LISTbuiltin_imported_modules (PARSE *parse, FRAME *frame)
LISTbuiltin_instance (PARSE *parse, FRAME *frame)
LISTbuiltin_match (PARSE *parse, FRAME *args)
LISTbuiltin_normalize_path (PARSE *parse, FRAME *frame)
LISTbuiltin_pwd (PARSE *parse, FRAME *args)
LISTbuiltin_rulenames (PARSE *parse, FRAME *args)
LISTbuiltin_search_for_target (PARSE *parse, FRAME *args)
LISTbuiltin_sort (PARSE *parse, FRAME *frame)
LISTbuiltin_subst (PARSE *parse, FRAME *args)
LISTbuiltin_update (PARSE *parse, FRAME *args)
LISTbuiltin_varnames (PARSE *parse, FRAME *args)
void load_builtins ()


Function Documentation

void backtrace FRAME frame  ) 
 

LIST* builtin_backtrace PARSE parse,
FRAME args
 

Definition at line 843 of file builtins.c.

References frame::args, file, FRAME, get_source_line(), LIST, list_new(), lol_get(), frame::module, module_t::name, newstr(), PARSE, frame::prev, frame::procedure, frame::rulename, sprintf(), and _list::string.

Referenced by load_builtins().

00844 {
00845     LIST* levels_arg = lol_get( frame->args, 0 );
00846     int levels = levels_arg ? atoi( levels_arg->string ) : ((unsigned int)(-1) >> 1) ;
00847 
00848     LIST* result = L0;
00849     for(; (frame = frame->prev) && levels ; --levels )
00850     {
00851         char* file;
00852         int line;
00853         char buf[32];
00854         get_source_line( frame->procedure, &file, &line );
00855         sprintf( buf, "%d", line );
00856         result = list_new( result, newstr( file ) );
00857         result = list_new( result, newstr( buf ) );
00858         result = list_new( result, newstr( frame->module->name ) );
00859         result = list_new( result, newstr( frame->rulename ) );
00860     }
00861     return result;
00862 }

Here is the call graph for this function:

LIST* builtin_calc PARSE parse,
FRAME args
 

Definition at line 263 of file builtins.c.

References frame::args, FRAME, LIST, list_new(), list_next, lol_get(), newstr(), PARSE, sprintf(), and _list::string.

Referenced by load_builtins().

00266 {
00267     LIST *arg = lol_get( frame->args, 0 );
00268 
00269     LIST *result = 0;
00270     long lhs_value;
00271     long rhs_value;
00272     long result_value;
00273     char buffer [16];
00274     const char* lhs;
00275     const char* op;
00276     const char* rhs;
00277 
00278     if (arg == 0) return L0;
00279     lhs = arg->string;
00280 
00281     arg = list_next( arg );
00282     if (arg == 0) return L0;
00283     op = arg->string;
00284 
00285     arg = list_next( arg );
00286     if (arg == 0) return L0;
00287     rhs = arg->string;
00288 
00289     lhs_value = atoi (lhs);
00290     rhs_value = atoi (rhs);
00291 
00292     if (strcmp ("+", op) == 0)
00293     {
00294         result_value = lhs_value + rhs_value;
00295     }
00296     else if (strcmp ("-", op) == 0)
00297     {
00298         result_value = lhs_value - rhs_value;
00299     }
00300     else
00301     {
00302         return L0;
00303     }
00304 
00305     sprintf (buffer, "%ld", result_value);
00306     result = list_new( result, newstr( buffer ) );
00307     return result;
00308 }

Here is the call graph for this function:

LIST* builtin_caller_module PARSE parse,
FRAME args
 

Definition at line 875 of file builtins.c.

References frame::args, FRAME, i, L0, LIST, list_new(), lol_get(), frame::module, module_t::name, newstr(), PARSE, frame::prev, root_module(), _list::string, string_copy(), string_free(), string_pop_back(), and string::value.

Referenced by load_builtins().

00876 {
00877     LIST* levels_arg = lol_get( frame->args, 0 );
00878     int levels = levels_arg ? atoi( levels_arg->string ) : 0 ;
00879 
00880     int i;
00881     for (i = 0; i < levels + 2 && frame->prev; ++i)
00882         frame = frame->prev;
00883 
00884     if ( frame->module == root_module() )
00885     {
00886         return L0;
00887     }
00888     else
00889     {
00890         LIST* result;
00891         
00892         string name;
00893         string_copy( &name, frame->module->name );
00894         string_pop_back( &name );
00895 
00896         result = list_new( L0, newstr(name.value) );
00897         
00898         string_free( &name );
00899         
00900         return result;
00901     }
00902 }

Here is the call graph for this function:

LIST* builtin_delete_module PARSE parse,
FRAME args
 

Definition at line 655 of file builtins.c.

References frame::args, bindmodule(), delete_module(), FRAME, LIST, lol_get(), PARSE, and _list::string.

Referenced by load_builtins().

00658 {
00659     LIST *arg0 = lol_get( frame->args, 0 );
00660     LIST *result = L0;
00661     module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
00662 
00663     delete_module( source_module );
00664     return result;
00665 }

Here is the call graph for this function:

LIST* builtin_depends PARSE parse,
FRAME args
 

Definition at line 319 of file builtins.c.

References frame::args, bindtarget(), copytarget(), _target::depends, FRAME, _target::includes, LIST, list_next, lol_get(), _PARSE::num, _target::original_target, PARSE, _list::string, TARGET, and targetlist().

Referenced by load_builtins().

00322 {
00323         LIST *targets = lol_get( frame->args, 0 );
00324         LIST *sources = lol_get( frame->args, 1 );
00325         int which = parse->num;
00326         LIST *l;
00327 
00328         for( l = targets; l; l = list_next( l ) )
00329         {
00330             TARGET *t = bindtarget( l->string );
00331 
00332             /* If doing INCLUDES, switch to the TARGET's include */
00333             /* TARGET, creating it if needed.  The internal include */
00334             /* TARGET shares the name of its parent. */
00335 
00336             if( parse->num )
00337             {
00338             if( !t->includes ) {
00339                 t->includes = copytarget( t );
00340                 t->includes->original_target = t;
00341             }
00342             t = t->includes;
00343             }
00344 
00345             t->depends = targetlist( t->depends, sources );
00346         }
00347 
00348         return L0;
00349 }

Here is the call graph for this function:

LIST* builtin_echo PARSE parse,
FRAME args
 

Definition at line 359 of file builtins.c.

References frame::args, FRAME, list_print(), lol_get(), and PARSE.

Referenced by load_builtins().

00362 {
00363         list_print( lol_get( frame->args, 0 ) );
00364         printf( "\n" );
00365         return L0;
00366 }

Here is the call graph for this function:

LIST* builtin_exit PARSE parse,
FRAME args
 

Definition at line 376 of file builtins.c.

References frame::args, EXITBAD, FRAME, list_print(), lol_get(), and PARSE.

Referenced by load_builtins().

00379 {
00380         list_print( lol_get( frame->args, 0 ) );
00381         printf( "\n" );
00382         exit( EXITBAD ); /* yeech */
00383         return L0;
00384 }

Here is the call graph for this function:

LIST* builtin_export PARSE parse,
FRAME args
 

Definition at line 753 of file builtins.c.

References frame::args, bindmodule(), FRAME, hashcheck, HASHDATA, LIST, list_next, lol_get(), m, module_t::name, _rule::name, PARSE, r, RULE, module_t::rules, _list::string, and unknown_rule().

Referenced by load_builtins().

00756 {
00757     LIST *module_list = lol_get( frame->args, 0 );
00758     LIST *rules = lol_get( frame->args, 1 );
00759 
00760     module_t* m = bindmodule( module_list ? module_list->string : 0 );
00761     
00762             
00763     for ( ; rules; rules = list_next( rules ) )
00764     {
00765         RULE r_, *r = &r_;
00766         r_.name = rules->string;
00767                 
00768         if ( !m->rules || !hashcheck( m->rules, (HASHDATA**)&r ) )
00769             unknown_rule( frame, "EXPORT", m->name, r_.name );
00770         
00771         r->exported = 1;
00772     }
00773     return L0;
00774 }

Here is the call graph for this function:

LIST* builtin_flags PARSE parse,
FRAME args
 

Definition at line 394 of file builtins.c.

References frame::args, bindtarget(), _target::flags, FRAME, LIST, list_next, lol_get(), _PARSE::num, PARSE, and _list::string.

Referenced by load_builtins().

00397 {
00398         LIST *l = lol_get( frame->args, 0 );
00399 
00400         for( ; l; l = list_next( l ) )
00401             bindtarget( l->string )->flags |= parse->num;
00402 
00403         return L0;
00404 }

Here is the call graph for this function:

LIST* builtin_glob PARSE parse,
FRAME args
 

Definition at line 479 of file builtins.c.

References frame::args, builtin_glob_back(), globbing::case_insensitive, downcase_list(), file_dirscan(), FRAME, LIST, list_free(), list_next, lol_get(), PARSE, globbing::patterns, r, globbing::results, and _list::string.

Referenced by load_builtins().

00482 {
00483     LIST *l = lol_get( frame->args, 0 );
00484     LIST *r = lol_get( frame->args, 1 );
00485     
00486     struct globbing globbing;
00487 
00488     globbing.results = L0;
00489     globbing.patterns = r;
00490     
00491     globbing.case_insensitive
00492 # if defined( OS_NT ) || defined( OS_CYGWIN )
00493        = l;  /* always case-insensitive if any files can be found */
00494 # else 
00495        = lol_get( frame->args, 2 );
00496 # endif
00497 
00498     if ( globbing.case_insensitive )
00499     {
00500         globbing.patterns = downcase_list( r );
00501     }
00502     
00503     for( ; l; l = list_next( l ) )
00504         file_dirscan( l->string, builtin_glob_back, &globbing );
00505 
00506     if ( globbing.case_insensitive )
00507     {
00508         list_free( globbing.patterns );
00509     }
00510     return globbing.results;
00511 }

Here is the call graph for this function:

LIST* builtin_hdrmacro PARSE parse,
FRAME args
 

Definition at line 566 of file builtins.c.

References frame::args, bindtarget(), FRAME, LIST, list_next, lol_get(), macro_headers(), PARSE, _list::string, and TARGET.

Referenced by load_builtins().

00569 {
00570   LIST*  l = lol_get( frame->args, 0 );
00571   
00572   for ( ; l; l = list_next(l) )
00573   {
00574     TARGET*  t = bindtarget( l->string );
00575 
00576     /* scan file for header filename macro definitions */    
00577     if ( DEBUG_HEADER )
00578       printf( "scanning '%s' for header file macro definitions\n",
00579               l->string );
00580 
00581     macro_headers( t );
00582   }
00583   
00584   return L0;
00585 }

Here is the call graph for this function:

LIST* builtin_import PARSE parse,
FRAME args
 

Definition at line 692 of file builtins.c.

References frame::args, backtrace(), backtrace_line(), bindmodule(), FRAME, hashcheck, HASHDATA, import_rule(), LIST, list_next, list_print(), lol_get(), _rule::module, module_t::name, _rule::name, PARSE, frame::prev, r, RULE, module_t::rules, _list::string, and unknown_rule().

Referenced by load_builtins().

00695 {
00696     LIST *source_module_list = lol_get( frame->args, 0 );
00697     LIST *source_rules = lol_get( frame->args, 1 );
00698     LIST *target_module_list = lol_get( frame->args, 2 );
00699     LIST *target_rules = lol_get( frame->args, 3 );
00700     LIST *localize = lol_get( frame->args, 4 );
00701 
00702     module_t* target_module = bindmodule( target_module_list ? target_module_list->string : 0 );
00703     module_t* source_module = bindmodule( source_module_list ? source_module_list->string : 0 );
00704     
00705     LIST *source_name, *target_name;
00706             
00707     for ( source_name = source_rules, target_name = target_rules;
00708           source_name && target_name;
00709           source_name = list_next( source_name )
00710           , target_name = list_next( target_name ) )
00711     {
00712         RULE r_, *r = &r_, *imported;
00713         r_.name = source_name->string;
00714                 
00715         if ( !source_module->rules
00716              || !hashcheck( source_module->rules, (HASHDATA**)&r )
00717             )
00718         {
00719             unknown_rule( frame, "IMPORT", source_module->name, r_.name );
00720         }
00721         
00722         imported = import_rule( r, target_module, target_name->string );
00723         if ( localize )
00724             imported->module = target_module;
00725         imported->exported = 0; /* this rule is really part of some other module; just refer to it here, but don't let it out */
00726     }
00727     
00728     if ( source_name || target_name )
00729     {
00730         backtrace_line( frame->prev );
00731         printf( "import error: length of source and target rule name lists don't match!\n" );
00732         printf( "    source: " );
00733         list_print( source_rules );
00734         printf( "\n    target: " );
00735         list_print( target_rules );
00736         printf( "\n" );
00737         backtrace( frame->prev );
00738         exit(1);
00739     }
00740 
00741     return L0;
00742 }

Here is the call graph for this function:

LIST* builtin_import_module PARSE parse,
FRAME args
 

Definition at line 939 of file builtins.c.

References frame::args, bindmodule(), FRAME, import_module(), LIST, lol_get(), m, PARSE, root_module(), and _list::string.

Referenced by load_builtins().

00940 {
00941     LIST* arg1 = lol_get( frame->args, 0 );
00942     LIST* arg2 = lol_get( frame->args, 1 );
00943 
00944     module_t* m = arg2 ? bindmodule(arg2->string) : root_module();
00945 
00946     import_module(arg1, m);
00947 
00948     return L0;
00949 }

Here is the call graph for this function:

LIST* builtin_imported_modules PARSE parse,
FRAME frame
 

Definition at line 952 of file builtins.c.

References frame::args, bindmodule(), FRAME, imported_modules(), LIST, lol_get(), PARSE, and _list::string.

Referenced by load_builtins().

00953 {
00954     LIST *arg0 = lol_get( frame->args, 0 );
00955     module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
00956 
00957     return imported_modules(source_module);
00958 }

Here is the call graph for this function:

LIST* builtin_instance PARSE parse,
FRAME frame
 

Definition at line 960 of file builtins.c.

References frame::args, bindmodule(), module_t::class_module, FRAME, LIST, lol_get(), PARSE, and _list::string.

Referenced by load_builtins().

00961 {
00962     LIST* arg1 = lol_get( frame->args, 0 );
00963     LIST* arg2 = lol_get( frame->args, 1 );
00964 
00965     module_t* instance = bindmodule( arg1->string );
00966     module_t* class_module = bindmodule( arg2->string );
00967     instance->class_module = class_module;
00968 
00969     return L0;
00970 }

Here is the call graph for this function:

LIST* builtin_match PARSE parse,
FRAME args
 

Definition at line 518 of file builtins.c.

References frame::args, regexp::endp, FRAME, i, LIST, list_new(), lol_get(), newstr(), _list::next, PARSE, r, regex_compile(), regexec(), regexp::startp, _list::string, string_append_range(), string_free(), string_new(), string_truncate(), and string::value.

Referenced by load_builtins().

00521 {
00522         LIST *l, *r;
00523         LIST *result = 0;
00524         
00525         string buf[1];
00526         string_new(buf);
00527 
00528         /* For each pattern */
00529 
00530         for( l = lol_get( frame->args, 0 ); l; l = l->next )
00531         {
00532             /* Result is cached and intentionally never freed */
00533             regexp *re = regex_compile( l->string );
00534 
00535             /* For each string to match against */
00536             for( r = lol_get( frame->args, 1 ); r; r = r->next )
00537             {
00538                 if( regexec( re, r->string ) )
00539                 {
00540                     int i, top;
00541 
00542                     /* Find highest parameter */
00543 
00544                     for( top = NSUBEXP; top-- > 1; )
00545                         if( re->startp[top] )
00546                             break;
00547 
00548                     /* And add all parameters up to highest onto list. */
00549                     /* Must have parameters to have results! */
00550 
00551                     for( i = 1; i <= top; i++ )
00552                     {
00553                         string_append_range( buf, re->startp[i], re->endp[i] );
00554                         result = list_new( result, newstr( buf->value ) );
00555                         string_truncate( buf, 0 );
00556                     }
00557                 }
00558             }
00559         }
00560 
00561         string_free( buf );
00562         return result;
00563 }

Here is the call graph for this function:

LIST* builtin_normalize_path PARSE parse,
FRAME frame
 

Definition at line 980 of file builtins.c.

References frame::args, end, FRAME, LIST, list_new(), lol_get(), newstr(), p, PARSE, string::size, _list::string, string_append(), string_copy(), string_free(), string_new(), string_push_back(), and string::value.

Referenced by load_builtins().

00981 {
00982     LIST* arg1 = lol_get( frame->args, 0 );
00983 
00984     /* First, we iterate over all '/'-separated elements, starting from
00985        the end of string. If we see '..', we remove previous path elements.
00986        If we see '.', we remove it.
00987        The removal is done by putting '\1' in the string. After all the string
00988        is processed, we do a second pass, removing '\1' characters.
00989     */
00990     
00991     string in[1], out[1], tmp[1];
00992     char* end;      /* Last character of the part of string still to be processed. */
00993     char* current;  /* Working pointer. */  
00994     int dotdots = 0; /* Number of '..' elements seen and not processed yet. */
00995     int rooted = arg1->string[0] == '/';
00996     char* result;
00997 
00998     /* Make a copy of input: we should not change it. */
00999     string_new(in);
01000     if (!rooted)
01001         string_push_back(in, '/');
01002     string_append(in, arg1->string);
01003     
01004 
01005     end = in->value + in->size - 1;
01006     current = end;
01007     
01008     for(;end >= in->value;) {
01009         /* Set 'current' to the next occurence of '/', which always exists. */
01010         for(current = end; *current != '/'; --current)
01011             ;
01012         
01013         if (current == end && current != in->value) {
01014             /* Found a trailing slash. Remove it. */
01015             *current = '\1';
01016         } else if (current == end && *(current+1) == '/') {
01017             /* Found duplicated slash. Remove it. */
01018             *current = '\1';
01019         } else if (end - current == 1 && strncmp(current, "/.", 2) == 0) {
01020             /* Found '/.'. Drop them all. */
01021             *current = '\1';
01022             *(current+1) = '\1';                   
01023         } else if (end - current == 2 && strncmp(current, "/..", 3) == 0) {
01024             /* Found '/..' */                
01025             *current = '\1';
01026             *(current+1) = '\1';                   
01027             *(current+2) = '\1';                   
01028             ++dotdots;
01029         } else if (dotdots) {
01030             char* p = current;
01031             memset(current, '\1', end-current+1);
01032             --dotdots;
01033         }                 
01034         end = current-1;
01035     }
01036 
01037 
01038     string_new(tmp);
01039     while(dotdots--)
01040         string_append(tmp, "/..");
01041     string_append(tmp, in->value);
01042     string_copy(in, tmp->value);
01043     string_free(tmp);
01044         
01045        
01046     string_new(out);
01047     /* The resulting path is either empty or has '/' as the first significant
01048        element. If the original path was not rooted, we need to drop first '/'. 
01049        If the original path was rooted, and we've got empty path, need to add '/'
01050     */
01051     if (!rooted) {
01052         current = strchr(in->value, '/');
01053         if (current)
01054             *current = '\1';
01055     } 
01056        
01057     for (current = in->value; *current; ++current)
01058         if (*current != '\1')
01059             string_push_back(out, *current);
01060 
01061     
01062     result = newstr(out->size ? out->value : (rooted ? "/" : "."));
01063     string_free(in);
01064     string_free(out);
01065 
01066     return list_new(0, result);
01067 
01068 }

Here is the call graph for this function:

LIST* builtin_pwd PARSE parse,
FRAME args
 

Definition at line 910 of file builtins.c.

References FRAME, PARSE, and pwd().

Referenced by load_builtins().

00911 {
00912     return pwd();
00913 }

Here is the call graph for this function:

LIST* builtin_rulenames PARSE parse,
FRAME args
 

Definition at line 605 of file builtins.c.

References add_rule_name(), frame::args, bindmodule(), FRAME, hashenumerate(), LIST, lol_get(), PARSE, module_t::rules, and _list::string.

Referenced by load_builtins().

00608 {
00609     LIST *arg0 = lol_get( frame->args, 0 );
00610     LIST *result = L0;
00611     module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
00612 
00613     if ( source_module->rules )
00614         hashenumerate( source_module->rules, add_rule_name, &result );
00615     return result;
00616 }

Here is the call graph for this function:

LIST* builtin_search_for_target PARSE parse,
FRAME args
 

Definition at line 930 of file builtins.c.

References frame::args, FRAME, L0, LIST, list_new(), lol_get(), _target::name, PARSE, search_for_target(), _list::string, and TARGET.

Referenced by load_builtins().

00931 {
00932     LIST* arg1 = lol_get( frame->args, 0 );
00933     LIST* arg2 = lol_get( frame->args, 1 );
00934 
00935     TARGET* t = search_for_target( arg1->string, arg2 );
00936     return list_new( L0, t->name );
00937 }

Here is the call graph for this function:

LIST* builtin_sort PARSE parse,
FRAME frame
 

Definition at line 973 of file builtins.c.

References frame::args, FRAME, LIST, list_sort(), lol_get(), and PARSE.

Referenced by load_builtins().

00974 {
00975     LIST* arg1 = lol_get( frame->args, 0 );
00976 
00977     return list_sort(arg1);
00978 }

Here is the call graph for this function:

LIST* builtin_subst PARSE parse,
FRAME args
 

Definition at line 36 of file subst.c.

References frame::args, BUFLEN, regexp::endp, FRAME, LIST, list_new(), list_next, lol_get(), n, newstr(), PARSE, regex_compile(), regexec(), regexp::startp, and _list::string.

Referenced by load_builtins().

00039 {        
00040   LIST* result = L0;
00041   LIST* arg1 = lol_get( frame->args, 0 );
00042 
00043   if ( arg1 && list_next(arg1) && list_next(list_next(arg1)) )
00044   {    
00045   
00046       const char* source = arg1->string;
00047       const char* pattern = list_next(arg1)->string;
00048       regexp* repat = regex_compile( pattern );
00049 
00050       if ( regexec( repat, (char*)source) )
00051       {
00052           LIST* subst = list_next(arg1);
00053           
00054           while ((subst = list_next(subst)) != L0)
00055           {
00056 # define BUFLEN 4096
00057               char buf[BUFLEN + 1];
00058               const char* in = subst->string;
00059               char* out = buf;
00060 
00061               for ( in = subst->string; *in && out < buf + BUFLEN; ++in )
00062               {
00063                   if ( *in == '\\' || *in == '$' )
00064                   {
00065                       ++in;
00066                       if ( *in == 0 )
00067                       {
00068                           break;
00069                       }
00070                       else if ( *in >= '0' && *in <= '9' )
00071                       {
00072                           unsigned n = *in - '0';
00073                           const size_t srclen = repat->endp[n] - repat->startp[n];
00074                           const size_t remaining = buf + BUFLEN - out;
00075                           const size_t len = srclen < remaining ? srclen : remaining;
00076                           memcpy( out, repat->startp[n], len );
00077                           out += len;
00078                           continue;
00079                       }
00080                       /* fall through and copy the next character */
00081                   }
00082                   *out++ = *in;
00083               }
00084               *out = 0;
00085 
00086               result = list_new( result, newstr( buf ) );
00087 #undef BUFLEN
00088           }
00089       }
00090   }
00091   
00092   return result;
00093 }

Here is the call graph for this function:

LIST* builtin_update PARSE parse,
FRAME args
 

Definition at line 919 of file builtins.c.

References frame::args, clear_targets_to_update(), FRAME, L0, LIST, list_copy(), list_next, lol_get(), mark_target_for_updating(), newstr(), PARSE, _list::string, and targets_to_update().

Referenced by load_builtins().

00920 {
00921     LIST* result = list_copy( L0, targets_to_update() );
00922     LIST* arg1 = lol_get( frame->args, 0 );
00923     clear_targets_to_update();
00924     for ( ; arg1; arg1 = list_next( arg1 ) )
00925         mark_target_for_updating( newstr(arg1->string) );
00926     return result;
00927 }

Here is the call graph for this function:

LIST* builtin_varnames PARSE parse,
FRAME args
 

Definition at line 636 of file builtins.c.

References add_hash_key(), frame::args, bindmodule(), FRAME, hashenumerate(), LIST, lol_get(), PARSE, _list::string, and module_t::variables.

Referenced by load_builtins().

00639 {
00640     LIST *arg0 = lol_get( frame->args, 0 );
00641     LIST *result = L0;
00642     module_t* source_module = bindmodule( arg0 ? arg0->string : 0 );
00643 
00644     if ( source_module->variables )
00645         hashenumerate( source_module->variables, add_hash_key, &result );
00646     return result;
00647 }

Here is the call graph for this function:

void load_builtins  ) 
 

Definition at line 79 of file builtins.c.

References bind_builtin(), builtin_backtrace(), builtin_calc(), builtin_caller_module(), builtin_delete_module(), builtin_depends(), builtin_echo(), builtin_exit(), builtin_export(), builtin_flags(), builtin_glob(), builtin_hdrmacro(), builtin_import(), builtin_import_module(), builtin_imported_modules(), builtin_instance(), builtin_match(), builtin_normalize_path(), builtin_pwd(), builtin_rulenames(), builtin_search_for_target(), builtin_sort(), builtin_subst(), builtin_update(), builtin_varnames(), duplicate_rule(), T_FLAG_FAIL_EXPECTED, T_FLAG_LEAVES, T_FLAG_NOCARE, T_FLAG_NOTFILE, T_FLAG_NOUPDATE, T_FLAG_RMOLD, T_FLAG_TEMP, and T_FLAG_TOUCHED.

Referenced by main().

00080 {
00081     duplicate_rule( "Always" ,
00082       bind_builtin( "ALWAYS" ,
00083                     builtin_flags, T_FLAG_TOUCHED, 0 ) );
00084 
00085     duplicate_rule( "Depends" ,
00086       bind_builtin( "DEPENDS" ,
00087                     builtin_depends, 0, 0 ) );
00088 
00089     duplicate_rule( "echo" ,
00090     duplicate_rule( "Echo" ,
00091       bind_builtin( "ECHO" ,
00092                     builtin_echo, 0, 0 ) ) );
00093 
00094     duplicate_rule( "exit" ,
00095     duplicate_rule( "Exit" ,
00096       bind_builtin( "EXIT" ,
00097                     builtin_exit, 0, 0 ) ) );
00098 
00099     {
00100         char * args[] = { "directories", "*", ":", "patterns", "*", ":", "case-insensitive", "?", 0 };
00101         duplicate_rule(
00102             "Glob" ,
00103             bind_builtin( "GLOB" , builtin_glob, 0, args )
00104             );
00105     }
00106 
00107     duplicate_rule( "Includes" ,
00108       bind_builtin( "INCLUDES" ,
00109                     builtin_depends, 1, 0 ) );
00110 
00111     duplicate_rule( "Leaves" ,
00112       bind_builtin( "LEAVES" ,
00113                     builtin_flags, T_FLAG_LEAVES, 0 ) );
00114 
00115     duplicate_rule( "Match" ,
00116       bind_builtin( "MATCH" ,
00117                     builtin_match, 0, 0 ) );
00118 
00119     duplicate_rule( "NoCare" ,
00120       bind_builtin( "NOCARE" ,
00121                     builtin_flags, T_FLAG_NOCARE, 0 ) );
00122 
00123     duplicate_rule( "NOTIME" ,
00124     duplicate_rule( "NotFile" ,
00125       bind_builtin( "NOTFILE" ,
00126                     builtin_flags, T_FLAG_NOTFILE, 0 ) ) );
00127 
00128     duplicate_rule( "NoUpdate" ,
00129       bind_builtin( "NOUPDATE" ,
00130                     builtin_flags, T_FLAG_NOUPDATE, 0 ) );
00131 
00132     duplicate_rule( "Temporary" ,
00133       bind_builtin( "TEMPORARY" ,
00134                     builtin_flags, T_FLAG_TEMP, 0 ) );
00135 
00136     duplicate_rule( "HdrMacro" ,
00137       bind_builtin( "HDRMACRO" ,
00138                     builtin_hdrmacro, 0, 0 ) );
00139 
00140     /* FAIL_EXPECTED is used to indicate that the result of a target build */
00141     /* action should be inverted (ok <=> fail) this can be useful when     */
00142     /* performing test runs from Jamfiles..                                */
00143       bind_builtin( "FAIL_EXPECTED" ,
00144                     builtin_flags, T_FLAG_FAIL_EXPECTED, 0 );
00145 
00146       bind_builtin( "RMOLD" , builtin_flags, T_FLAG_RMOLD, 0 );
00147       
00148       {
00149           char * args[] = { "targets", "*", 0 };
00150           bind_builtin( "UPDATE", builtin_update, 0, args );
00151       }
00152 
00153       {
00154           char * args[] = { "string", "pattern", "replacements", "+", 0 };
00155           duplicate_rule( "subst" ,
00156             bind_builtin( "SUBST" ,
00157                           builtin_subst, 0, args ) );
00158       }
00159 
00160       {
00161           char * args[] = { "module", "?", 0 };
00162           bind_builtin( "RULENAMES" ,
00163                          builtin_rulenames, 0, args );
00164       }
00165 
00166 
00167       {
00168           char * args[] = { "module", "?", 0 };
00169           bind_builtin( "VARNAMES" ,
00170                          builtin_varnames, 0, args );
00171       }
00172 
00173       {
00174           char * args[] = { "module", "?", 0 };
00175           bind_builtin( "DELETE_MODULE" ,
00176                          builtin_delete_module, 0, args );
00177       }
00178 
00179       {
00180            char * args[] = { "source_module", "?",
00181                              ":", "source_rules", "*",
00182                              ":", "target_module", "?",
00183                              ":", "target_rules", "*",
00184                              ":", "localize", "?", 0 };
00185            bind_builtin( "IMPORT" ,
00186                          builtin_import, 0, args );
00187       }
00188 
00189       {
00190           char * args[] = { "module", "?", ":", "rules", "*", 0 };
00191           bind_builtin( "EXPORT" ,
00192                         builtin_export, 0, args );
00193       }
00194 
00195       {
00196           char * args[] = { "levels", "?", 0 };
00197           bind_builtin( "CALLER_MODULE" ,
00198                          builtin_caller_module, 0, args );
00199       }
00200 
00201       {
00202           char * args[] = { "levels", "?", 0 };
00203           bind_builtin( "BACKTRACE" ,
00204                         builtin_backtrace, 0, args );
00205       }
00206 
00207       {
00208           char * args[] = { 0 };
00209           bind_builtin( "PWD" ,
00210                         builtin_pwd, 0, args );
00211       }
00212 
00213       {
00214           char * args[] = { "target", "*", ":", "path", "*", 0 };
00215           bind_builtin( "SEARCH_FOR_TARGET",
00216                         builtin_search_for_target, 0, args );
00217       }
00218 
00219       {
00220           char * args[] = { "modules_to_import", "+", ":", "target_module", "?", 0 };
00221           bind_builtin( "IMPORT_MODULE",
00222                         builtin_import_module, 0, args );
00223       }
00224 
00225       {
00226           char * args[] = { "module", "?", 0 };
00227           bind_builtin( "IMPORTED_MODULES",
00228                         builtin_imported_modules, 0, args );
00229       }
00230 
00231       {
00232           char * args[] = { "instance_module", ":", "class_module", 0 };
00233           bind_builtin( "INSTANCE",
00234                         builtin_instance, 0, args );
00235       }
00236 
00237       {
00238           char * args[] = { "sequence", "*", 0 };
00239           bind_builtin( "SORT",
00240                         builtin_sort, 0, args );
00241       }
00242 
00243       {
00244           char * args[] = { "path", 0 };
00245           bind_builtin( "NORMALIZE_PATH",
00246               builtin_normalize_path, 0, args );
00247       }
00248 
00249       {
00250           char * args[] = { "args", "*", 0 };
00251           bind_builtin( "CALC",
00252               builtin_calc, 0, args );
00253       }
00254 }

Here is the call graph for this function:


Generated on Mon Nov 8 17:07:56 2004 for MPT by  doxygen 1.3.9.1