⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 factory.mx

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MX
字号:
@' The contents of this file are subject to the MonetDB Public License@' Version 1.1 (the "License"); you may not use this file except in@' compliance with the License. You may obtain a copy of the License at@' http://monetdb.cwi.nl/Legal/MonetDBLicense-1.1.html@'@' Software distributed under the License is distributed on an "AS IS"@' basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the@' License for the specific language governing rights and limitations@' under the License.@'@' The Original Code is the MonetDB Database System.@'@' The Initial Developer of the Original Code is CWI.@' Portions created by CWI are Copyright (C) 1997-2007 CWI.@' All Rights Reserved.@f factory@a Martin Kersten@v 1.0@+ Factory management The factory infrastructure can be inspected and steered with the commands provided here.@malmodule factory;command getPlants():bat[:str,:str]address FCTgetPlants comment "Retrieve the factory plant description        for all operational factories";command getCaller():intaddress FCTgetCallercomment "Retrieve the unique identity        of the factory caller";command getOwners():bat[:int,:str]address FCTgetOwnerscomment "Retrieve the factory owners table";command getTimeIn():dateaddress FCTgetTimeStampIncomment "Retrieve the time stamp it was received by the factory";command getTimeOut():dateaddress FCTgetTimeStampOutcomment "Retrieve the time stamp the answer was returned to the client";command setLocation(uri:str):voidaddress FCTsetLocationcomment "Set the location of the plant        manager.";command getLocations():bat[:int,:str]address FCTgetLocationscomment "Retrieve the location of all        known plants";command shutdown(m:str, f:str):voidaddress FCTshutdowncomment "Close a factory";@-@{@include prelude.mx@+ Implementation code @h#ifndef _FACTORY_H#define _FACTORY_H#include "mal.h"#include "mal_interpreter.h"#include "mal_namespace.h"#ifdef WIN32#ifndef LIBFACTORY#define factory_export extern __declspec(dllimport)#else#define factory_export extern __declspec(dllexport)#endif#else#define factory_export extern#endiffactory_export str FCTgetPlants(int *ret);factory_export str FCTgetCaller(int *ret);factory_export str FCTgetOwners(int *ret);factory_export str FCTgetTimeStampIn(int *ret);factory_export str FCTgetTimeStampOut(int *ret);factory_export str FCTsetLocation(int *ret, str *loc);factory_export str FCTgetLocations(int *ret);factory_export str FCTshutdown(int *ret, str *mod, str *fcn);#endif /* _FACTORY_H */@c#include "mal_config.h"#include "factory.h"@+ Inspection@cstrFCTgetPlants(int *ret){	BAT *b;	b = BATnew(TYPE_str, TYPE_str, 256);	if (!(b->batDirty&2)) b = BATsetaccess(b, BAT_READ);	@:Pseudo(factory,name,plant)@	throw(MAL, "factory.getPlants", "not yet implemented");}strFCTgetCaller(int *ret){	(void) ret;	throw(MAL, "factory.getCaller", "not yet implemented");}strFCTgetOwners(int *ret){	BAT *b;	(void) ret;	b = BATnew(TYPE_int, TYPE_str, 256);	if (!(b->batDirty&2)) b = BATsetaccess(b, BAT_READ);	@:Pseudo(factory,plantid,location)@	throw(MAL, "factory.getOwner", "not yet implemented");}strFCTgetTimeStampIn(int *ret){	(void) ret;	throw(MAL, "factory.getTimeStampIn", "not yet implemented");}strFCTgetTimeStampOut(int *ret){	(void) ret;	throw(MAL, "factory.getTimeStampOut", "not yet implemented");}strFCTsetLocation(int *ret, str *loc){	(void) ret;	(void) loc;	throw(MAL, "factory.setLocation", "not yet implemented");}strFCTgetLocations(int *ret){	BAT *b;	(void) ret;	b = BATnew(TYPE_int, TYPE_str, 256);	if (!(b->batDirty&2)) b = BATsetaccess(b, BAT_READ);	@:Pseudo(factory,plantid,location)@	throw(MAL, "factory.getLocations", "not yet implemented");}strFCTshutdown(int *ret, str *mod, str *fcn){	Symbol s;	(void) ret;	s = findMALSymbol(putName(*mod, strlen(*mod)), putName(*fcn, strlen(*fcn)));	if (s == NULL)		throw(MAL, "factory.shutdown", "Factory not found");	shutdownFactory(s->def);	return MAL_SUCCEED;}@}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -