Who's Online |
111 user(s) are online ( 68 user(s) are browsing Forums)
Members: 0
Guests: 111
more...
|
|
|
|
How to allocate TimeRequest
|
Posted on: 2020/5/17 18:05
#121
|
Just popping in
|
Hi all I'm trying to allocate a struct TimeRequest object and copying the code from the a2d.c example code from here, yet it fails to allocate the object using AllocSysObjectTags(). Is it something stupid that I'm doing??? I'm basically just after getting the ITimer interface so is there another way to do it? cheers billy
// a2d.c
#include <exec/types.h>
#include <exec/memory.h>
#include <dos/datetime.h>
#include <devices/timer.h>
// Note these three libraries are opened by newlib startup code.
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/utility.h>
#include <proto/timer.h>
struct TimerIFace *ITimer = NULL;
int main()
{
struct TimeRequest *tr = IExec->AllocSysObjectTags(ASOT_IOREQUEST,
ASOIOR_Size, sizeof(struct TimeRequest),
ASOIOR_ReplyPort, NULL,
TAG_END);
if (tr != NULL)
{
if (!(IExec->OpenDevice("timer.device", UNIT_VBLANK, (struct IORequest *)tr, 0) ))
{
struct Library *TimerBase = (struct Library *) tr->Request.io_Device;
ITimer = (struct TimerIFace*)IExec->GetInterface(TimerBase, "main", 1, NULL);
if (ITimer != NULL)
{
struct TimeVal tv;
ITimer->GetSysTime(&tv);
IDOS->Printf("GetSysTime():\t%d %d\n", tv.Seconds, tv.Microseconds);
struct ClockData clockdata;
IUtility->Amiga2Date(tv.Seconds, &clockdata);
IDOS->Printf("Amiga2Date(): sec %d min %d hour %d\n",
clockdata.sec, clockdata.min, clockdata.hour);
IDOS->Printf(" mday %d month %d year %d wday %d\n",
clockdata.mday, clockdata.month, clockdata.year, clockdata.wday);
int32 seconds = IUtility->CheckDate(&clockdata);
IDOS->Printf("CheckDate():\t%ld\n", seconds);
seconds = IUtility->Date2Amiga(&clockdata);
IDOS->Printf("Date2Amiga():\t%ld\n", seconds);
IExec->DropInterface((struct Interface*)ITimer);
}
IExec->CloseDevice((struct IORequest *)tr);
}
IExec->FreeSysObject(ASOT_IOREQUEST, tr);
}
else
{
IDOS->Printf ("Failed to allocate TimeRequest\n");
}
return RETURN_OK;
}
Edited by billyfish on 2020/5/17 18:56:26
|
|
|
|
Re: updating sgit
|
Posted on: 2020/5/12 16:16
#122
|
Just popping in
|
@Walkero and @mdr
Awesome! I'll set up a place to download the work in progress versions from. Unfortunately I spoke too soon about the updated version of libgit2 as it crashes in the posix layer bits (open, read, unlink, etc.) so I need to try and track these down. So I've updated the build code so I can build a version of simplegit that use the previous version as before (version 0.26.3) and another that uses the latest (1.0.0). I'm also trying to get the native build to work as it's a bit of a pain to keep building on my pc and copying the executeables across to my Amiga
billy
|
|
|
|
Re: updating sgit
|
Posted on: 2020/5/6 11:44
#123
|
Just popping in
|
Hi all
Ok I have built an initial version of simplegit using the latest libgit. No new features added yet, that will be the next stage. Is anyone willing to beta test this?
cheers
billy
|
|
|
|
Re: updating sgit
|
Posted on: 2020/4/24 17:59
#124
|
Just popping in
|
@Hans I'm open to ideas, no need for a bounty or anything like that. I've forked libgit2 to https://github.com/billyfish/libgit2/tree/amigaos4_port and a naive look at the src/unix and src/win32 folders might give a vague idea of what might be needed to give a similar src/amiga folder. If this can be brought up to date, the simplegit part, which is the layer that sits on top of this library, should be much easier to bring up to date. In fact, using libgit2, a gui such as tortoisegit or gitkraken, might be achievable. In terms of compiling libgit2, the first error is the lack of struct timespec, has anyone added functionality for this for any OS4 software yet? If I have to do similar to https://github.com/billyfish/libgit2/b ... /src/win32/win32-compat.h then that's fine, it's just seeing if I can use existing ports to get things moving quicker. For simplegit itself, I think I can use Fredrik Wikstrom's work on SSHTerm to get the latest libssh2 code working. I don't know if this even vaguely answers your question, but these are the various ideas I have circling my head. Billy
|
|
|
|
Re: updating sgit
|
Posted on: 2020/4/21 15:52
#125
|
Just popping in
|
@Hans Sorry for the loooooong delay about this. My plan to update sgit hit a couple of major snags. Apart from my spare time getting squeezed by my research work taking up way more time than I anticipated, I got my head around the way that simplegit was working and then realised the major issue. So simplegit is a wrapper that calls libgit2 ( https://libgit2.org/) for its actual git functionality. Now simplegit uses a fork of libgit2 ( https://github.com/sba1/libgit2/tree/a ... e14a6487a3de17174ef9ac831) so to get the latest git functionality requires this being brought up to data as it is currently 1729 commits behond the main libgit repo. So consequently that is a lot of upstream changes to pull in and I was bracing myself as to how to go about this. If it can be brought up to date, then I would definitely make a pull request to get the amiga-specfic changes into the main tree so we don't have to go through this again. If you want the latest snapshot of how far I'd progressed with sgit, its available at https://drive.google.com/open?id=1wogEmqm4cyytWmjU6eNPenTyQiyQ-i1fIt's quite a while so my memory is a bit hazy, from what I remember the commit behaviour has been update to be like the standard git behaviour so that sgit commit -a -m "..." where the -a flag automatically stages files that have been modified and deleted, but new files you have not told Git about are not affected. I will try and take another look at this to see what further updates I can do. However the big win will be to get the libgit2 part back up to date. cheers billy
|
|
|
|
Re: Lha compressor for Linux?
|
Posted on: 2020/4/21 15:33
#126
|
Just popping in
|
@Hans
On ubuntu
sudo apt install lhasa
gives you lha
cheers
billy
|
|
|
|
Re: Downloads keep failing on OSDepot
|
Posted on: 2019/8/11 12:53
#127
|
Just popping in
|
@orgin
This may be a long shot, but is there any anti-intrusion program running on your server? The reason I ask is that the server I administer at work kept having issues with failing downloads. In the logs it would appear as "Connection reset by peers" as if people had cancelled their downloads. However what was actually happening was that the anti-intrusion software that was running on the server was getting false positives for our software and killing the connections.
|
|
|
|
Re: updating sgit
|
Posted on: 2019/8/11 12:47
#128
|
Just popping in
|
@mdr Awesome, I managed to confirm your issue yesterday as I'm finally getting some time back on sgit again, hurrah! I'll keeo you posted chaps, my aim is to have a version with the move and commit updates finished in the next week or two. I'll make this available and then start on the issues and updates that you guys have mentioned, keep them coming
|
|
|
|
Re: updating sgit
|
Posted on: 2019/7/22 12:51
#129
|
Just popping in
|
@Hans
I absolutely agree! So you're seeing delays if you're simply adding single files at a time in the root directory? E.g. If you do
sgit add foo_0.c sgit add foo_1.c sgit add foo_2.c ................ sgit add foo_n.c
on an empty repo are all of them slow or does the delay increase, the more files you add? Just working out what I need to replicate to see it.
As for a debugger, I absolutely agree again! I need to take another look at db101, but anything like gdb would be a huge boon for development cheers
billy
|
|
|
|
Re: updating sgit
|
Posted on: 2019/7/19 12:16
#130
|
Just popping in
|
@mdr Hi sorry for the delay, I'l be able to get back to this in the next couple of weeks and then I'll be able to stop making binaries available. Hiding my eyes behind my hands what errors are you getting?
|
|
|
|
Re: updating sgit
|
Posted on: 2019/7/19 12:14
#131
|
Just popping in
|
@Hans
It's been a crazy few weeks and my spare time for working on sgit has been non-existant! It should become a bit mnore relaxed in a couple of weeks and then I can get back to this.
Thanks for the extra bits to look at. Part of my initial work for the commit command used the git_status_list.. () api that's in libgit and it might be that helps if I use that for the git status command too.
|
|
|
|
Re: expat.library element length
|
Posted on: 2019/7/9 2:54
#132
|
Just popping in
|
@mritter0
For problem 1, if it's a sax parser, then you need to have a buffer that you use to get the data. So you have StartElement () and EndElement () calls that tell you when an element is started and finished. In between them the data handler can get called multiple times, in your case CharacterElement, and you have to append the data chunks together yourself. Does that make sense?
For problem 2, I'd need more info but you should have a lifecycle like
StartElement for Keywords StartElement for ReservedWords One or more calls to CharacterElement EndElement for ReservedWords EndElement for Keywords
|
|
|
|
Re: updating sgit
|
Posted on: 2019/6/11 12:06
#133
|
Just popping in
|
Hi all Wow! I'm glad there's interest! I've added the issues page on my forked repo at https://github.com/billyfish/simplegit/issues, if you want to add them in. Once I've finished the support for "sgit mv", I can start working through these. Keep them coming! cheers billy
|
|
|
|
Re: updating sgit
|
Posted on: 2019/6/11 12:04
#134
|
Just popping in
|
@sTix
Interesting! Is this fully working on AROS and MorphOS? Might be the way to go...
|
|
|
|
Re: updating sgit
|
Posted on: 2019/6/7 21:30
#135
|
Just popping in
|
@walkero Sure So far I've added the -a switch for the commit command which automatically stages files that have been modified and deleted, but ignore new files you have not told Git about. I'm in the process of adding support for the mv command and setting up the default push behaviour when the repository and refspec aren't specified. Basically I'm plugging the holes of my most common git workflow so I can do: sgit commit -a -m "blah" sgit push the same as I do with the standard git command. Feel free to suggest any features that you are interested in and I'll see what I can do. cheers Billy
|
|
|
|
Re: updating sgit
|
Posted on: 2019/6/7 17:51
#136
|
Just popping in
|
@Raziel That's entirely what I'm going to do! I've forked it and after I'm happy with it all, I'll make a pull request. cheers Billy
|
|
|
|
updating sgit
|
Posted on: 2019/6/7 16:36
#137
|
Just popping in
|
Hi all
I've been tinkering with a fork of sgit to add in some of the standard git features that it is missing. Before I make a pull request with the additions, I'm checking to see if anyone is interested in using it as some extra testing. If you're interested, just drop me a line.
billy
|
|
|
|
Re: library auto init code (solved)
|
Posted on: 2019/4/12 10:58
#138
|
Just popping in
|
I'm revisiting this code as I'm about to release a new version of the library code generation project that this was all part of as well as open sourcing it.
I'll check the code with the assert () calls in, I think I just refactored the code the generated by IDLTool, but I could be wrong.
|
|
|
|
Re: How detect and fix heap trashing ?
|
Posted on: 2019/1/23 12:21
#139
|
Just popping in
|
@kas1e try this
/***********************************************************************
* Set the text in a menu / submenu option *
***********************************************************************/
void menu_entry_set_settingtext( menuEntry * entry, char * text )
{
char str[256];
/* this could overflow */
strcpy( entry->settingtext, text );
if( entry->text_obj != (textObj *)0 ){
if( entry->show_subsetting && entry->settingtext[0]!=0 ){
int res = snprintf(str, 256, "%s : %s",entry->text,entry->settingtext);
if (res > 256) {
printf ("string not large enough for \"%s\" and \"%s\"\\n", entry->text,entry->settingtext);
}
textObj_setText( entry->text_obj, str );
} else {
textObj_setText( entry->text_obj, text );
}
}
}
/***********************************************************************
* Create the menu textobject for opengl displaying *
***********************************************************************/
void menu_create_textobj( menuEntry * entry )
{
char str[256];
if( entry->text_obj == (textObj *)0 ){
if( entry->show_subsetting && entry->settingtext[0]!=0 ){
int res = snprintf(str, 256, "%s : %s",entry->text,entry->settingtext);
if (res > 256) {
printf ("string not large enough for \"%s\" and \"%s\"\\n", entry->text,entry->settingtext);
}
entry->text_obj = textObj_new( str, entry->fontname, entry->fontsize );
} else {
entry->text_obj = textObj_new( entry->text, entry->fontname, entry->fontsize );
}
}
}
|
|
|
|
Re: What the best and fast way to get list of files/dirs in the directory
|
Posted on: 2018/11/19 14:20
#140
|
Just popping in
|
@kas1e
char **GetFileNameInDirectory (const char* dir)
{
char **filenames_pp = NULL;
struct ExamineData *data_p = IDOS->ExamineObjectTags (EX_StringNameInput, dir, TAG_END);
if (data_p)
{
if (EXD_IS_DIRECTORY (data_p))
{
APTR context_p = IDOS->ObtainDirContextTags (EX_StringNameInput, dir,
EX_DataFields, (EXF_NAME | EXF_LINK | EXF_TYPE),
TAG_END);
if (context_p)
{
struct List *names_p = IExec->AllocSysObjectTags (ASOT_LIST, TAG_DONE);
if (names_p)
{
struct ExamineData *dat_p;
size_t num_entries = 0;
/*
context_p takes care of deleting the returned dat_p objects
when we call ReleaseDirContext, so we mustn't call
FreeDosObject on them
*/
while ((dat_p = IDOS->ExamineDir (context_p)))
{
if (EXD_IS_FILE (dat_p))
{
char *copied_name_p = CopyToNewString (dat_p -> Name);
if (copied_name_p)
{
struct Node *node_p = IExec->AllocSysObjectTags (ASOT_NODE,
ASONODE_Name, copied_name_p,
ASONODE_Size, sizeof (struct Node),
TAG_DONE);
if (node_p)
{
IExec->AddTail (names_p, node_p);
++ num_entries;
}
}
}
}
if (ERROR_NO_MORE_ENTRIES != IDOS->IoErr ())
{
IDOS->Printf ("Failed to obtain directory context for "%s"n", dir);
IDOS->PrintFault (IDOS->IoErr (), NULL); /* failure - why ? */
}
else
{
filenames_pp = (char **) IExec->AllocVecTags (num_entries * sizeof (char *), TAG_DONE);
if (filenames_pp)
{
char *current_filename_pp = filenames_pp;
struct Node *node_p = IExec->GetHead (names_p);
struct Node *next_node_p = NULL;
while (node_p)
{
if (node_p -> ln_Name)
{
*current_filename_pp = node_p -> ln_Name;
++ current_filename_pp;
(node_p -> ln_Name = NULL;
}
next_node_p = IExec->GetSucc (node_p);
IExec->FreeSysObject (ASOT_NODE, node_p);
node_p = next_node_p;
}
}
}
IExec->FreeSysObject (ASOT_LIST, (APTR) list_p);
}
IDOS->ReleaseDirContext (context_p); /* NULL safe */
} /* if (context_p) */
else
{
IDOS->Printf ("oopsn");
IDOS->PrintFault (IDOS->IoErr (), NULL); /* no context - why ? */
}
} /* if (EXD_IS_DIRECTORY (data_p)) */
IDOS->FreeDosObject (DOS_EXAMINEDATA, data_p);
} /* if (data_p) */
return filenames_pp;
}
char *CopyToNewString (const char *src_p)
{
char *dest_p = NULL;
if (src_p)
{
size_t len = strlen (src_p);
dest_p = (char *) IExec->AllocVecTags (len + 1, TAG_DONE);
if (dest_p)
{
strcpy (dest_p, start_p);
}
}
return dest_p;
}
|
|
|
|