当前位置: 首页>>代码示例>>C++>>正文


C++ PUTS函数代码示例

本文整理汇总了C++中PUTS函数的典型用法代码示例。如果您正苦于以下问题:C++ PUTS函数的具体用法?C++ PUTS怎么用?C++ PUTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PUTS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: dump_traceback

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++;
    }
}
开发者ID:collinanderson,项目名称:ensurepip,代码行数:26,代码来源:traceback.c

示例2: HTTPMakeResponse

/*	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;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:39,代码来源:HTTPRes.c

示例3: asm

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;
}
开发者ID:crimsonwoods,项目名称:mirb-stm32f4discovery,代码行数:25,代码来源:syscalls.c

示例4: display_line

/*	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
   
}
开发者ID:svagionitis,项目名称:libwww,代码行数:34,代码来源:GridText.c

示例5: dump_frame

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);
}
开发者ID:collinanderson,项目名称:ensurepip,代码行数:32,代码来源:traceback.c

示例6: usb_send_desc

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);
  }
}
开发者ID:Tempfox,项目名称:contiki-jn51xx,代码行数:59,代码来源:usb_aux.c

示例7: ARGS2

/*      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);
}
开发者ID:thentenaar,项目名称:mosaic-ng,代码行数:63,代码来源:HTFile.c

示例8: main

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;
}
开发者ID:rdebath,项目名称:sgt,代码行数:58,代码来源:genalarm.c

示例9: write_thread_id

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");
}
开发者ID:524777134,项目名称:cpython,代码行数:10,代码来源:traceback.c

示例10: write_thread_id

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");
}
开发者ID:collinanderson,项目名称:ensurepip,代码行数:10,代码来源:traceback.c

示例11: main

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);
}
开发者ID:DawidvC,项目名称:mythryl,代码行数:28,代码来源:cc-info.c

示例12: HTNewsDir_new

/*	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;
}
开发者ID:BackupTheBerlios,项目名称:texlive,代码行数:59,代码来源:HTNDir.c

示例13: ARGS2

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; "));
    }
}
开发者ID:avsm,项目名称:openbsd-lynx,代码行数:11,代码来源:HTWSRC.c

示例14: give_parameter

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; ");
    }
}
开发者ID:stefanhusmann,项目名称:Amaya,代码行数:11,代码来源:HTWSRC.c

示例15: DriverEntry

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;
    
}
开发者ID:HITEG,项目名称:TenByTen6410_SLC,代码行数:52,代码来源:driver.cpp


注:本文中的PUTS函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。