/*
* s e a r c h . c
* Forth Inspired Command Language
* ANS Forth SEARCH and SEARCH-EXT word-set written in C
* Author: John Sadler (john_sadler@alum.mit.edu)
* Created: 6 June 2000
* $Id: search.c,v 1.10 2010/08/12 13:57:22 asau Exp $
*/
/*
* Copyright (c) 1997-2001 John Sadler (john_sadler@alum.mit.edu)
* All rights reserved.
*
* Get the latest Ficl release at http://ficl.sourceforge.net
*
* I am interested in hearing from anyone who uses Ficl. If you have
* a problem, a success story, a defect, an enhancement request, or
* if you would like to contribute to the Ficl release, please
* contact me by email at the address above.
*
* L I C E N S E and D I S C L A I M E R
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <string.h>
#include "ficl.h"
/*
* d e f i n i t i o n s
* SEARCH ( -- )
* Make the compilation word list the same as the first word list in the
* search order. Specifies that the names of subsequent definitions will
* be placed in the compilation word list. Subsequent changes in the search
* order will not affect the compilation word list.
*/
static void
{
}
}
/*
* f o r t h - w o r d l i s t
* SEARCH ( -- wid )
* Return wid, the identifier of the word list that includes all standard
* words provided by the implementation. This word list is initially the
* compilation word list and is part of the initial search order.
*/
static void
{
}
/*
* g e t - c u r r e n t
* SEARCH ( -- wid )
* Return wid, the identifier of the compilation word list.
*/
static void
{
}
/*
* g e t - o r d e r
* SEARCH ( -- widn ... wid1 n )
* Returns the number of word lists n in the search order and the word list
* identifiers widn ... wid1 identifying these word lists. wid1 identifies
* the word list that is searched first, and widn the word list that is
* searched last. The search order is unaffected.
*/
static void
{
int i;
for (i = 0; i < wordlistCount; i++) {
}
}
/*
* s e a r c h - w o r d l i s t
* SEARCH ( c-addr u wid -- 0 | xt 1 | xt -1 )
* Find the definition identified by the string c-addr u in the word list
* identified by wid. If the definition is not found, return zero. If the
* definition is found, return its execution token xt and one (1) if the
* definition is immediate, minus-one (-1) otherwise.
*/
static void
{
if (word) {
} else {
}
}
/*
* s e t - c u r r e n t
* SEARCH ( wid -- )
* Set the compilation word list to the word list identified by wid.
*/
static void
{
}
/*
* s e t - o r d e r
* SEARCH ( widn ... wid1 n -- )
* Set the search order to the word lists identified by widn ... wid1.
* Subsequently, word list wid1 will be searched first, and word list
* widn searched last. If n is zero, empty the search order. If n is minus
* one, set the search order to the implementation-defined minimum
* search order. The minimum search order shall include the words
* FORTH-WORDLIST and SET-ORDER. A system shall allow n to
* be at least eight.
*/
static void
{
int i;
if (wordlistCount > FICL_MAX_WORDLISTS) {
"set-order error: list would be too large");
}
if (wordlistCount >= 0) {
for (i = wordlistCount-1; i >= 0; --i) {
dictionary->wordlists[i] =
}
} else {
}
}
/*
* f i c l - w o r d l i s t
* SEARCH ( -- wid )
* Create a new empty word list, returning its word list identifier wid.
* The new word list may be returned from a pool of preallocated word
* lists or may be dynamically allocated in data space. A system shall
* allow the creation of at least 8 new word lists in addition to any
* provided as part of the system.
* Notes:
* 1. Ficl creates a new single-list hash in the dictionary and returns
* its address.
* 2. ficl-wordlist takes an arg off the stack indicating the number of
* hash entries in the wordlist. Ficl 2.02 and later define WORDLIST as
* : wordlist 1 ficl-wordlist ;
*/
static void
{
}
/*
* S E A R C H >
* Ficl ( -- wid )
* Pop wid off the search order. Error if the search order is empty
*/
static void
{
int wordlistCount;
if (wordlistCount == 0) {
}
}
/*
* > S E A R C H
* Ficl ( wid -- )
* Push wid onto the search order. Error if the search order is full.
*/
static void
{
}
}
/*
* W I D - G E T - N A M E
* Ficl ( wid -- c-addr u )
* Get wid's (optional) name and push onto stack as a counted string
*/
static void
{
char *name;
ficlCell c;
else
length = 0;
c.p = name;
ficlVmPush(vm, c);
c.i = length;
ficlVmPush(vm, c);
}
/*
* W I D - S E T - N A M E
* Ficl ( wid c-addr -- )
* Set wid's name pointer to the \0 terminated string address supplied
*/
static void
{
}
/*
* setParentWid
* Ficl
* setparentwid ( parent-wid wid -- )
* Set WID's link field to the parent-wid. search-wordlist will
* iterate through all the links when finding words in the child wid.
*/
static void
{
}
/*
* f i c l C o m p i l e S e a r c h
* Builds the primitive wordset and the environment-query namespace.
*/
void
{
/*
* optional SEARCH-ORDER word set
*/
/*
* Set SEARCH environment query values
*/
}