Ejemplo n.º 1
0
static void
dump_traceback(int fd, PyThreadState *tstate, int write_header)
{
    PyFrameObject *frame;
    unsigned int depth;

    if (write_header)
        PUTS(fd, "Stack (most recent call first):\n");

    frame = _PyThreadState_GetFrame(tstate);
    if (frame == NULL)
        return;

    depth = 0;
    while (frame != NULL) {
        if (MAX_FRAME_DEPTH <= depth) {
            PUTS(fd, "  ...\n");
            break;
        }
        if (!PyFrame_Check(frame))
            break;
        dump_frame(fd, frame);
        frame = frame->f_back;
        depth++;
    }
}
Ejemplo n.º 2
0
/*	HTTPMakeResponse
**	----------------
**	Makes a HTTP/1.0-1.1 response header.
*/
PRIVATE int HTTPMakeResponse (HTStream * me, HTRequest * request)
{
    char crlf[3];
    HTRsHd response_mask = HTRequest_rsHd(request);
    *crlf = CR; *(crlf+1) = LF; *(crlf+2) = '\0';

    if (response_mask & HT_S_LOCATION) {		/* @@@ */

    }
    if (response_mask & HT_S_PROXY_AUTH) {		/* @@@ */

    }
    if (response_mask & HT_S_PUBLIC) {			/* @@@ */

    }
    if (response_mask & HT_S_RETRY_AFTER) {		/* @@@ */

    }
    if (response_mask & HT_S_SERVER) {
	PUTS("Server: ");
	PUTS(HTLib_appName());
	PUTC('/');
	PUTS(HTLib_appVersion());
	PUTC(' ');
	PUTS(HTLib_name());
	PUTC('/');
	PUTS(HTLib_version());
	PUTBLOCK(crlf, 2);
    }
    if (response_mask & HT_S_WWW_AUTH) {		/* @@@ */

    }
    HTTRACE(PROT_TRACE, "HTTP........ Generating Response Headers\n");
    return HT_OK;
}
Ejemplo n.º 3
0
void *_sbrk(ptrdiff_t increment)
{
	extern char _end;
	static char *heap_end = 0;
	char *prev_heap_end;
	char register *stack_ptr asm("sp");

	if (heap_end == 0) {
		heap_end = &_end;
	}
	prev_heap_end = heap_end;
	if ((heap_end + increment) > stack_ptr) {
		PUTS("sp=");
		PUTP(stack_ptr);
		PUTS("\n");
		PUTS("heap=");
		PUTP(heap_end);
		PUTS("\n");
		PUTS("sbrk: no more heap\n");
		errno = ENOMEM;
		return (void*)-1;
	}
	heap_end += increment;
	return prev_heap_end;
}
Ejemplo n.º 4
0
/*	Output a line
**	-------------
*/
PRIVATE void display_line (HText * text, HTLine * line)
{
#ifdef CURSES
      int     y, x;

      waddstr(w_text, SPACES(line->offset));
      waddstr(w_text, line->data);
      getyx(w_text, y, x);
      if (y < DISPLAY_LINES-1) {
              wmove(w_text, ++y, 0);
      }
#else
   if (!text->target)
   {
#ifdef CYRILLIC
       /* HWL 18/7/94: applied patch from [email protected] (Anton Tropashko) */
       a_print(SPACES(line->offset),H,stdout); 
       a_print(line->data,H,stdout);
       fputc('\n',stdout);
#else
       OutputData(LineMode_getView(text->pLm), "%s%s\n", SPACES(line->offset), line->data);
#endif
   }
   else {
       PUTS(SPACES(line->offset));
       PUTS(line->data);
       PUTC('\n');
   }
#endif
   
}
Ejemplo n.º 5
0
static void
dump_frame(int fd, PyFrameObject *frame)
{
    PyCodeObject *code;
    int lineno;

    code = frame->f_code;
    PUTS(fd, "  File ");
    if (code != NULL && code->co_filename != NULL
        && PyUnicode_Check(code->co_filename))
    {
        write(fd, "\"", 1);
        dump_ascii(fd, code->co_filename);
        write(fd, "\"", 1);
    } else {
        PUTS(fd, "???");
    }

    /* PyFrame_GetLineNumber() was introduced in Python 2.7.0 and 3.2.0 */
    lineno = PyCode_Addr2Line(code, frame->f_lasti);
    PUTS(fd, ", line ");
    dump_decimal(fd, lineno);
    PUTS(fd, " in ");

    if (code != NULL && code->co_name != NULL
        && PyUnicode_Check(code->co_name))
        dump_ascii(fd, code->co_name);
    else
        PUTS(fd, "???");

    write(fd, "\n", 1);
}
Ejemplo n.º 6
0
static void
usb_send_desc(setup_t *sp)
{
  // initialize with:
  //  * len = requested length
  //  * dsc = configuration descriptor
  //  * wTotalLength = wTotalLength field of configuration descriptor
  uint8_t     len = HTOUS(sp->asdescreq.len);
  usbdescr_t *dsc = (usbdescr_t*) &(usbdev.usbdesc[((usbdescr_t*) usbdev.usbdesc)->bLength]);
  uint16_t    wTotalLength = HTOUS(*(uint16_t*) dsc->buf);
  size_t      i;

  switch(sp->asdescreq.val)
  {
    case DEVICE_DESCRIPTOR:
      PUTS("dev_desc\n");
      dsc = (usbdescr_t*) usbdev.usbdesc;
      len = dsc->bLength;
      break;

    case CONFIGURATION_DESCRIPTOR:
      PUTS("conf_desc\n");
      len = MIN(len, wTotalLength);
      break;

    case STRING_DESCRIPTOR:
      PUTS("str_desc\n");
      dsc = (usbdescr_t*) &dsc->buf[wTotalLength-sizeof(usbdescr_t)]; /* at the first string now */
      for(i=0; i<sp->asdescreq.idx && dsc->bDescriptorType==STRING_DESCRIPTOR; i++)
          dsc = (usbdescr_t*) &dsc->buf[dsc->bLength-sizeof(usbdescr_t)];
      len = dsc->bLength;
      break;

    default:
      PUTS("unknown setup request\n");
      STALLEP0();
  }

  {
  uint8_t wlen = MIN(64, len),
          *pt  = (uint8_t*) dsc;
  reg_t   st   = {0x00};

  do
  {
    wlen = MIN(64, len);

    /* wait until asserted */
    do { rreg(EPIRQ, &st); } while( !st.EPIRQ.IN0BAVIRQ );

    /* writing to EP0, also clrs irq */
    wregn(EP0FIFO, pt, wlen, false);
    wregn(EP0BC, &wlen, sizeof(uint8_t), len<64);

    len -= wlen;
    pt  += wlen;
  } while(len>0);
  }
}
Ejemplo n.º 7
0
/*      Output parent directory entry
**
**    This gives the TITLE and H1 header, and also a link
**    to the parent directory if appropriate.
*/
PUBLIC void HTDirTitles ARGS2(HTStructured *, target,
		 HTAnchor * , anchor)

{
    char * logical = HTAnchor_address(anchor);
    char * path = HTParse(logical, "", PARSE_PATH + PARSE_PUNCTUATION);
    char * current;

    current = strrchr(path, '/');	/* last part or "" */
    free(logical);

    {
      char * printable = NULL;
      StrAllocCopy(printable, (current + 1));
      HTUnEscape(printable);
      START(HTML_TITLE);
      PUTS(*printable ? printable : "Welcome ");
      PUTS(" directory");
      END(HTML_TITLE);    
    
      START(HTML_H1);
      PUTS(*printable ? printable : "Welcome");
      END(HTML_H1);
      free(printable);
    }

    /*  Make link back to parent directory
     */

    if (current && current[1]) {   /* was a slash AND something else too */
        char * parent;
	char * relative;
	*current++ = 0;
      parent = strrchr(path, '/');  /* penultimate slash */

	relative = (char*) malloc(strlen(current) + 4);
	if (relative == NULL) outofmem(__FILE__, "DirRead");
	sprintf(relative, "%s/..", current);
        PUTS ("<A HREF=\"");
        PUTS (relative);
        PUTS ("\">");
	free(relative);

	PUTS("Up to ");
	if (parent) {
	  char * printable = NULL;
	  StrAllocCopy(printable, parent + 1);
	  HTUnEscape(printable);
	  PUTS(printable);
	  free(printable);
	} else {
	  PUTS("/");
	}

        PUTS("</A>");
      }
    free(path);
}
Ejemplo n.º 8
0
int main(void)
{
    int i;
    FILE *fp;

    generate_alarm_sound();

    for (i = 0; i < alarm_len; i++) {
	fputc(alarm_sound[i] & 0xFF, stdout);
	fputc((alarm_sound[i] >> 8) & 0xFF, stdout);
    }

    /*
     * Diagnostic output as a .wav.
     */
    if ((fp = fopen("build/almsnd.wav", "wb")) != NULL) {
	char header[256], *p = header;
	int j;

#define PUT(n, value) do { \
    int i; \
    for (i=0; i<(n); i++) { \
	*p++ = (((unsigned)value) >> (i*8)) & 0xFF; \
    } \
} while (0)
#define PUTS(s) do { \
    int i; \
    for (i=0; i<sizeof(s)-1; i++) { \
	*p++ = s[i]; \
    } \
} while (0)

	PUTS("RIFF");
	PUT(4, alarm_len * 2 + 36);
	PUTS("WAVE");
	PUTS("fmt ");
	PUT(4, 0x10);
	PUT(2, 1);		       /* PCM */
	PUT(2, 1);		       /* channels */
	PUT(4, alarm_freq);	       /* sample rate */
	PUT(4, alarm_freq * 2);	       /* data rate */
	PUT(2, 2);		       /* bytes per frame */
	PUT(2, 16);		       /* bits per sample */
	PUTS("data");
	PUT(4, alarm_len * 2);
	fwrite(header, 1, p - header, fp);

	for (j = 0; j < alarm_len; j++) {
	    p = header;
	    PUT(2, alarm_sound[j]);
	    fwrite(header, 1, p - header, fp);
	}

	fclose(fp);
    }

    return 0;
}
Ejemplo n.º 9
0
static void
write_thread_id(int fd, PyThreadState *tstate, int is_current)
{
    if (is_current)
        PUTS(fd, "Current thread 0x");
    else
        PUTS(fd, "Thread 0x");
    dump_hexadecimal(sizeof(long)*2, (unsigned long)tstate->thread_id, fd);
    PUTS(fd, ":\n");
}
Ejemplo n.º 10
0
static void
write_thread_id(int fd, PyThreadState *tstate, int is_current)
{
    if (is_current)
        PUTS(fd, "Current thread 0x");
    else
        PUTS(fd, "Thread 0x");
    dump_hexadecimal(fd, (unsigned long)tstate->thread_id, sizeof(long)*2);
    PUTS(fd, " (most recent call first):\n");
}
Ejemplo n.º 11
0
main(int argc,char *argv[])
{
  if (argc != 2) {
    fprintf(stderr,"usage: %s name-for-package\n", argv[0]);
    exit(1);
  }
  NEWLINE();
  PUTS("package "); PUTS(argv[1]); PUTS(" : Cc_Info =\n");
  PUTS("\tstruct\n");
  PUTS("\t\t");COMMENT("all sizes in bytes");
  NEWLINE();
  PUTVAL("intSzB", sizeof(int));
  PUTVAL("shortSzB", sizeof(short));
  PUTVAL("longSzB", sizeof(long));
  NEWLINE();
  PUTVAL("charSzB", sizeof(char));
  NEWLINE();
  PUTVAL("floatSzB", sizeof(float));
  PUTVAL("doubleSzB", sizeof(double));
  NEWLINE();
  PUTVAL("ptrSzB", sizeof(int *));
  NEWLINE();
  PUTVAL("unionAlign", sizeof(int *));
  PUTVAL("structAlign", sizeof(int *));
  NEWLINE();
  PUTS("\tend "); PUTS("/* package "); PUTS(argv[1]); PUTS(" */\n");
  exit(0);
}
Ejemplo n.º 12
0
/*	HTNewsDir_new
**	----------
**    	Creates a structured stream object and sets up the initial HTML stuff
**	Returns the newsdir object if OK, else NULL
*/
PUBLIC HTNewsDir * HTNewsDir_new (HTRequest * request, const char * title,
				  HTNewsDirKey key, BOOL cache)
{
    HTNewsDir *dir;
    if (!request) return NULL;

    /* Create object */
    if ((dir = (HTNewsDir *) HT_CALLOC(1, sizeof (HTNewsDir))) == NULL)
        HT_OUTOFMEM("HTNewsDir_new");
    dir->target = HTMLGenerator(request, NULL, WWW_HTML,
				HTRequest_outputFormat(request),
				HTRequest_outputStream(request));
    HTAnchor_setFormat(HTRequest_anchor(request), WWW_HTML);
    dir->request = request;
    dir->key = key;
    dir->lastLevel = -1;  /* Added by MP. */

    /*  Get the newsgroup(s) name; added by MP. */
    {
        char* url = HTAnchor_physical(HTRequest_anchor(request));
        char* p = url+strlen(url);
        while (p > url && p[-1] != ':' && p[-1] != '/' && p[-1] != '\\')
            p--;
        StrAllocCopy (dir->name, p);
    }

    if (key != HT_NDK_NONE) {			       /* Thread is unsorted */
	int total = HTNews_maxArticles();
	dir->array = HTArray_new(total > 0 ? total : 128);
    }

    /* If we are asked to prepare a cache entry then create the cache array */
    if (cache) {
	int total = HTNews_maxArticles();
	dir->cache = HTArray_new(total > 0 ? total : 128);
    }

    /* Start the HTML stuff */
    {
	HTStructured *target = dir->target;
	const char *msg = title ? title : "News Listing";
	START(HTML_HTML);
	START(HTML_HEAD);
	START(HTML_TITLE);
	PUTS(msg);
	END(HTML_TITLE);
	END(HTML_HEAD);
	START(HTML_BODY);
	START(HTML_H1);
	PUTS(msg);
	END(HTML_H1);
    }
    return dir;
}
Ejemplo n.º 13
0
PRIVATE void give_parameter ARGS2(HTStream *, me, int, p)
{
    PUTS(par_name[p]);
    if (me->par_value[p]) {
	PUTS(": ");
	PUTS(me->par_value[p]);
	PUTS("; ");
    } else {
	PUTS(gettext(" NOT GIVEN in source file; "));
    }
}
Ejemplo n.º 14
0
void give_parameter (HTStream * me, int p)
{
    PUTS(par_name[p]);
    if (me->par_value[p]) {
	PUTS(": ");
	PUTS(me->par_value[p]);
	PUTS("; ");
    } else {
        PUTS(" NOT GIVEN in source file; ");
    }
}
Ejemplo n.º 15
0
/* TODO this function should be part of either Zend or PHP API */
static PHP_INI_DISP(php_ibase_password_displayer_cb)
{

	if ((type == PHP_INI_DISPLAY_ORIG && ini_entry->orig_value)
			|| (type == PHP_INI_DISPLAY_ACTIVE && ini_entry->value)) {
		PUTS("********");
	} else if (!sapi_module.phpinfo_as_text) {
		PUTS("<i>no value</i>");
	} else {
		PUTS("no value");
	}
}
Ejemplo n.º 16
0
extern "C" NTSTATUS DriverEntry(
        IN PDRIVER_OBJECT pDriverObject,
        IN PUNICODE_STRING pRegistryPath)
{
    NDIS_STATUS  status;
    NDIS_HANDLE  hwrapper;
    
    NDIS40_MINIPORT_CHARACTERISTICS ndischar;
    
    PUTS(("<Davicom DM9000x / DM900x driver v3.7.0 for WinCE 4.2/5.0/6.0> \r\n"));
    PUTS(("(netbook/smartbook default(a.x.w))\r\n"));
    
    NdisMInitializeWrapper(
        &hwrapper,
        pDriverObject,
        pRegistryPath,
        NULL);
        
    memset((void*)&ndischar, 0, sizeof(ndischar));
    
    ndischar.Ndis30Chars.MajorNdisVersion = PRJ_NDIS_MAJOR_VERSION;
    ndischar.Ndis30Chars.MinorNdisVersion = PRJ_NDIS_MINOR_VERSION;
    
    ndischar.Ndis30Chars.CheckForHangHandler = MiniportCheckForHang;
    
    ndischar.Ndis30Chars.HaltHandler = MiniportHalt;
    ndischar.Ndis30Chars.HandleInterruptHandler = MiniportInterruptHandler;
    ndischar.Ndis30Chars.InitializeHandler = MiniportInitialize;
    ndischar.Ndis30Chars.ISRHandler = MiniportISRHandler;
    ndischar.Ndis30Chars.QueryInformationHandler = MiniportQueryInformation;
    
    ndischar.Ndis30Chars.ResetHandler = MiniportReset;
    ndischar.Ndis30Chars.SendHandler = MiniportSend;
    ndischar.Ndis30Chars.SetInformationHandler = MiniportSetInformation;
    
    if ((status = NdisMRegisterMiniport(
                      hwrapper,
                      (PNDIS_MINIPORT_CHARACTERISTICS) & ndischar,
                      sizeof(ndischar)) != NDIS_STATUS_SUCCESS))
    {
        NdisTerminateWrapper(hwrapper, NULL);
        return status;
    }
    
    
#ifndef IMPL_DLL_ENTRY
    INIT_EXCEPTION();
#endif
    
    return NDIS_STATUS_SUCCESS;
    
}
Ejemplo n.º 17
0
/* {{{ php_ini_displayer
 */
static int php_ini_displayer(zval *el, void *arg)
{
	zend_ini_entry *ini_entry = (zend_ini_entry*)Z_PTR_P(el);
	int module_number = *(int *)arg;

	if (ini_entry->module_number != module_number) {
		return 0;
	}
	if (!sapi_module.phpinfo_as_text) {
		PUTS("<tr>");
		PUTS("<td class=\"e\">");
		PHPWRITE(ini_entry->name->val, ini_entry->name->len);
		PUTS("</td><td class=\"v\">");
		php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
		PUTS("</td><td class=\"v\">");
		php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
		PUTS("</td></tr>\n");
	} else {
		PHPWRITE(ini_entry->name->val, ini_entry->name->len);
		PUTS(" => ");
		php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
		PUTS(" => ");
		php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
		PUTS("\n");
	}
	return 0;
}
Ejemplo n.º 18
0
static bool
usb_setup(setup_t *sp)
{
  switch(sp->reqtype.type)
  {
    case 0x00: PUTS("usb: std_req - "); return std_req(sp); break;
    case 0x01: PUTS("usb: class_req - "); break;
    case 0x02: PUTS("usb: vendor_req - "); break;
    default:   GDB2_PUTS("unknown req - "); STALLEP0();
  }

  GDB2_PUTS(".\n");
  return false;
}
Ejemplo n.º 19
0
static void
faulthandler_fatal_error(int signum)
{
    const int fd = fatal_error.fd;
    unsigned int i;
    fault_handler_t *handler = NULL;
    int save_errno = errno;

    if (!fatal_error.enabled)
        return;

    for (i=0; i < faulthandler_nsignals; i++) {
        handler = &faulthandler_handlers[i];
        if (handler->signum == signum)
            break;
    }
    if (handler == NULL) {
        /* faulthandler_nsignals == 0 (unlikely) */
        return;
    }

    /* restore the previous handler */
#ifdef HAVE_SIGACTION
    (void)sigaction(signum, &handler->previous, NULL);
#else
    (void)signal(signum, handler->previous);
#endif
    handler->enabled = 0;

    PUTS(fd, "Fatal Python error: ");
    PUTS(fd, handler->name);
    PUTS(fd, "\n\n");

    faulthandler_dump_traceback(fd, fatal_error.all_threads,
                                fatal_error.interp);

    errno = save_errno;
#ifdef MS_WINDOWS
    if (signum == SIGSEGV) {
        /* don't explicitly call the previous handler for SIGSEGV in this signal
           handler, because the Windows signal handler would not be called */
        return;
    }
#endif
    /* call the previous signal handler: it is called immediately if we use
       sigaction() thanks to SA_NODEFER flag, otherwise it is deferred */
    raise(signum);
}
Ejemplo n.º 20
0
Archivo: main.c Proyecto: tkadom/TWBLE
int main(void)
{
    uint32_t error_code;
    (void) error_code;

    uart_init();

    PUTS("LED Mesh initializing");

    error_code = 
        sd_softdevice_enable(NRF_CLOCK_LFCLKSRC_XTAL_75_PPM, sd_assert_handler);
    
    test_app_init();


#ifdef RBC_MESH_SERIAL
    mesh_aci_init();
#else

    PUTS("mesh service init");

    rbc_mesh_init_params_t init_params;

    init_params.access_addr = 0xA541A68F;
    init_params.adv_int_ms = 100;
    init_params.channel = 38;
    init_params.handle_count = 2;
    init_params.packet_format = RBC_MESH_PACKET_FORMAT_ORIGINAL;
    init_params.radio_mode = RBC_MESH_RADIO_MODE_BLE_1MBIT;

    error_code = rbc_mesh_init(init_params);
    APP_ERROR_CHECK(error_code);

    error_code = rbc_mesh_value_enable(1);
    APP_ERROR_CHECK(error_code);
    error_code = rbc_mesh_value_enable(2);
    APP_ERROR_CHECK(error_code);
#endif

    sd_nvic_EnableIRQ(SD_EVT_IRQn);

    /* sleep */
    while (true)
    {
        sd_app_evt_wait();
    }

}
Ejemplo n.º 21
0
static LONG WINAPI
faulthandler_exc_handler(struct _EXCEPTION_POINTERS *exc_info)
{
    const int fd = fatal_error.fd;
    DWORD code = exc_info->ExceptionRecord->ExceptionCode;
    DWORD flags = exc_info->ExceptionRecord->ExceptionFlags;

    /* only log fatal exceptions */
    if (flags & EXCEPTION_NONCONTINUABLE) {
        /* call the next exception handler */
        return EXCEPTION_CONTINUE_SEARCH;
    }

    PUTS(fd, "Windows fatal exception: ");
    switch (code)
    {
    /* only format most common errors */
    case EXCEPTION_ACCESS_VIOLATION: PUTS(fd, "access violation"); break;
    case EXCEPTION_FLT_DIVIDE_BY_ZERO: PUTS(fd, "float divide by zero"); break;
    case EXCEPTION_FLT_OVERFLOW: PUTS(fd, "float overflow"); break;
    case EXCEPTION_INT_DIVIDE_BY_ZERO: PUTS(fd, "int divide by zero"); break;
    case EXCEPTION_INT_OVERFLOW: PUTS(fd, "integer overflow"); break;
    case EXCEPTION_IN_PAGE_ERROR: PUTS(fd, "page error"); break;
    case EXCEPTION_STACK_OVERFLOW: PUTS(fd, "stack overflow"); break;
    default:
        PUTS(fd, "code ");
        _Py_DumpDecimal(fd, code);
    }
    PUTS(fd, "\n\n");

    if (code == EXCEPTION_ACCESS_VIOLATION) {
        /* disable signal handler for SIGSEGV */
        size_t i;
        for (i=0; i < faulthandler_nsignals; i++) {
            fault_handler_t *handler = &faulthandler_handlers[i];
            if (handler->signum == SIGSEGV) {
                faulthandler_disable_fatal_handler(handler);
                break;
            }
        }
    }

    faulthandler_dump_traceback(fd, fatal_error.all_threads,
                                fatal_error.interp);

    /* call the next exception handler */
    return EXCEPTION_CONTINUE_SEARCH;
}
Ejemplo n.º 22
0
PROCESS_THREAD(ieee_process, ev, data)
{
  static void (*ieee_mlmehandler)(MAC_MlmeDcfmInd_s*);
  static void (*ieee_mcpshandler)(MAC_McpsDcfmInd_s*);

  PROCESS_BEGIN();
  PUTS("ieee_process: starting\n");

  ieee_init();
  ieee_serial_init();

  PT_INIT(&ieee_mlme); ieee_mlmehandler = ieee_mlmept;
  PT_INIT(&ieee_mcps); ieee_mcpshandler = ieee_mcpspt;

  /* start the mlme thread by requesting a scan. */
  req_scan(MAC_MLME_SCAN_TYPE_ACTIVE,0);

  PUTS("ieee_process: started\n");

  /* run until this process is exiting */
  while(true)
  {
    size_t i;
    MAC_DcfmIndHdr_s *macev;

    for(i=0; i<RX_QUEUE_SIZE && (macev=rxq_peek())!=NULL; i++)
    {
      if(rxq_peektype()==MLME) {
        //ieee_serial_mlme((MAC_MlmeDcfmInd_s*) macev);
        ieee_mlmehandler((MAC_MlmeDcfmInd_s*) macev);
      }
      else if(rxq_peektype()==MCPS) {
        //ieee_serial_mcps((MAC_McpsDcfmInd_s*) macev);
        ieee_mcpshandler((MAC_McpsDcfmInd_s*) macev);
      }

      rxq_dequeue();
    }

    if (ev==ieee_event && data == IEEE_STARTED)
      ieee_started = true;

    PROCESS_YIELD();
  }

  PUTS("ieee_process: exiting\n");
  PROCESS_END();
}
Ejemplo n.º 23
0
static int php_ini_displayer(zend_ini_entry *ini_entry, int module_number)
{
	if (ini_entry->module_number != module_number) {
		return 0;
	}

	PUTS("<TR VALIGN=\"baseline\" BGCOLOR=\"" PHP_CONTENTS_COLOR "\">");
	PUTS("<TD BGCOLOR=\"" PHP_ENTRY_NAME_COLOR "\"><B>");
	PHPWRITE(ini_entry->name, ini_entry->name_length-1);
	PUTS("</B><BR></TD><TD ALIGN=\"center\">");
	php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ACTIVE);
	PUTS("</TD><TD ALIGN=\"center\">");
	php_ini_displayer_cb(ini_entry, ZEND_INI_DISPLAY_ORIG);
	PUTS("</TD></TR>\n");
	return 0;
}
Ejemplo n.º 24
0
static void go_connecting(int fd, short what, void *arg)
{
	CONNECTOR *cr = (CONNECTOR *)arg;
	bufferevent_socket_connect(cr->bev, cr->sa, cr->socklen);
	PUTS("bufferevent_socket_connect %s", __FUNCTION__);

}
Ejemplo n.º 25
0
/****************************************************************************
 *  FUNCTION: main() - local routine                                        *
 ****************************************************************************/
int main(int argc, char *argv[])
    {
    int key_entered, Ch;

    intro();

    /* Set all 16 buffers to 0 */
    for (Ch = 0; Ch < 4; Ch++)
	   OUTPORT(base + (Ch * 2), Cal(0x000, Ch));

    inb(base+0xA);    // set automatic update mode
    inb(base+0XF);    // release zero latch

    do
	{
	CLRSCR();
	write_DAC();
	CPRINTF("\n\nWould you like to output another value (Y or N)?\n");
	key_entered = GETCH();
	} while((key_entered != 'N') && (key_entered != 'n'));

    /* Set all 16 buffers to 0 */
    for (Ch = 0; Ch < 4; Ch++)
	   OUTPORT(base + (Ch * 2), Cal(0x000, Ch));

    CLRSCR();
    PUTS("DA12-16 Sample1 complete.");
    } /* end main */
Ejemplo n.º 26
0
const char*
_Py_DumpTracebackThreads(int fd, PyInterpreterState *interp,
                         PyThreadState *current_thread)
{
    PyThreadState *tstate;
    unsigned int nthreads;

    /* Get the current interpreter from the current thread */
    tstate = PyInterpreterState_ThreadHead(interp);
    if (tstate == NULL)
        return "unable to get the thread head state";

    /* Dump the traceback of each thread */
    tstate = PyInterpreterState_ThreadHead(interp);
    nthreads = 0;
    do
    {
        if (nthreads != 0)
            write(fd, "\n", 1);
        if (nthreads >= MAX_NTHREADS) {
            PUTS(fd, "...\n");
            break;
        }
        write_thread_id(fd, tstate, tstate == current_thread);
        dump_traceback(fd, tstate, 0);
        tstate = PyThreadState_Next(tstate);
        nthreads++;
    } while (tstate != NULL);

    return NULL;
}
Ejemplo n.º 27
0
void swap_nodes(node_t *n1, node_t *n2)
{
    if (n1 == NULL || n2 == NULL || n1 == n2)
        return;

    PUTS("swap nodes");

    /* (n1 and n2 are leaves) */
    node_t *pn1 = n1->parent;
    node_t *pn2 = n2->parent;
    bool n1_first_child = is_first_child(n1);
    bool n2_first_child = is_first_child(n2);

    if (pn1 != NULL) {
        if (n1_first_child)
            pn1->first_child = n2;
        else
            pn1->second_child = n2;
    }

    if (pn2 != NULL) {
        if (n2_first_child)
            pn2->first_child = n1;
        else
            pn2->second_child = n1;
    }

    n1->parent = pn2;
    n2->parent = pn1;

    if (n1->vacant != n2->vacant) {
        update_vacant_state(n1->parent);
        update_vacant_state(n2->parent);
    }
}
Ejemplo n.º 28
0
  VIRTUAL int Accelerator::run() {
    while(1) {
      if (Global::rayQueue.size() < Global::MAX_RAYS) {
	PUTS("ACCEL IS WAITING...");
	Global::thread_pending();
	Thread::thread_cond_wait(&Global::cond_accel, &Global::mutex_accel);
	Global::thread_release();
	PUTS("ACCEL IS ACTIVE!");
      }

      if (isStop) Thread::thread_exit();  
      
      Global::global_add_job(jobFactory -> createInstance());
    }
    return 0;
  }
void CWE252_Unchecked_Return_Value__char_puts_12_bad()
{
    if(globalReturnsTrueOrFalse())
    {
        /* FLAW: Do not check the return value */
        PUTS("string");
    }
    else
    {
        /* FIX: check the return value */
        if (PUTS("string") == EOF)
        {
            printLine("puts failed!");
        }
    }
}
Ejemplo n.º 30
0
void showDiags ARGS2(
	HTStream *, 		target,
	diagnosticRecord **, 	d)
{
  long i;

  for (i = 0; d[i] != NULL; i++) {
    if (d[i]->ADDINFO != NULL) {
      PUTS("Diagnostic code is ");
      PUTS(d[i]->DIAG);
      PUTC(' ');
      PUTS(d[i]->ADDINFO);
      PUTC('\n'); ;
    }
  }
}