コード例 #1
0
ファイル: indCIMXMLHandler.c プロジェクト: zaneb/sblim-sfcb
CMPIStatus IndCIMXMLHandlerGetInstance(CMPIInstanceMI * mi,
                                       const CMPIContext * ctx,
                                       const CMPIResult * rslt,
                                       const CMPIObjectPath * cop,
                                       const char **properties)
{
   CMPIStatus st;
   CMPIInstance*   ci;
   const char** keyList;

   _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerGetInstance");

   ci = internalProviderGetInstance(cop, &st);

   if (st.rc == CMPI_RC_OK) {
    if (isa("root/interop", CMGetCharPtr(CMGetClassName(cop,NULL)), "cim_indicationhandler")) {
      filterInternalProps(ci);
    }
    if (properties) {
      keyList = getKeyList(ci->ft->getObjectPath(ci, NULL));
      ci->ft->setPropertyFilter(ci, properties, keyList);
      if (keyList) {
        free(keyList);
      }
    }
    CMReturnInstance(rslt, ci);
   }

   _SFCB_RETURN(st);
}
コード例 #2
0
  GAPRecord operator()(Obj rec) const
  {
    if(!isa(rec))
      throw GAPException("Not a record");

    return GAPRecord(rec);
  }
コード例 #3
0
ファイル: checker.hpp プロジェクト: anadon/CPM03
void
check_suffix_array_using_inverse(
		 StringIterator str, StringIterator str_end,
		 SArrayIterator sa, SArrayIterator sa_end,
		 CharOrder less )
{
  range_check_suffix_array(str, str_end, sa, sa_end);
  if (sa == sa_end) return;

  typedef typename std::iterator_traits<SArrayIterator>::value_type 
    pos_type;
  pos_type size = static_cast<pos_type>(str_end - str);

  // construct inverse suffix array
  std::vector<pos_type> isa(size);
  SArrayIterator i;
  for (i = sa; i != sa_end; ++i) { 
    isa[*i] = static_cast<pos_type>(i-sa); 
  }

  SArrayIterator prev;
  for (prev = sa, i = sa+1; i != sa_end; prev = i++) {

    // test 2
    if (less(str[*i], str[*prev])) {
      std::ostringstream os;
      os << "SUFFIX ARRAY CHECKER (USING INVERSE): "
	 << "suffixes in wrong order\n"
	 << "first character of suffix sa[" << prev-sa << "]=" << *prev
	 << " is larger than the first character of suffix sa["
	 << i-sa << "]=" << *i;
      throw std::logic_error(os.str());
    } else if ( !less(str[*prev], str[*i]) ) {

      // test 3
      if (*i == size-1) {
	std::ostringstream os;
	os << "SUFFIX ARRAY CHECKER (USING INVERSE): "
	   << "suffixes in wrong order\n"
	   << "the suffix of length one is not the first among"
	   << " suffixes starting with the same character";
	throw std::logic_error(os.str());
      }
      if ( *prev != size-1 && isa[*i+1] < isa[*prev+1] ) {
	std::ostringstream os;
	os << "SUFFIX ARRAY CHECKER (USING INVERSE): "
	   << "suffixes in wrong order\n"
	   << "sa[" << prev-sa << "]=" << *prev
	   << " and sa[" << i-sa << "]=" << *i
	   << " have the same first character but\n"
	   << "sa[" << isa[*prev+1] << "]=" << sa[isa[*prev+1]]
	   << " and sa[" << isa[*i+1] << "]=" << sa[isa[*i+1]]
	   << " are in different relative order";
	throw std::logic_error(os.str());
      }
    }	
  }
}
コード例 #4
0
 std::pair<T,U> operator()(Obj rec) const
 {
   if(!isa(rec))
     throw GAPException("Invalid attempt to read pair");
   GAP_getter<T> get_T;
   GAP_getter<U> get_U;
   std::pair<T,U> p(get_T(ELM_LIST(rec, 1)), get_U(ELM_LIST(rec, 2)));
   return p;
 }
