home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / p / plbin.zip / pl / src / pl-funcs.h < prev    next >
C/C++ Source or Header  |  1993-02-23  |  16KB  |  544 lines

  1. /*  pl-funcs.h,v 1.12 1993/02/23 13:16:32 jan Exp
  2.  
  3.     Copyright (c) 1990 Jan Wielemaker. All rights reserved.
  4.     See ../LICENCE to find out about your rights.
  5.     jan@swi.psy.uva.nl
  6.  
  7.     Purpose: Function type declarations for all common functions
  8. */
  9.  
  10. /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  11. This header file defines all public functions of the SWI-Prolog  system.
  12. Depending  on  the  PROTO  cpp  flag  ANSI  declarations  or  old  style
  13. declarations are used.
  14. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  15.  
  16. #if defined(__GNUC__) && __GNUC__ == 1
  17. #define FI(type) int    /* type that promotes to int */
  18. #else
  19. #define FI(type) type
  20. #endif
  21.  
  22. #define Put(c)            put_character((Char) (c))
  23. #define Get0()            get_character()
  24. #define unifyAtomic(p, w)    unify_atomic(p, (word)(w))
  25.  
  26.         /* pl-alloc.c */
  27. char        *store_string P((char *)),
  28.         *store_string_local P((char *));
  29. int        stringHashValue P((char *, int size));
  30. Void        alloc_heap P((alloc_t)),
  31.         alloc_local P((alloc_t)),
  32.         alloc_global P((alloc_t));
  33. word        globalString P((char *)),
  34.         globalReal P((real)),
  35.         heapReal P((real)),
  36.         globalFunctor P((FunctorDef));
  37. real        unpack_real P((Word));
  38. volatile void    outOf P((Stack));
  39. void        free_heap P((Void, alloc_t)),
  40.         setReal P((word, real)),
  41.         initAllocLocal P((void)),
  42.         stopAllocLocal P((void));
  43.  
  44.         /* pl-arith.c */
  45. word        pl_between P((Word, Word, Word, word)),
  46.         pl_succ P((Word, Word)),
  47.         pl_plus P((Word, Word, Word)),
  48.         pl_compare P((Word, Word, Word)),
  49.         pl_lessNumbers P((Word, Word)),
  50.         pl_greaterNumbers P((Word, Word)),
  51.         pl_lessEqualNumbers P((Word, Word)),
  52.         pl_greaterEqualNumbers P((Word, Word)),
  53.         pl_nonEqualNumbers P((Word, Word)),
  54.         pl_equalNumbers P((Word, Word)),
  55.         pl_is P((Word, Word)),
  56. #if O_PROLOG_FUNCTIONS
  57.           pl_arithmetic_function P((Word)),
  58. #endif
  59.           pl_current_arithmetic_function P((Word, word)),
  60.         compareNumbers P((Word, Word, int)),
  61.         evaluate P((Word));
  62. void        initArith P((void));
  63. #if O_COMPILE_ARITH
  64. int        indexArithFunction P((FunctorDef, Module));
  65. FunctorDef    functorArithFunction P((int));
  66. bool        ar_func_n P((FI(code), int, Word *));
  67. #endif /* O_COMPILE_ARITH */
  68.  
  69.         /* pl-atom.c */
  70. Atom        lookupAtom P((char *));
  71. word        pl_current_atom P((Word, word)),
  72.         pl_atom_hashstat P((Word, Word)),
  73.         pl_complete_atom P((Word, Word, Word)),
  74.         pl_atom_completions P((Word, Word));
  75. char *        extendAtom P((char *, bool *));
  76. bool        extendAlternatives P((char *));
  77. void        initAtoms P((void));
  78.  
  79.         /* pl-bags.c */
  80. word        pl_collect_bag P((Word, Word)),
  81.         pl_record_bag P((Word, Word));
  82.  
  83.         /* pl-ext.c */
  84. void        initBuildIns P((void));
  85.  
  86.         /* pl-dump.c */
  87. word        pl_save_program P((Word, Word)),
  88.         pl_save P((Word, Word)),
  89.         pl_restore P((Word));
  90.  
  91.         /* pl-dwim.c */
  92. word        pl_dwim_match P((Word, Word, Word)),
  93.         pl_dwim_predicate P((Word, Word, word));
  94.         
  95.         /* pl-file.c */
  96. bool        told P((void)),
  97.         see P((word)),
  98.         seen P((void)),
  99.         seeString P((char *)),
  100.         seeingString P((void)),
  101.         seenString P((void)),
  102.         tellString P((char *, long)),
  103.         toldString P((void)),
  104.         readLine P((char *, int)),
  105.         unifyTime P((Word, long));
  106. int        currentInputLine P((void));
  107. int        currentLinePosition P((void));
  108. Atom        currentStreamName P((void));
  109. bool        put_character P((Char));
  110. #if AIX
  111. word        Putf();
  112. #else 
  113. word        Putf P((char *, ...));
  114. #endif
  115. word        vPutf P((char *, va_list)),
  116.         pl_tty P((void)),
  117.         pl_tty_fold P((Word, Word)),
  118.         pl_put P((Word)),
  119.         pl_get P((Word)),
  120.         pl_get0 P((Word)),
  121.         pl_put2 P((Word, Word)),
  122.         pl_get2 P((Word, Word)),
  123.         pl_get02 P((Word, Word)),
  124.         pl_get_single_char P((Word)),
  125.         pl_seeing P((Word)),
  126.         pl_telling P((Word)),
  127.         pl_seen P((void)),
  128.         pl_told P((void)),
  129.         pl_see P((Word)),
  130.         pl_tell P((Word)),
  131.         pl_append P((Word)),
  132.         pl_ttyflush P((void)),
  133.         pl_flush P((void)),
  134.         pl_protocol P((Word)),
  135.         pl_protocola P((Word)),
  136.         pl_noprotocol P((void)),
  137.         pl_protocolling P((Word)),
  138.         pl_prompt P((Word, Word)),
  139.         pl_tab P((Word)),
  140.         pl_tab2 P((Word, Word)),
  141.         pl_tmp_file P((Word, Word)),
  142.         pl_time_file P((Word, Word)),
  143.         pl_size_file P((Word, Word)),
  144.         pl_access_file P((Word, Word)),
  145.         pl_exists_file P((Word)),
  146.         pl_exists_directory P((Word)),
  147.         pl_delete_file P((Word)),
  148.         pl_rename_file P((Word, Word)),
  149.         pl_same_file P((Word, Word)),
  150.         pl_fileerrors P((Word, Word)),
  151.         pl_absolute_file_name P((Word, Word)),
  152.         pl_chdir P((Word)),
  153.         pl_file_dir_name P((Word, Word)),
  154.         pl_file_base_name P((Word, Word));
  155. word        pl_open P((Word, Word, Word)),
  156.         pl_open_null_stream P((Word)),
  157.         pl_close P((Word)),
  158.         pl_current_stream P((Word, Word, Word, word)),
  159.         pl_flush_output P((Word)),
  160.         pl_stream_position P((Word, Word, Word)),
  161.         pl_set_input P((Word)),
  162.         pl_set_output P((Word)),
  163.         pl_current_input P((Word)),
  164.         pl_current_output P((Word)),
  165.         pl_character_count P((Word, Word)),
  166.         pl_line_count P((Word, Word)),
  167.         pl_line_position P((Word, Word)),
  168.         pl_source_location P((Word, Word)),
  169.         pl_wait_for_input P((Word, Word, Word));
  170. Char        get_character P((void)),
  171.         getSingleChar P((void));
  172. FILE *        checkInput P((int));
  173. void        initIO P((void)),
  174.         dieIO P((void)),
  175.         closeFiles P((void)),
  176.         newLineInput P((void)),
  177.         prompt P((bool));
  178. int        streamNo P((Word, int));
  179.  
  180.         /* pl-glob.c */
  181. bool        compilePattern P((char *)),
  182.         matchPattern P((char *));
  183. word        pl_expand_file_name P((Word, Word));
  184. char *        ExpandOneFile P((char *));
  185.  
  186.         /* pl-gc.c */
  187. void        garbageCollect P((LocalFrame)),
  188.         resetGC P((void)),
  189.         considerGarbageCollect P((Stack)),
  190.         lockw P((Word)), unlockw P((Word)),
  191.         lockp P((Word *)), unlockp P((Word *)),
  192.         lockMark P((mark *)), unlockMark P((mark *));
  193. word        pl_garbage_collect P((Word)),
  194.         pl_collect_parms P((Word, Word));
  195.  
  196.         /* pl-flag.c */
  197. void        initFlags P((void));
  198. word        pl_flag P((Word, Word, Word)),
  199.         pl_current_flag P((Word, word));
  200.  
  201.         /* pl-funct.c */
  202. FunctorDef    lookupFunctorDef P((Atom name, int arity)),
  203.         isCurrentFunctor P((Atom name, int arity));
  204. void        initFunctors P((void));
  205. word        pl_current_functor P((Word, Word, word));
  206. int        atomIsFunctor P((Atom));
  207. bool        atomIsProcedure P((Atom)),
  208.         atomIsProcedureModule P((Atom, Module));
  209.  
  210.         /* pl-util.c */
  211. char        *procedureName P((Procedure)),
  212.         digitName P((int, bool));
  213. int        digitValue P((int, char));
  214. bool        wordToInteger P((word, long *)),
  215.         wordToReal P((word, real *)),
  216.         isUserSystemProcedure P((Procedure)),
  217.         strsub P((char *, char *)),
  218.         strprefix P((char *, char *)),
  219.         strpostfix P((char *, char *));
  220. void        systemMode P((bool));
  221. word        notImplemented P((char *, int));
  222.  
  223.         /* pl-index.c */
  224. int        cardinalityPattern P((ulong));
  225. bool        reindexClause P((Clause)),
  226.         indexPatternToTerm P((Procedure, Word));
  227. struct index    getIndex P((Word, ulong, int));
  228. Clause        findClause P((Clause, Word, const Definition, bool *));
  229.  
  230.         /* pl-itf.h */
  231. void        resetForeign P((void));
  232.  
  233.         /* pl-wam.c */
  234. #if COUNTING
  235. word        pl_count P((void));
  236. #endif
  237. #if O_COMPILE_OR
  238. word        pl_alt P((Word, word));
  239. #endif
  240. word        pl_break P((void)),
  241.         pl_break1 P((Word)),
  242.         pl_abort P((void)),
  243.         pl_metacut P((void));
  244. bool        callGoal P((Module, word, bool)),
  245.         prolog P((word)),
  246.         interpret P((Module, word, bool)),
  247.         unify P((Word, Word)),
  248.         unify_atomic P((Word, word)),
  249.         unifyFunctor P((Word, FunctorDef));
  250.  
  251.         /* pl-list.c */
  252. word        pl_is_list P((Word)),
  253.         pl_proper_list P((Word)),
  254.         pl_length P((Word, Word)),
  255.         pl_memberchk P((Word, Word)),
  256.         pl_msort P((Word, Word)),
  257.         pl_sort P((Word, Word));
  258.  
  259.         /* pl-proc.c */
  260. Procedure    lookupProcedure P((FunctorDef, Module)),
  261.         isCurrentProcedure P((FunctorDef, Module)),
  262.         resolveProcedure P((FunctorDef, Module)),
  263.         findProcedure P((Word)),
  264.         findCreateProcedure P((Word));
  265. bool        isDefinedProcedure P((Procedure)),
  266.         assertProcedure P((Procedure, Clause, char)),
  267.         abolishProcedure P((Procedure, Module)),
  268.         retractClauseProcedure P((Procedure, Clause));
  269. SourceFile    lookupSourceFile P((Atom)),
  270.         isCurrentSourceFile P((Atom));
  271. word        pl_current_predicate P((Word, Word, word)),
  272.         pl_retract P((Word, word)),
  273.         pl_abolish P((Word, Word)),
  274.         pl_list_references P((Word)),
  275.         pl_list_active_procedures P((void)),
  276.         pl_predicate_attribute P((Word, Word, Word)),
  277.         pl_index P((Word)),
  278.         pl_source_file P((Word, Word)),
  279.         pl_time_source_file P((Word, Word, word)),
  280.         pl_start_consult P((Word)),
  281.         pl_make_system_source_files P((void));
  282. void        unallocClause P((Clause)),
  283.         trapUndefined P((Procedure)),
  284.         resetReferences P((void)),
  285.         removeClausesProcedure P((Procedure)),
  286.         resetProcedure P((Procedure)),
  287.         reindexProcedure P((Procedure)),
  288.         freeClause P((Clause));
  289.  
  290.         /* pl-prof.c */
  291. word        pl_profile P((Word, Word)),
  292.         pl_profile_count P((Word, Word, Word)),
  293.         pl_profile_box P((Word, Word, Word, Word, Word)),
  294.         pl_reset_profiler P((void));
  295. void        stopItimer P((void));
  296.  
  297.         /* pl-read.c */
  298. word        pl_raw_read P((Word)),
  299.         pl_read_variables P((Word, Word)),
  300.         pl_read_variables3 P((Word, Word, Word)),
  301.         pl_read P((Word)),
  302.         pl_read2 P((Word, Word)),
  303.         pl_read_clause P((Word)),
  304.         pl_read_clause2 P((Word, Word));
  305. void        resetRead P((void));
  306.  
  307.         /* pl-load.c */
  308. char        *getExecutable P((void));
  309. bool        getSymbols P((void));
  310. void        resetLoader P((void));
  311. word        pl_load_foreign P((Word, Word, Word, Word, Word));
  312. word        pl_load_foreign1 P((Word));
  313.  
  314.         /* pl-main.c */
  315.  
  316. bool        sysError P((char *fm , ...)),
  317.         fatalError P((char *fm , ...)),
  318.         warning P((char *fm , ...)),
  319.         vsysError P((char *fm , va_list args )),
  320.         vfatalError P((char *fm , va_list args )),
  321.         vwarning P((char *fm , va_list args ));
  322. int        startProlog P((int, char **, char **));
  323.  
  324.         /* pl-modul.c */
  325. Word        stripModule P((Word, Module *));
  326. Module        lookupModule P((Atom)), isCurrentModule P((Atom));
  327. void        initModules P((void));
  328. bool        isPublicModule P((Module, Procedure)),
  329.           isSuperModule P((Module, Module));
  330. word        pl_current_module P((Word, Word, word)),
  331.         pl_default_module P((Word, Word, Word)),
  332.         pl_strip_module P((Word, Word, Word)),
  333.         pl_module P((Word, Word)),
  334.         pl_set_source_module P((Word, Word)),
  335.         pl_declare_module P((Word, Word)),
  336.         pl_export P((Word)),
  337.         pl_export_list P((Word, Word)),
  338.         pl_check_export P((void)),
  339.         pl_context_module P((Word)),
  340.         pl_import P((Word));
  341.  
  342.         /* pl-comp.c */
  343. Clause        assert_term P((Word, char, Atom));
  344. word        pl_assertz P((Word)), pl_asserta P((Word)),
  345.         pl_assertz2 P((Word, Word)), pl_asserta2 P((Word, Word)),
  346.         pl_record_clause P((Word, Word)),
  347.         pl_clause P((Word, Word, Word, word));
  348. bool        decompileHead P((Clause, Word)),
  349.         decompile P((Clause, Word)),
  350.         splitClause P((Word, Word *, Word *));
  351. void        initWamTable P((void));
  352.  
  353.         /* pl-fmt.c */
  354. word        pl_format P((Word, Word)),
  355.         pl_format3 P((Word, Word, Word)),
  356.         pl_format_predicate P((Word, Word));
  357.  
  358.         /* pl-op.c */
  359. Operator    lookupOperator P((Atom, int)),
  360.         isCurrentOperator P((Atom, int));
  361. bool        isPrefixOperator P((Atom, int *, int *)),
  362.         isPostfixOperator P((Atom, int *, int *)),
  363.         isInfixOperator P((Atom, int *, int *)),
  364.         operator P((Atom, int, int)),
  365.         newOp P((char *, int, int));
  366. word        pl_current_op P((Word, Word, Word, word)),
  367.         pl_op1 P((Word, Word, Word));
  368. void        initOperators P((void));
  369.  
  370.         /* pl-prims.c */
  371. word        pl_nonvar P((Word)),
  372.         pl_var P((Word)),
  373.         pl_integer P((Word)),
  374.         pl_float P((Word)),
  375.         pl_number P((Word)),
  376.         pl_arch P((Word, Word)),
  377.         pl_atom P((Word)),
  378.         pl_atomic P((Word)),
  379.         pl_ground P((Word)),
  380.         pl_unify P((Word, Word)),
  381.         pl_notunify P((Word, Word)),
  382.         pl_equal P((Word, Word)),
  383.         pl_nonequal P((Word, Word)),
  384.         pl_lessStandard P((Word, Word)),
  385.         pl_lessEqualStandard P((Word, Word)),
  386.         pl_greaterStandard P((Word, Word)),
  387.         pl_greaterEqualStandard P((Word, Word)),
  388.         pl_structural_equal P((Word, Word)),
  389.         pl_structural_nonequal P((Word, Word)),
  390.         pl_functor P((Word, Word, Word)),
  391.         pl_arg P((Word, Word, Word)),
  392.         pl_univ P((Word, Word)),
  393.         pl_numbervars P((Word, Word, Word, Word)),
  394.         pl_free_variables P((Word, Word)),
  395.         pl_e_free_variables P((Word, Word)),
  396.         pl_atom_length P((Word, Word)),
  397.         pl_int_to_atom P((Word, Word, Word)),
  398.         pl_format_number P((Word, Word, Word)),
  399.         pl_apropos_match P((Word, Word)),
  400.         pl_name P((Word, Word)),
  401.         pl_concat P((Word, Word, Word)),
  402.         pl_concat_atom P((Word, Word)),
  403. #if O_STRING
  404.         pl_string P((Word)),
  405.         pl_string_length P((Word, Word)),
  406.         pl_string_to_atom P((Word, Word)),
  407.         pl_string_to_list P((Word, Word)),
  408.         pl_substring P((Word, Word, Word, Word)),
  409.         pl_write_on_string P((Word, Word)),
  410. #endif
  411.         pl_write_on_atom P((Word, Word)),
  412.         pl_write_on_list P((Word, Word)),
  413.         pl_term_to_atom P((Word, Word, Word)),
  414.         pl_repeat P((word)),
  415.         pl_fail P((void)),
  416.         pl_halt P((void)),
  417.         pl_statistics P((Word, Word)),
  418.         pl_version P((Word)),
  419.         pl_option P((Word, Word)),
  420.         pl_please P((Word, Word, Word)),
  421.         pl_style_check P((Word, Word)),
  422.         pl_novice P((Word, Word)),
  423.         stringToList P((char *)),
  424.         pl_copy_term P((Word, Word)),
  425.         pl_home P((Word));
  426. int        compareStandard P((Word, Word)),
  427.         lengthList P((Word)),
  428.         numberVars P((Word, FunctorDef, int));
  429. char         *primitiveToString P((word, bool)),
  430.         *formatInteger P((bool, int, int, bool, long)),
  431.         *listToString P((word)),
  432.         *toString P((word));
  433.  
  434.         /* pl-table.c */
  435. Symbol        lookupHTable P((Table, Void)),
  436.         firstHTable P((Table)),
  437.         nextHTable P((Table, Symbol)),
  438.         lookupLocalTable P((Table, Void));
  439. Table        newHTable P((int)),
  440.         newLocalTable P((int));
  441. bool        addHTable P((Table, Void, Void)),
  442.         addLocalTable P((Table, Void, Void)),
  443.         deleteHTable P((Table, Void)),
  444.         unifyStringWithList P((char *, Word));
  445. void        clearHTable P((Table));
  446.  
  447.         /* pl-rec.c */
  448. void        initRecords P((void));
  449. word        getKey P((Word)),
  450.         pl_recorda P((Word, Word, Word)),
  451.         pl_recordz P((Word, Word, Word)),
  452.         pl_recorded P((Word, Word, Word, word)),
  453.         pl_current_key P((Word, word)),
  454.         heapString P((char *)),
  455.         copyTermToGlobal P((Record)),
  456.         pl_erase P((Word));
  457. bool        freeRecord P((Record)),
  458.         unifyKey P((Word, word));
  459. Record        copyTermToHeap P((Word));
  460.  
  461.         /* pl-setup.c */
  462. void        setupProlog P((void)),
  463.         deallocateStacks P((void)),
  464.         initSignals P((void));
  465. bool        restoreStack P((Stack));
  466. #if unix || EMX
  467. void        deliverSignal P((int, int, SIGNAL_CONTEXT_TYPE, char *));
  468. handler_t    pl_signal P((int, handler_t));
  469. #endif
  470. word        pl_limit_stack P((Word, Word)),
  471.         pl_trim_stacks P((void));
  472.  
  473.         /* pl-sys.c */
  474. word        pl_shell P((Word, Word)),
  475. #if LINK_THIEF
  476.         pl_thief P((Word)),
  477. #endif
  478.         pl_grep P((Word, Word, Word, word)),
  479.         pl_getenv P((Word, Word)),
  480.         pl_setenv P((Word, Word)),
  481.         pl_unsetenv P((Word)),
  482.         pl_wildcard_match P((Word, Word)),
  483.         pl_argv P((Word)),
  484.         pl_convert_time P((Word, Word, Word, Word, Word, Word, Word, Word)),
  485.         pl_get_time P((Word)),
  486.         pl_sleep P((Word));
  487.  
  488.         /* pl-trace.c */
  489. int        tracePort P((LocalFrame, int));
  490. void        writeFrameGoal P((LocalFrame, int)),
  491.         backTrace P((LocalFrame, int)),
  492.         initTracer P((void));
  493. word        pl_trace P((void)),
  494.         pl_notrace P((void)),
  495.         pl_tracing P((void)),
  496.         pl_debug P((void)),
  497.         pl_nodebug P((void)),
  498.         pl_debugging P((void)),
  499.         pl_skip_level P((Word, Word)),
  500.         pl_spy P((Word)),
  501.         pl_nospy P((Word)),
  502.         pl_leash P((Word, Word)),
  503.         pl_visible P((Word, Word)),
  504.         pl_unknown P((Word, Word)),
  505.         pl_prolog_current_frame P((Word)),
  506.         pl_prolog_frame_attribute P((Word, Word, Word)),
  507.         pl_trace_continuation P((Word));
  508. void        interruptHandler P((void));
  509.  
  510.         /* pl-wic.c */
  511. bool        loadWicFile P((char *, bool, bool));
  512. word        pl_open_wic P((Word)),
  513.         pl_close_wic P((void)),
  514.         pl_add_clause_wic P((Word, Word)),
  515.         pl_add_directive_wic P((Word)),
  516.         pl_start_module_wic P((Word, Word)),
  517.         pl_export_wic P((Word, Word)),
  518.         pl_import_wic P((Word, Word, Word));
  519. bool        compileFileList P((char *, int, char **));
  520. bool        appendState P((char *));
  521.  
  522.         /* pl-write.c */
  523. word        pl_nl P((void)),
  524.         pl_display P((Word)),
  525.         pl_displayq P((Word)),
  526.         pl_write P((Word)),
  527.         pl_writeq P((Word)),
  528.         pl_print P((Word)),
  529.         pl_dprint P((Word, Word)),
  530.         pl_display2 P((Word, Word)),
  531.         pl_displayq2 P((Word, Word)),
  532.         pl_write2 P((Word, Word)),
  533.         pl_writeq2 P((Word, Word)),
  534.         pl_print2 P((Word, Word)),
  535.         pl_nl1 P((Word));
  536.  
  537.         /* pl-term.c */
  538.  
  539. void        resetTerm P((void));
  540. word        pl_tty_get_capability P((Word, Word, Word)),
  541.           pl_tty_goto P((Word, Word)),
  542.         pl_tty_put  P((Word, Word)),
  543.           pl_set_tty  P((Word, Word));
  544.