本文整理汇总了C++中ListCreate函数的典型用法代码示例。如果您正苦于以下问题:C++ ListCreate函数的具体用法?C++ ListCreate怎么用?C++ ListCreate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ListCreate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ParseFunction
void ParseFunction(STREAM *S, const char *Config)
{
char *Token=NULL, *Tempstr=NULL;
const char *ptr;
ListNode *Select;
TCrayon *Crayon;
if (! Functions) Functions=ListCreate();
ptr=GetToken(Config, "\\S", &Token, GETTOKEN_QUOTES);
Select=ListCreate();
ListAddNamedItem(Functions, Token, Select);
Tempstr=STREAMReadLine(Tempstr, S);
while (Tempstr)
{
StripTrailingWhitespace(Tempstr);
StripLeadingWhitespace(Tempstr);
ptr=GetToken(Tempstr, "\\S", &Token, GETTOKEN_QUOTES);
if (strcmp(Token,"}")==0) break;
if (MatchActionType(Token) > -1)
{
ParseCrayonization("action", Tempstr, Select);
}
else ParseCrayonization(Token, ptr, Select);
Tempstr=STREAMReadLine(Tempstr, S);
}
Destroy(Tempstr);
Destroy(Token);
}
示例2: main
main()
{
char *Tempstr=NULL;
ListNode *Vars, *Streams;
STREAM *S;
int i;
char *IP[]={"217.33.140.70","8.8.8.8","4.2.2.1","88.198.48.36",NULL};
Vars=ListCreate();
Streams=ListCreate();
MessageBusRegister("proc:tester.test.func", 4, 10, Tester);
MessageBusRegister("http://freegeoip.net/xml/", 4, 10, NULL);
printf("PARENT: %d\n",getpid());
for (i=0; i < 4; i++)
{
Tempstr=FormatStr(Tempstr,"string=hello&integer=%d",i);
MessageBusWrite("proc:tester.test.func", Tempstr);
MessageBusWrite("http://freegeoip.net/xml/", IP[i]);
MessageQueueAddToSelect(Streams);
S=STREAMSelect(Streams, NULL);
if (S)
{
MessageBusRecv(S, &Tempstr, Vars);
DumpVars(Vars);
}
else printf("NO ACTIVITY!\n");
sleep(1);
}
}
示例3: calloc
HTTPInfoStruct *HTTPInfoCreate(char *Host, int Port, char *Logon, char *Password, char *Method, char *Doc, char *ContentType, int ContentLength)
{
HTTPInfoStruct *Info;
char *ptr;
Info=(HTTPInfoStruct *) calloc(1,sizeof(HTTPInfoStruct));
HTTPInfoSetValues(Info, Host, Port, Logon, Password, Method, Doc, ContentType, ContentLength);
Info->ServerHeaders=ListCreate();
Info->CustomSendHeaders=ListCreate();
//SetVar(Info->CustomSendHeaders,"Accept","*/*");
if (g_Flags) Info->Flags=g_Flags;
ptr=LibUsefulGetValue("HTTP:Proxy");
if (StrLen(ptr))
{
Info->Proxy=CopyStr(Info->Proxy,ptr);
strlwr(Info->Proxy);
if (strncmp(Info->Proxy,"http:",5)==0) Info->Flags |= HTTP_PROXY;
else if (strncmp(Info->Proxy,"https:",6)==0) Info->Flags |= HTTP_PROXY;
else Info->Flags=HTTP_TUNNEL;
}
return(Info);
}
示例4:
//Encrypted settings for M8
//ES when M8 is from an AP
CTlvEsM8Ap::CTlvEsM8Ap()
{
if(!(nwKeyIndex = ListCreate()))
throw WSC_ERR_OUTOFMEMORY;
if(!(nwKey = ListCreate()))
throw WSC_ERR_OUTOFMEMORY;
}
示例5: ListCreate
//ES when M7 is from an AP
CTlvEsM7Ap::CTlvEsM7Ap()
{
nwKeyIndex = ListCreate();
if(!nwKeyIndex)
throw WSC_ERR_OUTOFMEMORY;
nwKey = ListCreate();
if(!nwKey)
throw WSC_ERR_OUTOFMEMORY;
}
示例6: MonInit
/* Initilize the Monitor
* we create an index, then the enterSem and urgentSem with
* values 1, 0 respectivly. Then the condition variable semaphore
* and List are created as array sizes K which are givent to the
* initilizing function. The semaphore for condition variable
* is given 0 for every spot in the array.
* Then the enterQueue and urgentQueue are created */
void MonInit(int k){
int i;
enterSem = NewSem(1);
urgentSem = NewSem(0);
condSems = (int*)malloc(sizeof(int)*k);
condLists = (LIST**)malloc(sizeof(LIST *)*k);
for(i=0; i<k; i++){
condSems[i] = NewSem(0);
condLists[i] = ListCreate();
}
enterQueue = ListCreate();
urgentQueue = ListCreate();
}
示例7: sizeof
ListNode *MapCreate(int Buckets, int Flags)
{
ListNode *Node, *SubNode;
int i;
//clear map flags out
Flags &= ~LIST_FLAG_MAP;
Node=ListCreate();
Node->Flags |= LIST_FLAG_MAP_HEAD | Flags;
Node->ItemType=Buckets;
//we allocate one more than we will use, so the last one acts as a terminator
Node->Item=calloc(Buckets+1, sizeof(ListNode));
SubNode=(ListNode *) Node->Item;
for (i=0; i < Buckets; i++)
{
SubNode->Head=Node;
SubNode->Prev=SubNode;
SubNode->Flags |= LIST_FLAG_MAP_CHAIN | Flags;
SubNode->Stats=(ListStats *) calloc(1,sizeof(ListStats));
SubNode++;
}
return(Node);
}
示例8: OpenSkins
void OpenSkins( void )
{
DmOpenRef dbRef;
DmSearchStateType stateInfo;
UInt16 cardNo;
LocalID dbID;
Err err;
resourceDBList = ListCreate();
if ( resourceDBList == NULL )
return;
err = DmGetNextDatabaseByTypeCreator( true, &stateInfo,
(UInt32) SkinResourceType, (UInt32) ViewerAppID,
false, &cardNo, &dbID );
while ( err == errNone ) {
dbRef = DmOpenDatabase( cardNo, dbID, dmModeReadOnly );
if ( dbRef != NULL )
ListAppend( resourceDBList, dbRef );
err = DmGetNextDatabaseByTypeCreator( false, &stateInfo,
(UInt32) SkinResourceType, (UInt32) ViewerAppID, false,
&cardNo, &dbID );
}
}
示例9:
ListNode *ConfigFileLoadFileStores(char *Path)
{
STREAM *S;
TFileStore *FS=NULL;
char *Tempstr=NULL, *Token=NULL, *ptr;
if (! FileStores) FileStores=ListCreate();
S=STREAMOpenFile(Path,O_RDONLY);
if (S)
{
Tempstr=STREAMReadLine(Tempstr,S);
while (Tempstr)
{
StripTrailingWhitespace(Tempstr);
ptr=GetToken(Tempstr," ",&Token,0);
if (strcmp(Token,"FileStore")==0)
{
FS=ConfigFileReadFileStore(S, ptr);
ListAddNamedItem(FileStores,FS->Name,FS);
}
Tempstr=STREAMReadLine(Tempstr,S);
}
STREAMClose(S);
}
DestroyString(Tempstr);
DestroyString(Token);
return(FileStores);
}
示例10: calloc
STREAM *ConnectManagerAddClient(char *Host, int Port, int Flags, char *Name, CONNECT_FUNC OnConnect, ONDATA_FUNC OnData)
{
STREAM *S;
TConnectManagerItem *Item;
if (! ConnectManClients) ConnectManClients=ListCreate();
S=STREAMCreate();
if (! STREAMConnectToHost(S,Host,Port,Flags))
{
STREAMClose(S);
return(NULL);
}
Item=(TConnectManagerItem *) calloc(1,sizeof(TConnectManagerItem));
Item->OnConnect=OnConnect;
Item->OnData=OnData;
Item->Data=(void *) S;
Item->Name=CopyStr(Item->Name,Name);
Item->Host=CopyStr(Item->Host,Host);
Item->Port=Port;
if (Item->OnConnect && STREAMIsConnected(S)) Item->OnConnect(Item);
ListAddItem(ConnectManClients,Item);
return(S);
}
示例11: calloc
HTTPSession *HTTPSessionCreate()
{
HTTPSession *Session;
Session=(HTTPSession *) calloc(1,sizeof(HTTPSession));
//Must set all these to "" otherwise nulls can cause trouble later
Session->Protocol=CopyStr(Session->Protocol,"HTTP/1.1");
Session->ServerName=CopyStr(Session->ServerName,"");
Session->UserAgent=CopyStr(Session->UserAgent,"");
Session->UserName=CopyStr(Session->UserName,"");
Session->RealUser=CopyStr(Session->RealUser,"");
Session->ContentType=CopyStr(Session->ContentType,"");
Session->Host=CopyStr(Session->Host,"");
Session->Path=CopyStr(Session->Path,"");
Session->Arguments=CopyStr(Session->Arguments,"");
Session->ClientHost=CopyStr(Session->ClientHost,"");
Session->ClientIP=CopyStr(Session->ClientIP,"");
Session->ClientMAC=CopyStr(Session->ClientMAC,"");
Session->ClientReferrer=CopyStr(Session->ClientReferrer,"");
Session->StartDir=CopyStr(Session->StartDir,"");
Session->Depth=1;
Session->CacheTime=Settings.DocumentCacheTime;
Session->Headers=ListCreate();
Session->Flags |= SESSION_UPLOAD;
return(Session);
}
示例12: HelpCB
void
HelpCB ( Widget parent )
{
char *file, *dpath;
int verbose;
/*
* Callback to popup HTML dialog.
*/
verbose = GetVerboseLevel();
if( verbose > VERBOSE_0 )
printf ("HelpCB\n");
dpath = GetConfigValue ("GarpHTML");
file = builddirpath ( dpath, home_html );
/*
* Initialize hypertext file list.
*/
historyList = ListCreate();
if ( file ) ListAddEntry ( historyList, strdup(file) );
/*
* Popup HTML dialog.
*/
XtManageChild ( help.dialog );
XtPopup ( XtParent ( help.dialog ), XtGrabNone);
Free ( dpath );
Free ( file );
}
示例13: HTTPServerSendDocument
void HTTPServerSendDocument(STREAM *S, HTTPSession *Session, char *Path, int Flags)
{
int result;
ListNode *Vars;
Vars=ListCreate();
if (StrLen(Path)==0) result=FILE_NOSUCH;
else result=LoadFileRealProperties(Path, TRUE, Vars);
if (result==FILE_NOSUCH) HTTPServerSendHTML(S, Session, "404 Not Found","Couldn't find that document.");
else
{
//Set 'LastModified' so we can use it if the server sends 'If-Modified-Since'
Session->LastModified=atoi(GetVar(Vars,"MTime-secs"));
//If we are asking for details of a file then we treat that as a directory function
if ((result==FILE_DIR) || (strstr(Session->Arguments,"format=")))
{
HTTPServerSendDirectory(S,Session,Path,Vars);
}
else HTTPServerSendFile(S, Session, Path, Vars, Flags);
}
ListDestroy(Vars,DestroyString);
}
示例14: HTTPServerHandleStream
void HTTPServerHandleStream(STREAM *Output, HTTPSession *Session, char *SearchPath, int SendData)
{
char *Tempstr=NULL;
HTTPSession *Response;
ListNode *Vars;
STREAM *S;
glob_t Glob;
int i;
Vars=ListCreate();
SetVar(Vars,"ContentType","audio/mpeg");
Response=FileSendCreateSession("", Session, Vars, 0);
HTTPServerSendHeaders(Output, Response, FALSE);
STREAMFlush(Output);
Tempstr=MCopyStr(Tempstr,SearchPath,"/*",NULL);
glob(Tempstr,0,0,&Glob);
LogToFile(Settings.LogPath,"Stream from Dir: %s, %d files",SearchPath,Glob.gl_pathc);
for (i=0; i < Glob.gl_pathc; i++)
{
S=STREAMOpenFile(Glob.gl_pathv[i],SF_RDONLY);
if (S)
{
IcecastSendData(S, Output, 4096000);
STREAMClose(S);
}
}
globfree(&Glob);
DestroyString(Tempstr);
ListDestroy(Vars,DestroyString);
}
示例15: DownloadM3U
int DownloadM3U(char *URL, char *Title, int Flags)
{
char *Tempstr=NULL, *ID=NULL, *Doc=NULL, *ptr;
int Port=0, BytesRead=0, len=0, count=0;
int RetVal=FALSE;
ListNode *Items, *Curr;
int M3UType=M3U_PLAYLIST;
STREAM *Con;
if (Flags & FLAG_DEBUG) fprintf(stderr,"M3U STREAM: %s\n",URL);
Items=ListCreate();
Con=ConnectAndRetryUntilDownload(URL, 0, 0);
if (Con)
{
Tempstr=STREAMReadLine(Tempstr,Con);
while (Tempstr)
{
StripTrailingWhitespace(Tempstr);
StripLeadingWhitespace(Tempstr);
if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"%s\n",Tempstr);
if (StrLen(Tempstr))
{
if (strncmp("#EXT-X-STREAM-INF",Tempstr,StrLen("#EXT-X-STREAM-INF"))==0)
{
RetVal=M3UStreamInfo(Con,Title,URL,Tempstr,Flags);
M3UType=M3U_STREAMINFO;
}
else if (strncmp("#EXT-X-MEDIA-SEQUENCE",Tempstr,StrLen("#EXT-X-MEDIA-SEQUENCE"))==0) M3UType=M3U_PLAYLIST;
else if (*Tempstr != '#')
{
if (strncasecmp(Tempstr,"http",4) !=0)
{
Doc=CopyStr(Doc,URL);
ptr=strrchr(Doc,'/');
if (ptr) *ptr='\0';
Doc=MCatStr(Doc,"/",Tempstr,NULL);
}
else Doc=CopyStr(Doc,Tempstr);
ListAddItem(Items,CopyStr(NULL,Doc));
}
}
Tempstr=STREAMReadLine(Tempstr,Con);
}
STREAMClose(Con);
if (M3UType == M3U_PLAYLIST) RetVal=DownloadStream(URL, Title, Items, Flags);
}
ListDestroy(Items,DestroyString);
DestroyString(Tempstr);
DestroyString(Doc);
DestroyString(ID);
return(RetVal);
}