コード例 #5
0
ファイル: flow.c プロジェクト: evanrmurphy/PicoLisp
// (isa 'cls|typ 'any) -> obj | NIL
any doIsa(any ex) {
   any x;
   cell c1;

   x = cdr(ex),  Push(c1, EVAL(car(x)));
   x = cdr(x),  x = EVAL(car(x));
   if (isSym(x)) {
      Fetch(ex,x);
      drop(c1);
      if (isSym(data(c1)))
         return isa(data(c1), x)? x : Nil;
      while (isCell(data(c1))) {
         if (!isa(car(data(c1)), x))
            return Nil;
         data(c1) = cdr(data(c1));
      }
      return x;
   }
   drop(c1);
   return Nil;
}
コード例 #6
0
ファイル: SuffixArray.cpp プロジェクト: avilella/sga
// Validate the suffix array using the read table
void SuffixArray::validate(const ReadTable* pRT) const
{
    size_t maxIdx = pRT->getCount();
    (void)maxIdx;
    size_t n = m_data.size();

    // Exit if there is nothing to do
    if(n == 0)
        return;

    // Compute the ISA
    InverseSuffixArray isa(*this);

    // Validate the ISA is a permutation of 1..n, this implies that the id,pos pairs of the SA are valid
    isa.validate();

    size_t empty_count = 0;
    // Ensure that the suffix at pos i is lexographically lower than the suffix at i + 1 using the full string
    for(size_t i = 0; i < n - 1; ++i)
    {
        SAElem id1 = m_data[i];
        SAElem id2 = m_data[i+1];
        assert(id1.getID() < maxIdx);
        std::string suffix1 = pRT->getRead(id1.getID()).seq.getSuffixString(id1.getPos());
        std::string suffix2 = pRT->getRead(id2.getID()).seq.getSuffixString(id2.getPos());

        if(suffix1.length() == 1)
            ++empty_count;

        bool suffixValidated = true;
        if(suffix1 == suffix2)
        {
            suffixValidated = pRT->getRead(id1.getID()).id < pRT->getRead(id2.getID()).id;
        }
        else
        {
            suffixValidated = suffix1 < suffix2;
        }

        if(!suffixValidated)
        {
            std::cerr << "Validation failure: " << suffix1 << " is not less than " << suffix2
                        << " ids: " << id1.getID() << "," << id2.getID() << "\n";
            assert(suffix1 < suffix2);
        }
    }

    assert(m_numStrings == empty_count);
}
コード例 #7
0
void Equipment::reduce_hp_from_hit()
{
    if ( hp_ >= 1 && Clib::random_int( 99 ) == 0 )
    {
        set_dirty();
        --hp_;
        increv();
        if ( isa( CLASS_ARMOR ) )
        {
            Mobile::Character* chr = GetCharacterOwner();
            if ( chr != NULL )
                chr->refresh_ar();
        }
        send_object_cache_to_inrange( this );
    }
}
コード例 #8
0
std::vector<int> longest_common_prefix(const T &s, const SuffixArray &sa){
	const int n = sa.size();
	std::vector<int> vs(n), isa(n), lcp(n - 1);
	for(int i = 0; i + 1 < n; ++i){ vs[i] = s[i]; }
	for(int i = 0; i < n; ++i){ isa[sa[i]] = i; }
	int h = 0;
	for(int i = 0; i < n; ++i){
		const int j = isa[i];
		if(j > 0){
			const int k = j - 1;
			while(vs[sa[j] + h] == vs[sa[k] + h]){ ++h; }
			lcp[k] = h;
			if(h > 0){ --h; }
		}
	}
	return lcp;
}
コード例 #9
0
Packet* AccountHandler::_createPacket(const std::string& packet, BuddyPtr pBuddy)
{
	UT_return_val_if_fail(pBuddy, NULL);
	
	// create archive
	IStrArchive isa( packet );
	
	// serialize version
	int version;
	isa << COMPACT_INT(version);
	if (version != ABICOLLAB_PROTOCOL_VERSION)
	{
		if (version > 0)
		{
			UT_DEBUGMSG(("Discarding packet, wrong version %d (expected %d)\n", version, ABICOLLAB_PROTOCOL_VERSION));
			_sendProtocolError(pBuddy, PE_Invalid_Version);
			return NULL;
		}
		else
		{
			UT_DEBUGMSG(("Got error packet (hopefully), revision=%d\n", version));
			// if it's a version 0 message, handle normally, picked up in _handlePacket
		}
	}
	
	// serialize class id and attempt to reconstruct
	UT_uint8 classId;
	isa << classId;
	Packet* newPacket = Packet::createPacket( (PClassType)classId );
	if (!newPacket)
	{
		UT_DEBUGMSG(("Discarding packet, got unknown class %d\n", classId));
		return NULL;
	}
		
	// debug
	UT_DEBUGMSG(("PACKET DESERIALIZED: [%s] %u bytes in serialized string\n", Packet::getPacketClassname( (PClassType)classId ), isa.Size()));
	
	// serialize packet
	isa << *newPacket;
	
	return newPacket;
}
コード例 #10
0
ファイル: nforcepc.cpp プロジェクト: fesh0r/mame-full
void nforcepc_state::nforcepc(machine_config &config)
{
	athlonxp_device &maincpu(ATHLONXP(config, "maincpu", 90000000));
	maincpu.set_addrmap(AS_PROGRAM, &nforcepc_state::nforce_map);
	maincpu.set_addrmap(AS_IO, &nforcepc_state::nforce_map_io);
	maincpu.set_irq_acknowledge_callback(FUNC(nforcepc_state::irq_callback));
	//maincpu.smiact().set("pci:01.0", FUNC(i82439hx_host_device::smi_act_w));

	PCI_ROOT(config, ":pci", 0);
	CRUSH11(config, ":pci:00.0", 0, "maincpu", "bios"); // 10de:01a4 NVIDIA Corporation nForce CPU bridge
	CRUSH11_MEMORY(config, ":pci:00.1", 0, 2); /* 10de:01ac NVIDIA Corporation nForce 220/420 Memory Controller
	10de:01ad NVIDIA Corporation nForce 220/420 Memory Controller
	10de:01ab NVIDIA Corporation nForce 420 Memory Controller (DDR)*/
	mcpx_isalpc_device &isa(MCPX_ISALPC(config, ":pci:01.0", 0, 0x10430c11)); // 10de:01b2 NVIDIA Corporation nForce ISA Bridge (LPC bus)
	isa.smi().set_inputline(":maincpu", INPUT_LINE_SMI);
	isa.boot_state_hook().set(FUNC(nforcepc_state::boot_state_award_w));
	isa.interrupt_output().set(FUNC(nforcepc_state::maincpu_interrupt));
	it8703f_device &ite(IT8703F(config, ":pci:01.0:0", 0));
	ite.pin_reset().set_inputline(":maincpu", INPUT_LINE_RESET);
	ite.pin_gatea20().set_inputline(":maincpu", INPUT_LINE_A20);
	MCPX_SMBUS(config, ":pci:01.1", 0); // 10de:01b4 NVIDIA Corporation nForce PCI System Management (SMBus)
	SMBUS_ROM(config, ":pci:01.1:050", 0, test_spd_data, sizeof(test_spd_data)); // these 3 are on smbus number 0
	SMBUS_LOGGER(config, ":pci:01.1:051", 0);
	SMBUS_LOGGER(config, ":pci:01.1:052", 0);
	SMBUS_LOGGER(config, ":pci:01.1:108", 0); // these 4 are on smbus number 1
	AS99127F(config, ":pci:01.1:12d", 0);
	AS99127F_SENSOR2(config, ":pci:01.1:148", 0);
	AS99127F_SENSOR3(config, ":pci:01.1:149", 0);
	SST_49LF020(config, "bios", 0);
	/*10de:01c2 NVIDIA Corporation nForce USB Controller
	10de:01c2 NVIDIA Corporation nForce USB Controller
	10de:01b0 NVIDIA Corporation nForce Audio Processing Unit
	10de:01b1 NVIDIA Corporation nForce AC'97 Audio Controller
	10de:01b8 NVIDIA Corporation nForce PCI-to-PCI bridge
	10de:01bc NVIDIA Corporation nForce IDE
	10de:01b7 NVIDIA Corporation nForce AGP to PCI Bridge
	*/
	/* maincpu.smiact().set("pci:00.0", FUNC(i82439hx_host_device::smi_act_w));

	i82371sb_ide_device &ide(I82371SB_IDE(config, ":pci:07.1", 0));
	ide.irq_pri().set(":pci:07.0", FUNC(i82371sb_isa_device::pc_irq14_w));
	ide.irq_sec().set(":pci:07.0", FUNC(i82371sb_isa_device::pc_irq15_w));*/
}
コード例 #11
0
ファイル: skin_meme.C プロジェクト: ArnaudGastinel/jot-lib
Bsimplex_list
SkinMeme::get_local_trackers() const
{
   // return a list of track simplices ("trackers") from
   // this skin meme and its immediate neighbors

   Bsimplex_list ret(vert()->degree() + 1);

   // add our tracker
   add_tracker(track_simplex(), *_track_filter, ret);

   // add neighbors' trackers
   static VertMemeList nbrs;
   get_nbrs(nbrs);
   for (int i=0; i<0; i++) {
      assert(isa(nbrs[i]));
      add_tracker(((SkinMeme*)nbrs[i])->track_simplex(), *_track_filter, ret);
   }
   return ret;
}
コード例 #12
0
ファイル: flow.c プロジェクト: evanrmurphy/PicoLisp
static bool isa(any cls, any x) {
   any z;

   z = x = val(x);
   while (isCell(x)) {
      if (!isCell(car(x))) {
         while (isSym(car(x))) {
            if (isExt(car(x)))
               return NO;
            if (cls == car(x) || isa(cls, car(x)))
               return YES;
            if (!isCell(x = cdr(x)) || z == x)
               return NO;
         }
         return NO;
      }
      if (z == (x = cdr(x)))
         return NO;
   }
   return NO;
}
コード例 #13
0
ファイル: ex_vops3.c プロジェクト: n-t-roff/heirloom-ex-vi
int
lbrack(register int c, void (*f)(int))
{
	register line *addr;

	addr = dot;
	for (;;) {
		addr += dir;
		if (addr < one || addr > dol) {
			addr -= dir;
			break;
		}
		getline(*addr);
		if (linebuf[0] == '{' ||
#ifdef LISPCODE
		    (value(LISP) && linebuf[0] == '(') ||
#endif
		    isa(svalue(SECTIONS))) {
			if (c == ']' && f != vmove) {
				addr--;
				getline(*addr);
			}
			break;
		}
		if (c == ']' && f != vmove && linebuf[0] == '}')
			break;
	}
	if (addr == dot)
		return (0);
	if (f != vmove)
		wcursor = c == ']' ? strend(linebuf) : linebuf;
	else
		wcursor = 0;
	wdot = addr;
	vmoving = 0;
	return (1);
}
コード例 #14
0
ファイル: xmlc.c プロジェクト: btolfa/rnv
int xmlc_digit(int u) {return isa(u,DIGIT);}
コード例 #15
0
ファイル: xmlc.c プロジェクト: btolfa/rnv
int xmlc_extender(int u) {return isa(u,EXTENDER);}
コード例 #16
0
ファイル: xmlc.c プロジェクト: btolfa/rnv
int xmlc_ideographic(int u) {return isa(u,IDEOGRAPHIC);}
コード例 #17
0
ファイル: xmlc.c プロジェクト: btolfa/rnv
int xmlc_combining_char(int u) {return isa(u,COMBINING_CHAR);}
コード例 #18
0
ファイル: circle_widget.hpp プロジェクト: QuLogic/jot-lib
 static CIRCLE_WIDGETptr get_active_instance() {
    return isa(_active) ? (CIRCLE_WIDGET*)&*_active : nullptr;
 }
コード例 #19
0
ファイル: xmlc.c プロジェクト: btolfa/rnv
int xmlc_base_char(int u) {return isa(u,BASE_CHAR);}
コード例 #20
0
ファイル: Bytes.cpp プロジェクト: AndreLouisCaron/cxxpy
 bool Bytes::isa ( const Object& object, bool exact )
 {
     return (isa(object.handle(), exact));
 }
コード例 #21
0
ファイル: select_widget.hpp プロジェクト: QuLogic/jot-lib
 static SELECT_WIDGETptr get_active_instance() {
    return isa(_active) ? (SELECT_WIDGET*)&*_active : nullptr;
 }
コード例 #22
0
 std::string operator()(Obj recval) const
 {
     if(!isa(recval))
         throw GAPException("Invalid attempt to read string");
     return std::string((char*)CHARS_STRING(recval));
 }
コード例 #23
0
ファイル: indCIMXMLHandler.c プロジェクト: kkaempf/sblim-sfcb
CMPIStatus
IndCIMXMLHandlerCreateInstance(CMPIInstanceMI * mi,
                               const CMPIContext *ctx,
                               const CMPIResult *rslt,
                               const CMPIObjectPath * cop,
                               const CMPIInstance *ci)
{
  CMPIStatus      st = { CMPI_RC_OK, NULL };
  CMPIArgs       *in,
                 *out = NULL;
  CMPIObjectPath *op;
  unsigned short  persistenceType;

  _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerCreateInstance");

  if (interOpNameSpace(cop, &st) == 0)
    _SFCB_RETURN(st);

  CMPIInstance   *ciLocal = CMClone(ci, NULL);
  memLinkInstance(ciLocal);
  CMPIObjectPath* copLocal = CMClone(cop, NULL);
  memLinkObjectPath(copLocal);

  setCCN(copLocal,ciLocal,"CIM_ComputerSystem");

  internalProviderGetInstance(copLocal, &st);
  if (st.rc == CMPI_RC_ERR_FAILED)
    _SFCB_RETURN(st);
  if (st.rc == CMPI_RC_OK) {
    setStatus(&st, CMPI_RC_ERR_ALREADY_EXISTS, NULL);
    _SFCB_RETURN(st);
  }


  CMPIString *sysname=ciLocal->ft->getProperty(ciLocal,"SystemName",&st).value.string;
  if (sysname == NULL || sysname->hdl == NULL) {
    char hostName[512];
    hostName[0]=0;
    gethostname(hostName,511); /* should be the same as SystemName of IndicationService */
    CMAddKey(copLocal, "SystemName", hostName, CMPI_chars);
    CMSetProperty(ciLocal,"SystemName",hostName,CMPI_chars);
  }


  CMPIString     *dest =
      CMGetProperty(ciLocal, "destination", &st).value.string;
  if (dest == NULL || CMGetCharPtr(dest) == NULL) {
    setStatus(&st, CMPI_RC_ERR_FAILED,
              "Destination property not found; is required");
    CMRelease(ciLocal);
    _SFCB_RETURN(st);
  } else {                      /* if no scheme is given, assume http (as
                                 * req. for param by mof) */
    char           *ds = CMGetCharPtr(dest);
    if (strstr(ds, "://") == NULL) {
      char           *prefix = "http://";
      int             n = strlen(ds) + strlen(prefix) + 1;
      char           *newdest = malloc(n * sizeof(*newdest));
      strcpy(newdest, prefix);
      strcat(newdest, ds);
      CMSetProperty(ciLocal, "destination", newdest, CMPI_chars);
      free(newdest);
    }
  }

  CMPIData        persistence =
      CMGetProperty(ciLocal, "persistencetype", &st);
  if (persistence.state == CMPI_nullValue
      || persistence.state == CMPI_notFound) {
    persistenceType = 2;        /* default is 2 = permanent */
  } else if (persistence.value.uint16 < 1 || persistence.value.uint16 > 3) {
    setStatus(&st, CMPI_RC_ERR_FAILED,
              "PersistenceType property must be 1, 2, or 3");
    CMRelease(ciLocal);
    _SFCB_RETURN(st);
  } else {
    persistenceType = persistence.value.uint16;
  }
  CMSetProperty(ciLocal, "persistencetype", &persistenceType, CMPI_uint16);

  if (CMClassPathIsA(_broker, copLocal, "cim_listenerdestination", NULL)) {

    //get the creation timestamp
    struct timeval  tv;
    struct timezone tz;
    char   context[100];
    gettimeofday(&tv, &tz);
    struct tm cttm;
    char * gtime = malloc(15 * sizeof(*gtime));
    memset(gtime, 0, 15 * sizeof(char));
    if (gmtime_r(&tv.tv_sec, &cttm) != NULL) {
      strftime(gtime, 15, "%Y%m%d%H%M%S", &cttm);
    }

    // Even though reliable indications may be disabled, we need to do this 
    // in case it ever gets enabled.
    // Get the IndicationService name
    CMPIObjectPath * isop = CMNewObjectPath(_broker, "root/interop", "CIM_IndicationService", NULL);
    CMPIEnumeration * isenm = _broker->bft->enumerateInstances(_broker, ctx, isop, NULL, NULL);
    CMPIData isinst = CMGetNext(isenm, NULL);
    CMPIData mc = CMGetProperty(isinst.value.inst, "Name", NULL);

    // build the context string
    sprintf (context,"%s#%s#",mc.value.string->ft->getCharPtr(mc.value.string,NULL),gtime);
    CMPIValue scontext;
    scontext.string = sfcb_native_new_CMPIString(context, NULL, 0);
    free(gtime);

    // set the properties
    CMSetProperty(ciLocal, "SequenceContext", &scontext, CMPI_string);
    CMPIValue zarro = {.sint64 = -1 };
    CMSetProperty(ciLocal, "LastSequenceNumber", &zarro, CMPI_sint64);
  }

  _SFCB_TRACE_VAR(CMPIString *str = CDToString(_broker, copLocal, NULL));
  _SFCB_TRACE_VAR(CMPIString *ns = CMGetNameSpace(copLocal, NULL));
  _SFCB_TRACE(1,("--- handler %s %s", (char *) ns->hdl, (char *) str->hdl));

  in = CMNewArgs(_broker, NULL);
  CMAddArg(in, "handler", &ciLocal, CMPI_instance);
  CMAddArg(in, "key", &copLocal, CMPI_ref);
  op = CMNewObjectPath(_broker, "root/interop",
                       "cim_indicationsubscription", &st);
  CBInvokeMethod(_broker, ctx, op, "_addHandler", in, out, &st);

  if (st.rc == CMPI_RC_OK) {
    st = InternalProviderCreateInstance(NULL, ctx, rslt, copLocal, ciLocal);
  }
  else {
    CBInvokeMethod(_broker,ctx,op,"_removeHandler",in,out,NULL);
  }

  _SFCB_RETURN(st);
}

/*
 * ModifyInstance only for ListenerDestination.Destination
 */
CMPIStatus
IndCIMXMLHandlerModifyInstance(CMPIInstanceMI * mi,
                               const CMPIContext *ctx,
                               const CMPIResult *rslt,
                               const CMPIObjectPath * cop,
                               const CMPIInstance *ci,
                               const char **properties)
{
  CMPIStatus st = { CMPI_RC_OK, NULL };
  CMPIString *cn = CMGetClassName(cop, NULL);
  const char *cns = cn->ft->getCharPtr(cn,NULL);
  CMPIArgs *in;
        
  _SFCB_ENTER(TRACE_INDPROVIDER, "IndCIMXMLHandlerModifyInstance");   
   
  if(isa("root/interop", cns, "cim_listenerdestination")) {
    _SFCB_TRACE(1,("--- modify %s", cns));
                
    CMPIData newDest = CMGetProperty(ci, "Destination", &st);
    fprintf(stderr, "new dest is %s\n", CMGetCharPtr(newDest.value.string));

    if(newDest.state != CMPI_goodValue) {
      st.rc = CMPI_RC_ERR_FAILED;
      return st;        
    }
          
    in=CMNewArgs(_broker,NULL);
    CMAddArg(in,"handler",&ci,CMPI_instance);
    CMAddArg(in,"key",&cop,CMPI_ref);
    /* cn needs to be IndicationSub to route the IM call to interopProv */
    CMPIObjectPath* sop=CMNewObjectPath(_broker,"root/interop","cim_indicationsubscription",&st);
    CBInvokeMethod(_broker,ctx,sop,"_updateHandler",in,NULL,&st);

    if (st.rc==CMPI_RC_OK) {
      st=InternalProviderModifyInstance(NULL,ctx,rslt,cop,ci,properties);
    }
    else {
      CBInvokeMethod(_broker,ctx,sop,"_removeHandler",in,NULL,NULL);
    }

  }

  _SFCB_RETURN(st);
}
コード例 #24
0
ファイル: trace.hpp プロジェクト: QuLogic/jot-lib
 static TRACEptr get_active_instance() {
     return isa(_active) ? (TRACE*)&*_active : nullptr;
 }
コード例 #25
0
ファイル: pc1512.cpp プロジェクト: fesh0r/mame-full
void pc1640_state::pc1640(machine_config &config)
{
	I8086(config, m_maincpu, 24_MHz_XTAL / 3);
	m_maincpu->set_addrmap(AS_PROGRAM, &pc1640_state::pc1640_mem);
	m_maincpu->set_addrmap(AS_IO, &pc1640_state::pc1640_io);
	m_maincpu->set_irq_acknowledge_callback(I8259A2_TAG, FUNC(pic8259_device::inta_cb));

	// sound
	SPEAKER(config, "mono").front_center();
	SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 0.80);

	// devices
	PC1512_KEYBOARD(config, m_kb, 0);
	m_kb->clock_wr_callback().set(FUNC(pc1512_base_state::kbclk_w));
	m_kb->data_wr_callback().set(FUNC(pc1512_base_state::kbdata_w));

	pc1512_mouse_port_device &mouse(PC1512_MOUSE_PORT(config, PC1512_MOUSE_PORT_TAG, pc1512_mouse_port_devices, "mouse"));
	mouse.x_wr_callback().set(FUNC(pc1512_base_state::mouse_x_w));
	mouse.y_wr_callback().set(FUNC(pc1512_base_state::mouse_y_w));
	mouse.m1_wr_callback().set(m_kb, FUNC(pc1512_keyboard_device::m1_w));
	mouse.m2_wr_callback().set(m_kb, FUNC(pc1512_keyboard_device::m2_w));

	AM9517A(config, m_dmac, 24_MHz_XTAL / 6);
	m_dmac->out_hreq_callback().set(FUNC(pc1640_state::hrq_w));
	m_dmac->out_eop_callback().set(FUNC(pc1640_state::eop_w));
	m_dmac->in_memr_callback().set(FUNC(pc1640_state::memr_r));
	m_dmac->out_memw_callback().set(FUNC(pc1640_state::memw_w));
	m_dmac->in_ior_callback<1>().set(FUNC(pc1640_state::ior1_r));
	m_dmac->in_ior_callback<2>().set(FUNC(pc1640_state::ior2_r));
	m_dmac->in_ior_callback<3>().set(FUNC(pc1640_state::ior3_r));
	m_dmac->out_iow_callback<0>().set(FUNC(pc1640_state::iow0_w));
	m_dmac->out_iow_callback<1>().set(FUNC(pc1640_state::iow1_w));
	m_dmac->out_iow_callback<2>().set(FUNC(pc1640_state::iow2_w));
	m_dmac->out_iow_callback<3>().set(FUNC(pc1640_state::iow3_w));
	m_dmac->out_dack_callback<0>().set(FUNC(pc1640_state::dack0_w));
	m_dmac->out_dack_callback<1>().set(FUNC(pc1640_state::dack1_w));
	m_dmac->out_dack_callback<2>().set(FUNC(pc1640_state::dack2_w));
	m_dmac->out_dack_callback<3>().set(FUNC(pc1640_state::dack3_w));

	PIC8259(config, m_pic, 0);
	m_pic->out_int_callback().set_inputline(m_maincpu, INPUT_LINE_IRQ0);

	PIT8253(config, m_pit, 0);
	m_pit->set_clk<0>(28.636363_MHz_XTAL / 24);
	m_pit->out_handler<0>().set(m_pic, FUNC(pic8259_device::ir0_w));
	m_pit->set_clk<1>(28.636363_MHz_XTAL / 24);
	m_pit->out_handler<1>().set(FUNC(pc1512_base_state::pit1_w));
	m_pit->set_clk<2>(28.636363_MHz_XTAL / 24);
	m_pit->out_handler<2>().set(FUNC(pc1512_base_state::pit2_w));

	MC146818(config, m_rtc, 32.768_kHz_XTAL);
	m_rtc->irq().set(m_pic, FUNC(pic8259_device::ir2_w));

	PC_FDC_XT(config, m_fdc, 0);
	m_fdc->intrq_wr_callback().set(FUNC(pc1512_base_state::fdc_int_w));
	m_fdc->drq_wr_callback().set(FUNC(pc1512_base_state::fdc_drq_w));
	FLOPPY_CONNECTOR(config, PC_FDC_XT_TAG ":0", pc1512_floppies, "525dd", pc1512_base_state::floppy_formats);
	FLOPPY_CONNECTOR(config, PC_FDC_XT_TAG ":1", pc1512_floppies, nullptr, pc1512_base_state::floppy_formats);

	INS8250(config, m_uart, 1.8432_MHz_XTAL);
	m_uart->out_tx_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd));
	m_uart->out_dtr_callback().set(RS232_TAG, FUNC(rs232_port_device::write_dtr));
	m_uart->out_rts_callback().set(RS232_TAG, FUNC(rs232_port_device::write_rts));
	m_uart->out_int_callback().set(m_pic, FUNC(pic8259_device::ir4_w));

	CENTRONICS(config, m_centronics, centronics_devices, "printer");
	m_centronics->ack_handler().set(FUNC(pc1512_state::write_centronics_ack));
	m_centronics->busy_handler().set(FUNC(pc1512_state::write_centronics_busy));
	m_centronics->perror_handler().set(FUNC(pc1512_state::write_centronics_perror));
	m_centronics->select_handler().set(FUNC(pc1512_state::write_centronics_select));
	m_centronics->fault_handler().set(FUNC(pc1512_state::write_centronics_fault));

	OUTPUT_LATCH(config, m_cent_data_out);
	m_centronics->set_output_latch(*m_cent_data_out);

	rs232_port_device &rs232(RS232_PORT(config, RS232_TAG, default_rs232_devices, nullptr));
	rs232.rxd_handler().set(m_uart, FUNC(ins8250_uart_device::rx_w));
	rs232.dcd_handler().set(m_uart, FUNC(ins8250_uart_device::dcd_w));
	rs232.dsr_handler().set(m_uart, FUNC(ins8250_uart_device::dsr_w));
	rs232.ri_handler().set(m_uart, FUNC(ins8250_uart_device::ri_w));
	rs232.cts_handler().set(m_uart, FUNC(ins8250_uart_device::cts_w));

	// ISA8 bus
	isa8_device &isa(ISA8(config, ISA_BUS_TAG, 0));
	isa.set_memspace(m_maincpu, AS_PROGRAM);
	isa.set_iospace(m_maincpu, AS_IO);
	isa.irq2_callback().set(m_pic, FUNC(pic8259_device::ir2_w));
	isa.irq3_callback().set(m_pic, FUNC(pic8259_device::ir3_w));
	isa.irq4_callback().set(m_pic, FUNC(pic8259_device::ir4_w));
	isa.irq5_callback().set(m_pic, FUNC(pic8259_device::ir5_w));
	isa.irq6_callback().set(m_pic, FUNC(pic8259_device::ir6_w));
	isa.irq7_callback().set(m_pic, FUNC(pic8259_device::ir7_w));
	isa.drq1_callback().set(I8237A5_TAG, FUNC(am9517a_device::dreq1_w));
	isa.drq2_callback().set(I8237A5_TAG, FUNC(am9517a_device::dreq2_w));
	isa.drq3_callback().set(I8237A5_TAG, FUNC(am9517a_device::dreq3_w));
	ISA8_SLOT(config, "isa1", 0, ISA_BUS_TAG, pc_isa8_cards, nullptr, false); // FIXME: determine ISA bus clock
	ISA8_SLOT(config, "isa2", 0, ISA_BUS_TAG, pc_isa8_cards, nullptr, false);
	ISA8_SLOT(config, "isa3", 0, ISA_BUS_TAG, pc_isa8_cards, nullptr, false);
	ISA8_SLOT(config, "isa4", 0, ISA_BUS_TAG, pc_isa8_cards, nullptr, false);
	ISA8_SLOT(config, "isa5", 0, ISA_BUS_TAG, pc1640_isa8_cards, "iga", false);

	// internal ram
	RAM(config, RAM_TAG).set_default_size("640K");

	// software list
	SOFTWARE_LIST(config, "flop_list").set_original("pc1640_flop");
	SOFTWARE_LIST(config, "hdd_list").set_original("pc1640_hdd");
}
コード例 #26
0
 int operator()(Obj recval) const
 {
     if(!isa(recval))
         throw GAPException("Invalid attempt to read int");
     return INT_INTOBJ(recval);
 }